Service and UI extensions for agent communication and capabilities
Built on top of the Agent2Agent Protocol (A2A), Agent Stack extends the protocol with Agent Stack-specific capabilities through A2A extensions. These extensions enable agents to access platform services and enhance the user interface beyond what the base A2A protocol provides.There are two types of extensions:
Service extensions use a dependency injection pattern where agents declare demands that must be fulfilled by the client (your application). The client provides configured access to external services based on these demands.When an agent card is received, handleAgentCard extracts the service extension demands. You then provide fulfillment functions that resolve these demands with actual service configurations:
LLM Service: Language model access with automatic provider selection
Embedding Service: Text embedding generation for RAG
MCP: Integrating pre-defined connectors
OAuth Provider: OAuth authentication services
Secrets: Secure credential management
Settings: Runtime configuration access
Form: Form service for structured data collection
The fulfillment process works like dependency injection: the agent declares what it needs, and your client provides the configured services.
UI extensions add extra metadata to messages, enabling your custom UI to render advanced interactive components beyond standard text responses:
Forms: Collect structured user input through interactive forms
Citations: Display source references with clickable inline links
Trajectory: Visualize agent reasoning steps with execution traces
Canvas: Handle visual editing and canvas-based interactions
Agent Detail: Display agent-specific information and metadata
Error: Render structured error messages
OAuth: Handle OAuth authentication flows
Settings: Display and manage agent settings
Approval: Request user approval before executing actions (e.g., tool calls)
These extensions enhance messages with metadata that your UI interprets to create rich, interactive experiences. The SDK provides type-safe parsers to extract this metadata from agent messages and task status updates.
A2A extensions travel in message metadata. When you receive an agent card, call handleAgentCard(agentCard) to:
Extract extension demands
Get a resolveMetadata(fulfillments) helper that builds the metadata the agent expects
You provide the fulfillments object with functions that resolve demands (dependency injection). Many fulfillments can be powered by the Platform API client—for example, using platform-provided LLM or embedding services.
The SDK ships an LLM fulfillment resolver you can wire up quickly:
Use buildLLMExtensionFulfillmentResolver(api, contextToken) to return a resolver for LLM demands. It matches suggested models via the Platform API and returns the fulfillment payload automatically.
Feed this resolver into your fulfillments.llm callback when calling resolveMetadata(fulfillments).
Other fulfillments (embeddings, MCP, secrets, settings, forms, OAuth) are client-specific; use the Platform API client and your own UI flows (forms, OAuth prompts, secret capture) to build those resolvers.