Repository navigation
Description
Proposal: Split SDK (local-only) vs Recipes (server-side A2A agents)
Context
Right now our SDK (openhands-sdk) supports building agents, conversations, and tools locally.
We have been debating how to support remote execution (e.g., agents running in a container or service, callable via API).
We explored designs like LocalRunLoop and RemoteRuntimeLoop (#213), where a Tool spec on the client would be “re-bound” to executors on the server.
But this introduces a lot of complexity:
- Two execution modes (local vs remote) with different semantics
- Hard to support nested agents (e.g., one conversation creating another conversation and wiring it as a tool)
- Bridge logic on the client to forward calls across runtime boundaries
- Debuggability and lifecycle management are much harder
We realized: trying to make SDK both local and remote leads to complexity and breakage.
Instead, we can split responsibilities.
Proposal
1. SDK remains local-only
- Keep the SDK slim and stable:
LLM,Tool,Agent,Conversation, etc..create()binds executors locally- Users can still assemble arbitrary agents and conversations in Python
- No remote execution layer in the SDK
- No RemoteRunLoop
- No Tool proxy executors
- The SDK is always local-first.
2. Introduce openhands/recipe
- A new package that contains pre-defined recipes for “production agents”.
- Each recipe:
- Assembles an
Agentwith a curated list of tools - Wraps controller/orchestrator logic (how conversations are managed, callbacks, multi-agent logic if needed)
- Exposes a simple API surface (
start,send_message,run,pause,status,events,close)
- Assembles an
- Recipes are opinionated, high-level constructs.
Example:DevAgentthat bundlesBashTool,FileEditorTool,TaskTrackerTool.
3. Expose recipes via A2A protocol
- Each recipe is exported as an A2A Agent.
- Mapping:
- Agent → A2A Agent
- Tools → A2A Capabilities
- Conversation lifecycle → A2A
invokecalls - Events / Status → A2A state + event streams
- This makes recipes interoperable with other A2A-compatible systems.
- All server-side logic (executor binding, workspace, safety, auth, logging) stays in the recipe implementation.
- We get a bunch of A2A feature for free (mostly), e.g., PushNotification/callback that we want here
- Client applications will consume these agents directly through A2A.
They can also wrap their own custom server (FastAPI, Flask, gRPC, etc.) that internally uses A2A to interact with recipes.
Benefits
-
Clear boundaries
SDK is only for local agent composition. Recipes handle remote exposure. -
Simplicity
No dual-mode runtime. No remote executor plumbing. -
Interoperability
Using A2A means agents can call each other across systems in the future. -
Production readiness
Recipes can enforce safety limits, tenancy, logging, and auditing without burdening SDK users.
Example Layout
openhands-sdk/ # local SDK
Agent, Tool, Conversation, LLM, etc.
openhands-recipe/ # new package
/recipes/
/dev_agent/
recipe.py # assemble agent + tools
policy.py # safety, config
/a2a/
adapter.py # FastAPI adapter → A2A protocol
Example UX
Local SDK (unchanged)
from openhands.sdk import LLM, Agent, Conversation, Message, TextContent
from openhands.tools import BashTool, FileEditorTool, TaskTrackerTool
llm = LLM(model="claude-sonnet-4", api_key="...")
tools = [BashTool.create(...), FileEditorTool.create(), TaskTrackerTool.create()]
agent = Agent(llm=llm, tools=tools)
conv = Conversation(agent)
conv.send_message(Message(role="user", content=[TextContent(text="Hello!")]))
conv.run()Remote via A2A
# Client using an A2A library
session = a2a.create_session(agent_id="openhands.dev_agent")
a2a.invoke(agent_id, session.id, {"type":"send_message","text":"Hello!"})
a2a.invoke(agent_id, session.id, {"type":"run"})
status = a2a.invoke(agent_id, session.id, {"type":"status"})
events = a2a.invoke(agent_id, session.id, {"type":"events","after":0})Next Steps
- Create
openhands-recipepackage. - Implement one reference recipe (
dev_agent) that uses Bash/FileEditor/TaskTracker. - Add FastAPI A2A adapter to expose recipes.
- Support minimal lifecycle verbs:
send_message,run,status,events,pause,close. - Iterate: add streaming support, safety limits, multi-agent orchestration.
Bottom line:
- SDK stays local-only, no remote runtime loop.
- Recipes in a new package assemble production agents and are exposed via A2A protocol.
- Client apps consume agents directly through A2A, optionally wrapping their own servers.
- This gives us a clean architecture, easier dev UX, and future interoperability.
Activity
xingyaoww commentedon Sep 12, 2025
The production story:
enyst commentedon Sep 12, 2025
How will the local + remote runtime look like?
xingyaoww commentedon Sep 13, 2025
@enyst i think it will be something like #194
Basically ALL SDK is "local".
If you want to do remote runtime, you need to use an opinionated server written using SDK (eg #194) - then start a docker image, copy the server binary into it, and then start the docker. Then the client will simply interact with the docker to run tasks
enyst commentedon Sep 15, 2025
Do we still need to
It sounds strange to me, but I think we don't anymore?
xingyaoww commentedon Sep 16, 2025
@enyst i think we sill might need something like this, but it is just that this should be done in the docker build phase, shouldn't need to be explicit though.
In context of this PR, some updates are:
Seems to me that we've reached certain concensus to keep going, so we can probably close this one