yield
with AgentMessage
to send textual data to the agent consumer. This concept has two important parts:
- Yielding data: You can yield data from your agent implementation, which gets sent to the client
- AgentMessage wrapper:
AgentMessage
is a convenience wrapper around A2AMessage
that simplifies common use cases. Think of responding with text to the client.
BeeAI SDK Message Types
The BeeAI SDK simplifies development by allowing you to yield different types of data. You can use convenient SDK constructs or direct A2A components.Convenience Wrappers
AgentMessage
The most common way to respond with text. It’s a convenience wrapper around A2AMessage
that makes it easy to create responses:
Plain strings
Simple strings are automatically converted to textual A2AMessage
objects:
Plain dict
Dictionaries sendsMessage
containing DataPart
AgentArtifact
Same asAgentMessage
but simplifies work with Artifacts.
Direct A2A Components
For more advanced use cases, you can yield direct A2A protocol components.While it’s perfectly fine to yield plain A2A Components, the BeeAI platform forms opinions on communication to support great UX in the GUI. For the best user experience, we recommend using the convenience wrappers when possible.
Feel free to check the A2A Key Concepts page to understand all the structures thoroughly.
Message
The basic communication unit in the A2A protocol, representing a single turn in a conversation.Part
The fundamental unit of content. For example, aTextPart
contains text data. A Message
consists of multiple Part
objects. Can be any of TextPart
, FilePart
, or DataPart
.