OpenClawAgent gives you a clean way to plug an OpenClaw worker into an Agency Swarm agency.
Use it when Agency Swarm should stay in charge of delegation while OpenClaw handles one specialized branch.
Start With One Import
Use It In An Agency
OpenClawAgent can already reach a running OpenClaw endpoint.
By default it calls the local /openclaw/v1 proxy, so either mount that proxy in the same FastAPI app or point the agent at a custom base_url.
Choose How To Reach OpenClaw
- Same FastAPI app
- Custom host and port
- External OpenClaw server
/openclaw/v1 proxy in the same app.
Before you use this path, mount that proxy in the same app with attach_openclaw_to_fastapi(app).
Install the FastAPI extras for that path: pip install "agency-swarm[fastapi]".
That mounted runtime also needs a working openclaw gateway command and a compatible Node installation.
If OPENCLAW_PROXY_PORT is set, OpenClawAgent uses that port.
Otherwise it falls back to PORT, then 8000.Collaboration Pattern
UseOpenClawAgent as a worker.
Do not use it as the top-level delegator.
Why:
- Agency Swarm owns the recursive collaboration loop
- OpenClaw has its own native messaging and session tools
- keeping Agency Swarm on top preserves clean run hierarchy in the frontend
When a normal Agency Swarm agent delegates to
OpenClawAgent, the streamed events already carry the same parent_run_id, agent_run_id, agent, and callerAgent fields the current frontend uses for nested runs.Tools And Limits
OpenClawAgent is not the same thing as giving OpenClaw your normal Agency Swarm Python tools.
Today, the clean extension paths for OpenClaw itself are:
- OpenClaw plugin tools via
api.registerTool(...) - MCP servers exposed to OpenClaw
- OpenClaw tool policy config such as allowlists and deny lists
Host the OpenClaw proxy in the same FastAPI app
Host the OpenClaw proxy in the same FastAPI app
If your Agency Swarm app should also start the OpenClaw runtime, attach the proxy to the same FastAPI app:When that runtime is meant to be a delegated worker, start the app with:That worker mode disables the OpenClaw messaging paths that compete with Agency Swarm delegation.
Current limitation
Current limitation
OpenClawAgent can receive delegated work, but it should not be the sender in Agency Swarm communication flows.If you need deeper tool customization inside OpenClaw, use OpenClaw plugins or MCP instead of trying to pass ordinary Agency Swarm Python tools through the wrapper.