- Service extensions: Demands in the agent card that your client fulfills (LLMs, embeddings, OAuth, secrets)
- UI extensions: Message metadata your UI renders (forms, approvals, citations, trajectories)
agentstack-sdk/extensions if you prefer a narrower import surface.
Core Helpers
The SDK includes helpers for reading and producing extension metadata:extractServiceExtensionDemands(extension)reads demands from an agent card.fulfillServiceExtensionDemand(extension)merges fulfillments into metadata.extractUiExtensionData(extension)reads UI metadata from a message.resolveUserMetadata(inputs)builds metadata for form, approval, and canvas responses.handleAgentCard(agentCard)returnsdemandsand aresolveMetadatafunction.handleTaskStatusUpdate(event)maps status updates to actionable UI results.buildMessageBuilder(agentCard)builds user messages with resolved metadata.
handleAgentCard.
extractServiceExtensionDemands, fulfillServiceExtensionDemand, and extractUiExtensionData are factories. You pass an extension definition once and reuse the returned function for that extension.
For end to end usage, see A2A Client Integration and User Messages.
Service Extensions
Service extensions use a dependency injection pattern. The agent declares demands and the client provides fulfillments.LLM Service
Provides OpenAI compatible LLM access withapi_base, api_key, and api_model.
Embedding Service
Provides OpenAI compatible embedding access withapi_base, api_key, and api_model.
MCP
Provides Model Context Protocol transports for tool and connector access.OAuth
Provides OAuth redirect metadata for authentication flows.Secrets
Provides secret values required by the agent.Settings (deprecated)
Deprecated. Planned for removal in the next release. Use Settings Form instead. This extension lives underui/settings in the SDK, but it is treated as a service extension because it carries demands and fulfillments.
Migration guide
- Agent cards: replace the
ui/settingsextension with theservices/formextension and move settings fields toform_demands.settings_form. - Single select: change type
single_selecttosingleselect, and changeoptionsitems from{ value }to{ id }. - Checkbox group:
checkbox_groupnow requires a non emptylabel. - Checkbox items:
checkboxnow requirescontentfor the visible text. Keeplabelpopulated too and map the legacy checkbox label tocontentwhen migrating. - Fulfillments: change checkbox group values from
{ values: { [id]: { value } } }to{ value: { [id]: boolean | null } }.
Form
Provides form responses when the agent requests structured input.Settings Form
Settings UI is delivered through the Form service extension. Agents request settings withform_demands.settings_form, and clients respond with form_fulfillments.settings_form.
settings_form when both settings_form and legacy settings demands are present.
Platform API
Adds context token metadata so the agent can call platform services. This is typically used only when you cannot pass the token through A2A client headers.getContextToken is deprecated and kept for backward compatibility. Prefer passing the context token via A2A client headers when possible.
getContextToken is deprecated. Prefer sending the context token via A2A client headers when possible.
UI Extensions
UI extensions are message metadata your UI can render. The SDK includes typed schemas for extracting these payloads.Form Request
Requests a form render payload.Approval
Requests user approval for an action or tool call.Canvas
Requests a canvas edit with indices and description.Citation
Provides citation ranges and URLs for inline references.Trajectory
Provides trace entries for reasoning or execution steps.Agent Detail
Provides agent metadata to display in the UI. This extension is sent in the agent card capabilities, not in message metadata.Error
Provides structured error information.OAuth Request
Provides an OAuth authorization endpoint to redirect the user.Secrets Request
Provides secret demand prompts.Handling task status updates
UsehandleTaskStatusUpdate to parse status updates into UI actions. This covers OAuth, secrets, forms, and approval flows.
Sending user metadata
When the user responds to a form, approval, or canvas request, useresolveUserMetadata to build message metadata: