Nested Conversation Support
- [ ] This change is worth documenting at https://docs.all-hands.dev/
- [x] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below
End-user friendly description of the problem this fixes or functionality this introduces.
This PR introduces nested conversation support in OpenHands, allowing agent loops to run inside Docker containers with each container having its own isolated conversation. This improves scalability and isolation between different conversations.
Summarize what the PR does, explaining any non-trivial design decisions.
This PR adds support for nested conversations in OpenHands by introducing a new conversation manager implementation that allows for running agent loops inside Docker containers. Each container has its own isolated conversation, improving scalability and resource management.
Key changes:
- Added
NestedEventStoreto handle events from nested conversations running in containers - Created
DockerNestedConversationManagerto manage conversations running in Docker containers - Modified runtime to handle cases where event stream might be null
- Added support for environment variable-based conversation manager selection
- Added volume mounting for conversation directories within workspaces
- Implemented container health checks for nested conversations
Design decisions:
- Each nested conversation runs in its own Docker container for isolation
- Conversations can be accessed via a URL that points to the container
- Volume mounting ensures that conversation data persists between container restarts
- The parent server manages container lifecycle and resource allocation
Testing
To test this, set the environment variable:
CONVERSATION_MANAGER_CLASS=openhands.server.conversation_manager.docker_nested_conversation_manager.DockerNestedConversationManager
Link of any specific issues this addresses:
N/A
To run this PR locally, use the following command:
docker run -it --rm -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock --add-host host.docker.internal:host-gateway -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:aee578e-nikolaik --name openhands-app-aee578e docker.all-hands.dev/all-hands-ai/openhands:aee578e