Sign in

Converse API — ADK

API reference for ADK conversation, streaming, skill generation, async execution, and direct LLM call endpoints

adk
apiadkconversestreamingwebsocketasyncskillsllm

Updated 2026-11-03

Verified 2026-11-03

API reference for running agent turns on ADK. For architecture and configuration, see ADK.

All paths are relative to the ADK service root (port 8103 locally) under the base path /api/v1/adk. Base URLs, the Authorization and X-Org-Id headers, and the error envelope are described in API conventions, Authentication, Required headers, and Errors.

ADK also accepts these optional headers on authenticated routes:

HeaderPurpose
X-Project-IdRuns the request in a project scope; ADK authorizes the project and forwards it to MCP
X-On-Behalf-Of-User-IdDelegated user for service tokens

For normal user tokens, every user_id in a body or query must equal the authenticated user (the token sub or user_id claim); otherwise ADK returns 403. A denied organization or project returns 403, and an unavailable authorization service returns 503.

Endpoints

MethodPathDescription
POST/converse/Synchronous turn
POST/add-event/Inject an event into the caller's session
POST/call_llm/Direct LLM call
WS/converse_stream/V1 streaming
WS/converse/v2V2 streaming
POST/skills/generateSkill proposals
POST/async/requests/Submit an async request
GET/async/requests/List async requests
GET/async/requests/{request_id}/status/Async status and result
GET/health/ (service root)Health check, no auth

Session endpoints are documented in the Sessions API.


Sync Converse

POST /api/v1/adk/converse/

Runs one turn against an agent or app and returns when the response is complete. Requires adk.agent.execute.

FieldTypeRequiredDefaultDescription
agent_id, agent_versionstringconditional—Agent to run. Provide these or app_id/app_version.
app_id, app_versionstringconditional—App to run; ADK uses the app's orchestrator agent.
user_idstringyes—Authenticated user ID.
querystringyes—User message.
imagesstring[]no—Base64 images or URLs.
user_dataobjectno—Values merged into session state.
channelstringnochatChannel identifier.
languagestringnono_languageLanguage hint.
reasoning_eventbooleannotrueInclude reasoning events.
sequenceNumberintegerno—Echoed in the response.
observability_metadataobjectno—Extra string dimensions recorded with the turn.
json
{
  "session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "sequenceNumber": 1,
  "events": [],
  "response": {"content": "Hello! How can I help?"}
}

If the agent or app version does not exist, ADK returns 404 with {"session_id": null, "response": "No agent with agent id: ... exists."}.

bash
curl -X POST http://localhost:8103/api/v1/adk/converse/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Org-Id: YOUR_ORG_ID" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "AGENT_ID", "agent_version": "1.0", "user_id": "YOUR_USER_ID", "query": "What is the weather in London?"}'

Add Event

POST /api/v1/adk/add-event/

Appends an event to an existing session. Chat and Voice use it to complete the caller's own session. Requires authentication.

FieldTypeRequiredDescription
app_namestringyesApp code. agent-<uuid> is normalized to agent_<uuid_with_underscores>.
user_idstringyesSession owner. Must match the token unless the caller is a service or superuser.
session_idstringyesSession ID.
contentstringyesEvent text.
state_deltaobjectnoValues merged into session state.

Returns 404 when the session is not in the caller's organization or belongs to a different app, and 422 when state_delta contains keys callers cannot set.

Direct LLM Call

POST /api/v1/adk/call_llm/

Calls a model directly through LiteLLM with the organization's BYOT credentials, without an agent.

FieldTypeRequiredDescription
providerstringyesgoogle_ai, vertex_ai, azure_openai, azure_claude, aws_claude, azure_ai, smallest_ai, or inhouse
modelstringyesModel ID registered for the provider
messagesarrayyesChat messages (role, content)
temperature, top_pnumbernoSampling parameters
max_tokens, max_completion_tokensintegernoOutput limits
stopstring or arraynoStop sequences
tools, tool_choice, parallel_tool_calls—noFunction calling
response_formatobjectnoStructured output
stream, stream_options—noWhen stream is true, the response is a JSON list of LiteLLM chunks

The response is the LiteLLM chat completion object. For azure_ai models, ADK adapts the request to the Azure AI Foundry serverless API (for example, it renames max_tokens where needed and drops stream_options.include_usage).


WebSocket V1

WS /api/v1/adk/converse_stream/

The V1 stream remains for Chat. New clients should use V2.

The handshake requires Authorization: Bearer <token>. A missing or invalid token, or a token without a resolvable user, closes the socket with code 4401. X-Project-Id on the handshake is a fallback; browser clients send project_id in the start body.

start event

FieldTypeRequiredDescription
eventstringyes"start"
org_idstringyesOrganization ID; the token must be authorized for it (otherwise close code 4403)
agent_id/agent_version or app_id/app_versionstringyesTarget agent or app
user_idstringyesAuthenticated user ID
project_id, project_namestringnoProject scope and its display label
user_data, channel, language, reasoning_event, sequenceNumber—noSame meaning as in Sync Converse
first_messagestringnoGreeting from the app configuration
observability_metadataobjectnoExtra dimensions

ADK resumes the user's latest non-completed session for the same app code, or creates a new one, and replies before agent setup finishes:

json
{"session_id": "SESSION_ID", "app_code": "agent_AGENT_ID", "user_id": "YOUR_USER_ID", "response": "Conversation Stream Setup"}

query event: {"event": "query", "query": "...", "images": [], "language": "en", "sequenceNumber": 2}. The server streams {"session_id": "...", "response": {"content": "...", "is_final": false}} frames and ends with is_final: true. Errors and cost notices arrive as {"response": "<message>"}. When a session or period cost limit is reached, the socket closes with code 4000.


WebSocket V2

WS /api/v1/adk/converse/v2

The recommended streaming endpoint. It supports client-defined tools, tool approvals, per-request prompt and model overrides, skills, extra knowledge base collections, test sessions, and negotiated voice turns. The handshake requires Authorization and X-Org-Id; X-Project-Id is optional.

Client events

start creates or resumes a session and may carry the first query.

FieldTypeDefaultDescription
user_idstringrequiredAuthenticated user ID
query, images, image_attachments——First turn; image_attachments items are {name, mime_type, data_base64}
agent_id, agent_versionstring"1.0" versionAgent to run
app_id, app_versionstring"1.0" versionApp to run
session_idstringnullnull creates a session; an ID resumes it
session_stateobject—Initial state
test_sessionobject—AI Testing Workspace selection: {schema_version: 1, name, tool_refs: [{id, type, version}], graph_ids}
system_promptstring—Prompt-only mode or prompt override
additional_instructionsstring—Appended to the prompt; never replaces it
additional_collection_idsstring[]—Extra knowledge base collections
toolsarray—Client tools: {name, description, input_schema, display_name, tool_kind}
exclude_toolsstring[]—Tool names to drop
provider_id, model_id, temperature, max_output_tokens——Model overrides
thinking_modestring—enabled, adaptive, or disabled
reasoning_effortstring—low, medium, high, xhigh, or max
skill_ids, skillsarray—Skills; skills items are {id, version, allow_draft}
guardrails, use_org_default_guardrails—falsePrompt-only guardrails
client_tool_timeout_secondsnumber120Client tool timeout, greater than 0 and at most 3600
org_id, project_idstring—Organization and project scope
channelstringchatvoice requires voice_protocol
voice_protocolstring—"cosmos.voice.v2" for negotiated voice turns
app_namestring—Observability label override
language, reasoning_event, sequenceNumber, first_message——Same meaning as V1
observability_metadataobject—String dimensions for Observer
session_profilestring—Session profile, such as coding or chat
execution_contextobject—{app_id, scope: {type, id}, manifest_hash, resources} for manifest-scoped runs
execution_access_manifest_hash, execution_access_resources——Execution access manifest

Context window and compaction settings are not client fields; ADK ignores them if sent.

json
{
  "event": "start",
  "user_id": "YOUR_USER_ID",
  "org_id": "YOUR_ORG_ID",
  "agent_id": "AGENT_ID",
  "agent_version": "1.0",
  "query": "What is the price of AAPL?",
  "tools": [{
    "name": "get_stock_price",
    "description": "Get the current stock price",
    "input_schema": {"type": "object", "properties": {"ticker": {"type": "string"}}, "required": ["ticker"]}
  }]
}

Other client events

EventFieldsDescription
queryquery, turn_id (1 to 128 characters), images, image_attachments, language, tools_add, tools_remove, sequenceNumberNext turn. A query sent while a turn is running returns TURN_BUSY.
tool_resultcall_id, name, result or errorResult of a client tool call
approval_decisionschema_version: 1, session_id, call_id, name, decision (approve or deny)Answer to approval_required
cancelturn_idCancel the running turn
pong—Reply to ping

Server events

EventFieldsDescription
sessionsession_id, voice_protocolSession ready
chunkcontent, turn_id, is_finalResponse text
tool_callcall_id, name, arguments (object), display_name, tool_kindRun a client tool
tool_call_args_deltajson_path, deltaPartial arguments while the model generates them
tool_start, tool_completetool_complete adds result_preview, ok, is_error, duration_msServer-side tool progress
approval_requiredschema_version, session_id, call_id, name, argument_count, expires_in_seconds (300)A tool needs approval; no answer denies it
reasoningreasoning_type, filesAgent, tool, file, skill, or knowledge base progress
custom_event—Service-defined extension
usageprompt, completion, and cumulative tokens, token_threshold, context_limitToken usage; clients use token_threshold for context gauges
cost_warningcontent, severity, session_idCost limit warning
visible_turnuser_message_id, assistant_message_idMessage IDs for visible history and feedback
turn_completesession_id, turn_id, status (completed, cancelled, failed), end_conversation, usage, workflowExactly one per accepted turn
errorcode, turn_id, message, fatalFatal errors close the socket
cancel_ack—Cancel received; a stale cancel does not close the session
ping—Keep-alive

Error codes: INVALID_REQUEST, FORBIDDEN, UNAVAILABLE, MANIFEST_MISMATCH, INVALID_APPROVAL, SESSION_NOT_FOUND, NO_SESSION, SESSION_SCOPE_MISMATCH, SESSION_INIT_FAILED, TURN_BUSY, AGENT_NOT_FOUND, AGENT_ERROR, UNSUPPORTED_TEST_AGENT, NO_LLM_CONFIG, MODEL_UNAVAILABLE, MODEL_TIMEOUT, RATE_LIMITED, CONTEXT_WINDOW_EXCEEDED, PROVIDER_HISTORY_INVALID, HISTORY_UNAVAILABLE, GUARDRAILS_UNAVAILABLE, CONFIGURATION_DRIFT, RESOURCE_UNAVAILABLE, TOOL_APPROVAL_TIMEOUT, PERIOD_COST_LIMIT, SESSION_COST_LIMIT, INTERNAL_ERROR.


Skill Generation

POST /api/v1/adk/skills/generate

Proposes skills from a conversation, an agent prompt, or a description. Requires the skill-generation permission.

FieldTypeDefaultDescription
sourcestringrequiredconversation, agent_prompt, or description
session_id or messages——For conversation: a session to read, or [{role, content}] messages
agent_prompt or agent_id + agent_version—version "1.0"For agent_prompt: prompt text, or an agent whose prompt (and sub-agents) ADK loads
descriptionstring—For description
provider_id, model_idstringorganization defaultModel override
max_skillsinteger51 to 10
max_tokensinteger163841024 to 65536

The response is {"proposals": [...], "summary": "..."}. Each proposal has name, description, instructions, allowed_tools, resources (references, assets, and scripts maps of file name to content), metadata (cosmos_knowledge_base_ids, category), and rationale.


Async Requests

Async requests run on a Celery worker. All three routes require authentication; non-superusers only see their own requests.

Submit

POST /api/v1/adk/async/requests/ returns 201 with {request_id, status, created_at}. The body takes the Sync Converse fields plus session_id, callback_url, callback_method (GET, POST, PUT, or PATCH; default POST), and callback_headers. ADK returns 400 when neither an agent nor an app is given and 404 when the version does not exist.

Status

GET /api/v1/adk/async/requests/{request_id}/status/

FieldDescription
statusqueued, processing, completed, or failed
status_history, created_at, started_at, completed_atLifecycle
session_id, sequence_number, responseSet when completed
error_code, error_messageSet when failed
callback_statuspending, in_progress, success, failed, retrying, or not_required
callback_status_history, callback_last_attempt_time, callback_error_messageCallback delivery details

List

GET /api/v1/adk/async/requests/?status=completed&limit=20&offset=0

Query parameters: user_id (must be the caller unless superuser), status, limit (1 to 100, default 20), offset (default 0). The response is {total, limit, offset, requests}, newest first; each item has request_id, status, query, created_at, started_at, completed_at, and session_id.


Health Check

GET /health/ on the service root returns {"status": "ok"} without authentication.