In Agent Stack, you communicate with the client by yielding data. This concept consists of two parts:
- Yielding data: Sending data from your agent implementation to the client.
- The Wrapper: Using convenience objects like
AgentMessage to simplify the underlying A2A Protocol requirements.
Choosing Your Message Type
Simplified Yielding
The Agent Stack SDK allows you to yield simple Python types. These are automatically converted into textual A2A Message objects for ease of use.
Plain Strings
Plain Dictionaries
Convenience Wrappers
Wrappers provide a balance between ease of use and metadata support.
AgentMessage
The most common way to respond with text. It simplifies creating A2A Message objects and supports metadata.
AgentArtifact
Similar to AgentMessage, but specifically designed to simplify the creation and handling of Artifacts (tangible outputs).
Direct A2A Components
For advanced use cases, you can yield direct A2A protocol components.
While yielding plain A2A components is supported, the Agent Stack is optimized for convenience wrappers. Using wrappers ensures the best UX in the GUI.
Message
The basic unit representing a single turn in a conversation.
Part
The fundamental unit of content. A Message consists of multiple Part objects such as TextPart, FilePart, or DataPart.
Artifact
Tangible outputs produced by the agent, such as documents or other generated content.
TaskStatus
A stateful unit of work used to annotate a transaction spanning multiple messages (e.g., tracking progress or requiring input).