Skip to main content

Crate adk_server

Crate adk_server 

Source
Expand description

§adk-server

HTTP server and A2A protocol for ADK agents.

§Overview

This crate provides HTTP infrastructure:

The server answers only loopback host names and IP addresses by default and allows no cross-origin access; list public hosts with ServerConfig::with_allowed_hosts and browser origins with ServerConfig::with_allowed_origins.

The a2a-v1 feature adds the a2a::v1 module: A2A v1.0.0 JSON-RPC and REST handlers for all 11 operations, built on a2a-protocol-types.

§Quick Start

use std::sync::Arc;

use adk_core::{Agent, SingleAgentLoader};
use adk_server::{ServerConfig, create_app};
use adk_session::InMemorySessionService;

async fn serve(agent: Arc<dyn Agent>) -> std::io::Result<()> {
    let config = ServerConfig::new(
        Arc::new(SingleAgentLoader::new(agent)),
        Arc::new(InMemorySessionService::new()),
    );
    let app = create_app(config);
    let listener = tokio::net::TcpListener::bind("127.0.0.1:8080").await?;
    axum::serve(listener, app).await
}

§A2A Protocol

create_app_with_a2a and ServerBuilder::with_a2a expose an agent over A2A:

  • GET /.well-known/agent-card.json (and /.well-known/agent.json) - Agent card
  • POST /a2a - JSON-RPC: message/send, tasks/get, tasks/cancel
  • POST /a2a/stream - JSON-RPC streaming: message/stream, message/send

§Features

No feature is on by default; the REST and SSE runtime and the A2A endpoints above need none. A2A v1.0 (a2a-v1, a2a-interceptors), background runs and cron (background), wake-ups (webhook-ingress, google-triggers), the approval inbox (approvals), agents over MCP (mcp), openai-webhooks, yaml-agent, agent-registry, Agent Engine (agent-engine, vertex-remote-engine) and the AWP agent edge (awp, awp-sqlite, awp-postgres, awp-redis) each have a feature; the README says what each enables.

Re-exports§

pub use agent_engine::AgentEngineOptions;
pub use agent_engine::AgentEngineState;
pub use agent_engine::agent_engine_router;
pub use agent_engine::build_agent_engine_app;
pub use agent_engine::serve_agent_engine;
pub use background::BackgroundState;
pub use background::DurableScheduler;
pub use background::DurableWorker;
pub use background::DurableWorkerConfig;
pub use background::GovernanceRefusal;
pub use background::ParkReason;
pub use background::RunStatus;
pub use background::RunStatusResponse;
pub use background::SchedulerTick;
pub use background::SubmitRunRequest;
pub use background::SubmitRunResponse;
pub use background::WorkerHandle;
pub use background::WorkerHooks;
pub use background::WorkflowExecutor;
pub use background::WorkflowRegistry;
pub use background::WorkflowRunContext;
pub use background::WorkflowState;
pub use background::background_runs_router;
pub use background::background_runs_router_with_state;
pub use background::ConcurrencyPolicy;
pub use background::CreateCronJobRequest;
pub use background::CronJobResponse;
pub use background::CronJobStatus;
pub use background::CronState;
pub use background::RunCronJobNowResponse;
pub use background::cron_jobs_router;
pub use background::cron_jobs_router_with_state;
pub use background::start_cron_scheduler;
pub use background::validate_cron_expression;
pub use a2a::A2aClient;
pub use a2a::Executor;
pub use a2a::ExecutorConfig;
pub use a2a::RemoteA2aAgent;
pub use a2a::RemoteA2aAgentBuilder;
pub use a2a::RemoteA2aConfig;
pub use a2a::agent_skills_from_index;
pub use a2a::build_agent_card;
pub use a2a::build_agent_skills;
pub use a2a::A2aServer;
pub use a2a::A2aServerApp;
pub use a2a::A2aServerBuilder;
pub use auth_bridge::AuthenticatedCaller;
pub use config::ADMIN_SCOPE;
pub use config::DEFAULT_RUN_TIMEOUT;
pub use config::SecurityConfig;
pub use config::ServerConfig;
pub use rest::A2aController;
pub use rest::A2aTaskRetention;
pub use rest::FreezeDelegate;
pub use rest::FreezeReport;
pub use rest::GovernanceController;
pub use rest::GovernanceStatus;
pub use rest::RunningRuns;
pub use rest::RuntimeController;
pub use rest::ServerBuilder;
pub use rest::SessionController;
pub use rest::ShutdownHandle;
pub use rest::create_app;
pub use rest::create_app_with_a2a;
pub use rest::shutdown_signal;

Modules§

a2a
agent_engine
Agent Engine dispatch surface for the Gemini Enterprise Agent Platform.
approvals
Approval inbox endpoints, a background ticker, and a signed webhook notifier for an ApprovalService.
auth_bridge
Auth middleware bridge for flowing authenticated identity into agent execution.
awp
The AWP 2.0 agent edge (spec 3.5 §7.3, §7.4, §7.9, §7.10; feature awp).
background
Background Runs and Cron Scheduling
config
google_triggers
Google push triggers: Pub/Sub push subscriptions and Eventarc deliveries (CloudEvents over HTTP) that start durable runs, authenticated by Google-signed OIDC tokens.
mcp
Agents served over MCP: each agent is an MCP tool whose call starts a durable run, followed as an MCP task, with held tool calls asked as elicitations (feature mcp).
registry
Agent Registry REST API.
rest
subject_rights
HTTP endpoints for a signed-in person’s subject rights: export, erase, and linking the visitor id they used before signing in.
ui_protocol
UI protocol constants, capability specs, and normalization.
ui_types
MCP Apps render-option types and validation.
webhooks
Webhook handlers for external event delivery.
yaml_agent
YAML Agent Definition loading, interpolation, serialization, and hot reload.

Macros§

edge_log_conformance_tests
Generates one #[tokio::test] per event log and beacon store conformance case for an EdgeLogHarness (spec 3.5 §7.9).
rate_limit_conformance_tests
Generates one #[tokio::test] per rate-limit store conformance case for a RateLimitHarness (spec 3.5 §7.9).

Structs§

RequestContext
Identity and authorization context extracted from an HTTP request.

Enums§

RequestContextError
Errors that can occur during request context extraction.

Traits§

RequestContextExtractor
Extracts authenticated identity from HTTP request headers.