Skip to main content
The Server SDK is a Python library that enhances your existing AI agents with platform capabilities. Whether you’ve built your agent with LangGraph, CrewAI, or custom logic, the SDK connects it to the Agent Stack platform, giving you instant access to runtime-configurable services, interactive UI components, and deployment infrastructure. Built on top of the Agent2Agent Protocol (A2A), the SDK wraps your agent implementation and adds powerful functionality through A2A extensions. This enables your agent to leverage platform services like LLM providers, file storage, vector databases, and rich UI components. That’s all without rewriting your core agent logic.

What the SDK Provides

Server Wrapper Example

Here we show server creation and agent registration:
The SDK uses a server-based architecture where you:
  1. Create a Server instance and
  2. Register your agent function

Advanced Server SDK Example

Here’s an example that incorporates multiple Server SDK capabilities:
  1. Use the Asynchronous Generator Pattern to await the form request and pause the task while the user completes the form.
  2. UI Extensions are used to create the forms and add the metadata to messages.

Asynchronous Generator Pattern

Agent functions are asynchronous generators that yield responses. This pattern aligns with A2A’s task model:
  • One function execution = One A2A task
  • Yielding data = Sending messages to the client
  • Pausing execution = Waiting for user input
The generator pattern is particularly powerful when your agent needs to request structured input from users. When you await a form request, execution pauses the task, allowing the user to fill out the form. Once submitted, execution resumes with the form data. The generator pattern enables agents to:
  • Stream responses incrementally
  • Yield multiple messages during a single task
  • Handle long-running operations gracefully

Extension System

Agent Stack utilizes A2A extensions to extend the protocol with Agent Stack-specific capabilities. They enable your agent to access platform services and enhance the user interface beyond what the base A2A protocol provides. There are two types of extensions:

UI Extensions

UI extensions add extra metadata to messages, enabling the Agent Stack UI to render more advanced interactive components:
  • Forms: Collect structured user input through interactive forms
  • Citations: Display source references with clickable inline links
  • Trajectory: Visualize agent reasoning steps with execution traces
These extensions enhance messages with metadata that the UI interprets to create rich, interactive experiences beyond standard text responses.

Dependency Injection Service Extensions

Service extensions use a dependency injection pattern where each run of the agent declares a demand that must be fulfilled by the client (consumer). The platform provides configured access to external services based on these demands:
  • LLM Service: Language model access with automatic provider selection
  • Embedding Service: Text embedding generation for RAG
  • Platform API: File storage, vector databases, and platform services
  • MCP: Model Context Protocol integration