adk-server
HTTP server and A2A protocol for Rust Agent Development Kit (ADK-Rust) agents.
Overview
adk-server provides HTTP infrastructure for the Rust Agent Development Kit (ADK-Rust):
- REST API - Standard HTTP endpoints for agent interaction
- A2A Protocol - Agent-to-Agent communication (JSON-RPC 2.0)
- SSE Streaming - Server-Sent Events for real-time responses
- Web UI - Built-in chat interface for testing
- RemoteA2aAgent - Connect to remote agents as sub-agents
- Auth Bridge - Flow authenticated identity from HTTP headers into agent execution
- Artifacts - Binary artifact storage and retrieval per session
- Debug/Tracing - Trace inspection and graph visualization endpoints
Installation
[]
= "0.4"
Or use the meta-crate:
[]
= { = "0.4", = ["server"] }
Quick Start
Basic Server
use ;
use Arc;
let config = new;
let app = create_app;
let listener = bind.await?;
serve.await?;
Security Configuration
Configure CORS, timeouts, and other security settings:
use ;
use Duration;
// Development mode (permissive CORS, detailed errors)
let config = new
.with_security;
// Production mode (restricted CORS, sanitized errors)
let config = new
.with_security;
// Or configure individual settings
let config = new
.with_allowed_origins
.with_request_timeout
.with_max_body_size // 5MB
.with_error_details;
Optional Services
let config = new
.with_artifact_service
.with_memory_service
.with_span_exporter
.with_request_context;
Runner Configuration Passthrough
ServerConfig can now forward runner-level compaction and prompt-cache settings:
let config = new
.with_compaction
.with_context_cache;
This applies to both the standard SSE runtime endpoints and the A2A runtime controller.
A2A Server
use create_app_with_a2a;
let app = create_app_with_a2a;
// Exposes:
// GET /.well-known/agent.json - Agent card
// POST /a2a - JSON-RPC endpoint
// POST /a2a/stream - SSE streaming
Remote Agent Client
use RemoteA2aAgent;
let remote = builder
.description
.agent_url
.build?;
// Use as sub-agent
let coordinator = new
.sub_agent
.build?;
Auth Bridge
Flow authenticated identity from HTTP requests into agent execution:
use ;
use RequestContext;
use async_trait;
;
let config = new
.with_request_context;
When configured, the extracted RequestContext flows into InvocationContext, making scopes available to tools via ToolContext::user_scopes(). Session and artifact endpoints enforce user_id authorization against the authenticated identity.
API Endpoints
Health
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check with component status |
Apps
| Endpoint | Method | Description |
|---|---|---|
/api/apps |
GET | List available agents |
/api/list-apps |
GET | adk-go compatible app listing |
Sessions
| Endpoint | Method | Description |
|---|---|---|
/api/sessions |
POST | Create session |
/api/sessions/{app_name}/{user_id}/{session_id} |
GET, DELETE | Get or delete session |
/api/apps/{app_name}/users/{user_id}/sessions |
GET, POST | List or create sessions |
/api/apps/{app_name}/users/{user_id}/sessions/{session_id} |
GET, POST, DELETE | Get, create, or delete session |
Runtime
| Endpoint | Method | Description |
|---|---|---|
/api/run/{app_name}/{user_id}/{session_id} |
POST | Run agent with SSE |
/api/run_sse |
POST | adk-go compatible SSE runtime |
Artifacts
| Endpoint | Method | Description |
|---|---|---|
/api/sessions/{app_name}/{user_id}/{session_id}/artifacts |
GET | List artifacts for a session |
/api/sessions/{app_name}/{user_id}/{session_id}/artifacts/{artifact_name} |
GET | Get a specific artifact |
Debug and Tracing
| Endpoint | Method | Description |
|---|---|---|
/api/debug/trace/{event_id} |
GET | Get trace by event ID (admin only when auth configured) |
/api/debug/trace/session/{session_id} |
GET | Get all spans for a session |
/api/debug/graph/{app_name}/{user_id}/{session_id}/{event_id} |
GET | Get graph visualization |
/api/apps/{app_name}/users/{user_id}/sessions/{session_id}/events/{event_id} |
GET | Get event data |
/api/apps/{app_name}/users/{user_id}/sessions/{session_id}/events/{event_id}/graph |
GET | Get graph (path-style) |
/api/apps/{app_name}/eval_sets |
GET | Get evaluation sets (stub) |
UI Protocol
| Endpoint | Method | Description |
|---|---|---|
/api/ui/capabilities |
GET | Supported UI protocols/features (adk_ui, a2ui, ag_ui, mcp_apps) |
/api/ui/resources |
GET | List MCP UI resources (ui:// entries) |
/api/ui/resources/read?uri=... |
GET | Read a registered MCP UI resource |
/api/ui/resources/register |
POST | Register an MCP UI resource (validated ui:// + mime/meta) |
Runtime endpoints support protocol negotiation via:
- request body field
uiProtocol/ui_protocol - header
x-adk-ui-protocol(takes precedence)
Supported runtime profile values: adk_ui (default), a2ui, ag_ui, mcp_apps.
A2A Endpoints
| Endpoint | Method | Description |
|---|---|---|
/.well-known/agent.json |
GET | A2A agent card |
/a2a |
POST | A2A JSON-RPC |
/a2a/stream |
POST | A2A streaming |
Web UI
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Redirect to /ui/ |
/ui/ |
GET | Built-in chat interface |
/ui/assets/config/runtime-config.json |
GET | Runtime configuration |
/ui/{*path} |
GET | Static UI assets |
Security
The server applies the following security layers automatically:
- CORS (configurable allowed origins)
- Request body size limits (default 10MB)
- Request timeouts (default 30s)
X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 1; mode=block- Request ID tracking via
x-request-idheader - User ID authorization on session/artifact/debug endpoints when auth is configured
Features
- Axum-based async HTTP server
- CORS support with configurable origins
- Embedded web UI assets
- Multi-agent routing via
AgentLoader - Health checks with component status
- OpenTelemetry trace integration
- Auth middleware bridge for identity propagation
- Artifact storage and retrieval
- A2A protocol with JSON-RPC 2.0
Related Crates
- adk-rust - Meta-crate with all components
- adk-runner - Execution runtime
- adk-cli - CLI launcher
- adk-telemetry - OpenTelemetry integration
- adk-artifact - Artifact storage
- adk-auth - Authentication (JWT bridge)
- adk-ui - UI protocol support
License
Apache-2.0
Part of ADK-Rust
This crate is part of the ADK-Rust framework for building AI agents in Rust.