adk-server 0.1.8

HTTP server and A2A protocol for Rust Agent Development Kit (ADK-Rust) agents
Documentation

adk-server

HTTP server and A2A protocol for Rust Agent Development Kit (ADK-Rust) agents.

Crates.io Documentation License

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

Installation

[dependencies]
adk-server = "0.1.8"

Or use the meta-crate:

[dependencies]
adk-rust = { version = "0.1.8", features = ["server"] }

Quick Start

Basic Server

use adk_server::{create_app, ServerConfig};
use std::sync::Arc;

let config = ServerConfig::new(
    Arc::new(SingleAgentLoader::new(Arc::new(agent))),
    Arc::new(InMemorySessionService::new()),
);

let app = create_app(config);

let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?;
axum::serve(listener, app).await?;

Security Configuration

Configure CORS, timeouts, and other security settings:

use adk_server::{ServerConfig, SecurityConfig};
use std::time::Duration;

// Development mode (permissive CORS, detailed errors)
let config = ServerConfig::new(agent_loader, session_service)
    .with_security(SecurityConfig::development());

// Production mode (restricted CORS, sanitized errors)
let config = ServerConfig::new(agent_loader, session_service)
    .with_allowed_origins(vec!["https://myapp.com".to_string()])
    .with_request_timeout(Duration::from_secs(60))
    .with_max_body_size(5 * 1024 * 1024);  // 5MB

A2A Server

use adk_server::create_app_with_a2a;

let app = create_app_with_a2a(config, Some("http://localhost:8080"));

// Exposes:
// GET  /.well-known/agent.json  - Agent card
// POST /a2a                      - JSON-RPC endpoint
// POST /a2a/stream               - SSE streaming

Remote Agent Client

use adk_server::RemoteA2aAgent;

let remote = RemoteA2aAgent::builder("weather_agent")
    .description("Remote weather service")
    .agent_url("http://weather-service:8080")
    .build()?;

// Use as sub-agent
let coordinator = LlmAgentBuilder::new("coordinator")
    .sub_agent(Arc::new(remote))
    .build()?;

API Endpoints

Endpoint Method Description
/ GET Web UI
/api/chat POST Send message
/api/chat/stream POST Stream response
/.well-known/agent.json GET A2A agent card
/a2a POST A2A JSON-RPC
/a2a/stream POST A2A streaming

Features

  • Axum-based async HTTP
  • CORS support
  • Embedded web assets
  • Multi-agent routing
  • Health checks

Related Crates

License

Apache-2.0

Part of ADK-Rust

This crate is part of the ADK-Rust framework for building AI agents in Rust.