ExecutionAdapter, streams events via SSE, and delivers results back to Convex via callbacks. Bridge is not middleware — it does not transform data or apply business logic.
What Bridge Does
| Responsibility | How |
|---|---|
| Route dispatch | Receives step execution requests from Convex, selects the correct adapter by provider name, calls adapter.execute() |
| Stream events | SSE endpoint pushes execution events (tool calls, assistant text, progress) to connected Burgundy clients |
| Deliver callbacks | POSTs execution results to Convex callback URLs with 3x retry and exponential backoff |
| Manage adapters | Loads one or more adapters at startup, initializes each, runs health checks |
| Gateway API | Proxies management requests (agent CRUD, skill sync, model discovery) to adapters that support RuntimeManager |
Bridge Dispatch Flow
Bridge Dispatch Flow
1
Governance gates passedSends dispatch payload: taskId, agentId, message, systemPrompt, model, tools, timeout, callbackUrl
HTTP POST /api/v2/dispatch↓
2
Validates request, authenticates tokenParses body, verifies gateway token hash, builds ExecutionRequest from dispatch payload.
adapter.execute(request)↓
3
🔌 Gateway Adapter
Executes on runtimeTranslates ExecutionRequest to runtime-native format. Runs the task. Returns ExecutionResult with output, usage, cost.
callback to convex (3x retry)↓
4
Idempotent, dedupedRecords step result, token events, and cost. Fires completion event to interpreter. Dedup via callbackDedup table.
📺 SSE Stream· Live events to Burgundy during steps 2-3
tool.invokedassistant.textexec.progresstool.completed
Convex
Bridge
Gateway
SSE
🔧 The ExecutionAdapter Interface
Every gateway adapter implements a single interface. The contract is intentionally thin — accept a normalized request, execute it, return a normalized result.Bridge handles everything else: prompt assembly from workspace files, tool spec normalization, output strategy selection, and callback delivery. The adapter’s only job is to run the task and return a result.
Multi-Adapter Mode
A single Bridge instance can load multiple adapters simultaneously. Set theBRIDGE_ADAPTERS environment variable to a comma-separated list of provider names (e.g., BRIDGE_ADAPTERS=openclaw,gloo-ai). Bridge initializes each adapter at startup and routes each dispatch request to the correct adapter based on the provider field in the request payload. This replaces the earlier one-Bridge-per-adapter deployment model — multiple gateways can now share a single Bridge URL.
📥 ExecutionRequest
The bridge builds a fully-assembled, gateway-agnostic execution request before passing it to the adapter:| Field | Type | Description |
|---|---|---|
taskId | string | Unique identifier generated by Bridge |
agentId | string | Platform agent ID for logging and telemetry |
message | string | The work to perform (command + stdin + output instructions) |
systemPrompt | string? | Fully assembled system prompt (SOUL.md + agent config) |
model | string? | Requested model (e.g., claude-sonnet-4-6) |
tools | NormalizedTool[]? | Normalized tool definitions for the adapter to translate |
mcpServers | McpServerSpec[]? | MCP server configurations |
timeoutSeconds | number | Maximum execution time |
outputStrategy | OutputStrategy | How results should be captured (file, stream, or structured) |
resumeToken | string? | Resume a prior conversation session |
metadata | Record? | Opaque workflow context (run_id, step_id, cwd) |
📤 ExecutionResult
Every adapter returns a normalized result:| Field | Type | Description |
|---|---|---|
status | "ok" | "error" | Execution outcome |
output | string? | Agent’s output text |
outputs | Record? | Structured outputs (parsed by adapter) |
durationMs | number | Execution duration |
usage | NormalizedUsage? | Token counts (input, output, thinking, cache) |
costUsd | number? | Cost in USD if the runtime provides it |
model | string? | Actual model used (may differ from requested) |
resumeToken | string? | Token for session continuity |
conversationMessages | ConversationMessage[]? | Full LLM conversation captured during execution |
🔌 Built-in Adapters
- OpenClaw
- Claude Agent SDK
- Vercel AI
- Gloo AI
Package:
@tangogroup/adapter-openclawStateful daemon. Stores agent configs, manages workspace files, supports MCP and sandboxing. The most full-featured adapter.Interfaces implemented: ExecutionAdapter, RuntimeManager, AgentManager, SkillManager, SystemManager| Capability | Supported |
|---|---|
| Streaming | Yes |
| Session Resume | Yes |
| File I/O | Yes |
| MCP Servers | Yes |
| Sandboxing | Yes |
| Cost Tracking | Yes |
| Management | Yes |
📺 SSE Event Streaming
Bridge maintains an SSE endpoint that Burgundy clients connect to for real-time execution events:| Event type | Emitted when | Data |
|---|---|---|
execution.started | Adapter begins execution | taskId, agentId |
assistant.text | LLM produces output text | taskId, content |
tool.invoked | Agent calls a tool | taskId, toolName, input |
tool.completed | Tool returns a result | taskId, toolName, output |
execution.progress | Adapter reports progress | taskId, custom data |
execution.completed | Execution finishes successfully | taskId, output, usage |
execution.failed | Execution fails | taskId, error, errorCode |
🔄 Callback Handling
When execution completes, Bridge delivers the result to Convex via an HTTP callback:- Bridge POSTs the
ExecutionResultto the callback URL provided in the dispatch request. - On failure, Bridge retries up to 3 times with exponential backoff.
- Convex deduplicates callbacks using the
callbackDeduptable (keyed ontaskId). Duplicate callbacks are acknowledged but not processed. - On successful delivery, Convex records the step result, creates token events for cost tracking, and fires a completion event to the interpreter.
🧩 Management Sub-Interfaces
Adapters may optionally implement management interfaces for richer platform integration:| Interface | Methods | Used by |
|---|---|---|
| AgentManager | listAgents, createAgent, updateAgent, deleteAgent, file/binding management | OpenClaw |
| SkillManager | listSkills, readSkill, writeSkill, deleteSkill, dependency installation | OpenClaw |
| SystemManager | reloadConfig, getModelCatalog, getSecurityPosture | OpenClaw |
isAgentManager(), isSkillManager(), isSystemManager()) and exposes the corresponding gateway API routes only when the loaded adapter supports them.
See also: System Overview | Gateways | Workflow Execution Flow
