Skip to main content
The Citation extension allows agents to include source references in their responses. Citations appear as highlighted text with hover tooltips and clickable source links in the Agent Stack UI, making it easy for users to verify the information. Each citation requires:

Example: Basic Usage

1

Import the citation extension

Import CitationExtensionServer and CitationExtensionSpec from agentstack_sdk.a2a.extensions.
2

Inject the extension

Add a citation parameter to your agent function using the Annotated type hint with CitationExtensionSpec().
3

Yield citation message

Call yield citation.message() with text and citations.

Multiple Citations

Yield multiple citations in a single response:

Example: Advanced Usage

For a more advanced example, see citation_agent.py.