Learn how to run an agent and get the response.
Agent.run()
function runs the agent and generates a response, either as a RunResponse
object or a stream of RunResponse
objects.
Many of our examples use agent.print_response()
which is a helper utility to print the response in the terminal. It uses agent.run()
under the hood.
response
.
Agent.run()
function returns a RunResponse
object when not streaming. It has the following attributes:
stream=True
when calling run()
. This will return an iterator of RunResponseEvent
objects instead of a single response.
agno
version 1.6.0
, the Agent.run()
function returns an iterator of RunResponseEvent
, not of RunResponse
objects.stream_intermediate_steps=True
. This will provide real-time updates about the agent’s internal processes.
RunResponse
object.
RunResponseContentEvent
event is not stored. You can modify which events are skipped by setting the events_to_skip
parameter.
For example:
Agent.run()
and Agent.arun()
functions depending on the agent’s configuration:
Event Type | Description |
---|---|
RunStarted | Indicates the start of a run |
RunResponseContent | Contains the model’s response text as individual chunks |
RunCompleted | Signals successful completion of the run |
RunError | Indicates an error occurred during the run |
RunCancelled | Signals that the run was cancelled |
Event Type | Description |
---|---|
RunPaused | Indicates the run has been paused |
RunContinued | Signals that a paused run has been continued |
Event Type | Description |
---|---|
ToolCallStarted | Indicates the start of a tool call |
ToolCallCompleted | Signals completion of a tool call, including tool call results |
Event Type | Description |
---|---|
ReasoningStarted | Indicates the start of the agent’s reasoning process |
ReasoningStep | Contains a single step in the reasoning process |
ReasoningCompleted | Signals completion of the reasoning process |
Event Type | Description |
---|---|
MemoryUpdateStarted | Indicates that the agent is updating its memory |
MemoryUpdateCompleted | Signals completion of a memory update |
Agent.run()
or Agent.print_response()
as the message
parameter.