A2A Bridge
TL;DR
Expose any RUNNING JuliaOS agent as a public micro‑service in 60 seconds. The bridge is a thin Python layer that imports
a2a-sdk
pypi.org, discovers agents, and turns them into A2A‑compliant endpoints.
1 Install & Run
# 1. Start the JuliaOS backend (defaults to 127.0.0.1:8052)
cd backend && julia run_server.jl
# 2. Create and Activate a virtual environment
cd a2a & python3 -m venv venv & source venv/bin/activate
# 3. Install bridge deps
pip install -e ../python & pip install -e .
# 3. Start the bridge (listens on 127.0.0.1:9100)
cd a2a/src/a2a && python server.py
2 Package Anatomy
a2a/server.py
A2AStarletteApplication
Bootstraps Starlette; one mount per agent.
a2a/agents/card.py
make_agent_card
Converts JuliaOS Agent
→ A2A AgentCard
metadata.
a2a/agents/executors.py
GenericExecutor
Core adapter (A2A ↔︎ webhook).
a2a/example/…
create_add2_agent.py
, client.py
Minimal end‑to‑end demo.
All other files under _juliaos_client_api
are auto‑generated Pydantic models.
3 Quick‑Start Example
# Register a toy “add 2” agent (creates + runs the agent)
python a2a/src/a2a/example/create_add2_agent.py
# Call it via A2A (bridge must be running)
python a2a/src/a2a/example/client.py
4 How the Bridge Works (Deep Dive)
Discovery – At startup the bridge calls
GET /api/v1/agents?status=RUNNING
.Dynamic mounts – For every agent it mounts
/<id>/a2a
viaapp.mount()
(Starlette API).Execution
async with JuliaOSConnection(api_url) as jc: agent = Agent.load(jc, id) result = await agent.call_webhook(payload) return result.logs[-1].content # streamed back to caller
Streaming – The bridge yields the response as an HTTP chunked stream, matching the A2A spec.
Last updated