- A2A extensions and helpers that map agent demands to client fulfillments and UI metadata.
- A platform API client that talks to the AgentStack server.
What the SDK Exports
The public surface of the SDK is grouped into four entrypoints:agentstack-sdkfor everythingagentstack-sdk/apifor platform API client, schemas, and typesagentstack-sdk/corefor extension helpers and A2A interaction utilitiesagentstack-sdk/extensionsfor A2A extension definitions and types
Core Workflows
1. Handle agent card demands
Agents declare service demands in their agent card. UsehandleAgentCard to read these demands and produce metadata fulfillments.
buildMessageBuilder(agentCard) when you want a helper that turns a user message into a fully formed A2A message with metadata.
2. Stream task status updates into UI actions
When you stream A2A task events,handleTaskStatusUpdate maps status updates into actionable UI events.
It focuses on auth-required and input-required states, which cover OAuth, secrets, forms, and approvals.
3. Build user metadata
When the user responds to forms, approvals, or canvas requests, useresolveUserMetadata to build message metadata.
4. Use the platform API client
buildApiClient exposes the platform API with typed responses and runtime validation.
ApiResult<T>. Use unwrapResult if you want exceptions, and then handle errors with isHttpError, isNetworkError, isParseError, and isValidationError.
Extension Helpers at a Glance
These helpers are factories. You pass an extension definition once and get back a function tailored to that extension.extractServiceExtensionDemands(extension)returns a function that pulls typed demands for that service from an agent card.fulfillServiceExtensionDemand(extension)returns a function that applies a fulfillment into outgoing metadata for that service.extractUiExtensionData(extension)returns a function that reads typed UI metadata for that extension from messages.buildLLMExtensionFulfillmentResolver(api, token)returns a resolver that maps LLM demands to platform models.
Protocol Types and Schemas
The SDK exports A2A protocol types and Zod schemas that match the AgentStack UI usage, including:Message,Part, andTasktypesTaskStatusUpdateEventandTaskArtifactUpdateEvent- UI and service extension schemas
Next Steps
- Extensions for service and UI extension handling
- API Client for endpoint reference and error helpers
- Error Handling for platform and extension error patterns
- Message Building for composing user messages with metadata
- A2A Client Integration for end to end streaming with
@a2a-js/sdk