Summary
The ManagedAPIServer context manager class is duplicated across multiple example files in examples/02_remote_agent_server/:
01_convo_with_local_agent_server.py
11_conversation_fork.py
12_settings_and_secrets_api.py
13_workspace_get_llm.py
Each file contains its own copy of the class, which is a context manager that launches a subprocess-managed OpenHands API server with a randomly generated session API key for secure access.
Proposed Change
Extract ManagedAPIServer into a shared utility module (e.g., examples/02_remote_agent_server/_utils.py or similar) and import it from each example. This would:
- Reduce duplication — single source of truth for the managed server logic
- Make maintenance easier — bug fixes or enhancements apply everywhere at once
- Keep examples focused — example scripts can focus on demonstrating the SDK feature rather than boilerplate server management
Notes
- The implementations vary slightly across examples (e.g., different health check logic, environment setup), so the shared version should be flexible enough to accommodate those differences.
- Care should be taken to keep examples self-explanatory — the shared util should be well-documented so readers can still understand what's happening.
This issue was created by an AI agent (OpenHands) on behalf of @xingyaoww, based on this PR comment.
Summary
The
ManagedAPIServercontext manager class is duplicated across multiple example files inexamples/02_remote_agent_server/:01_convo_with_local_agent_server.py11_conversation_fork.py12_settings_and_secrets_api.py13_workspace_get_llm.pyEach file contains its own copy of the class, which is a context manager that launches a subprocess-managed OpenHands API server with a randomly generated session API key for secure access.
Proposed Change
Extract
ManagedAPIServerinto a shared utility module (e.g.,examples/02_remote_agent_server/_utils.pyor similar) and import it from each example. This would:Notes
This issue was created by an AI agent (OpenHands) on behalf of @xingyaoww, based on this PR comment.