Skip to main content
The 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.

Running your Agent

Here’s how to run your agent. The response is captured in the response.

RunResponse

The Agent.run() function returns a RunResponse object when not streaming. It has the following attributes:
Understanding MetricsFor a detailed explanation of how metrics are collected and used, please refer to the Metrics Documentation.
See detailed documentation in the RunResponse documentation.

Streaming Responses

To enable streaming, set stream=True when calling run(). This will return an iterator of RunResponseEvent objects instead of a single response.
From agno version 1.6.0, the Agent.run() function returns an iterator of RunResponseEvent, not of RunResponse objects.

Streaming Intermediate Steps

For even more detailed streaming, you can enable intermediate steps by setting stream_intermediate_steps=True. This will provide real-time updates about the agent’s internal processes.

Handling Events

You can process events as they arrive by iterating over the response stream:
You can see this behavior in action in our Playground.

Storing Events

You can store all the events that happened during a run on the RunResponse object.
By default the RunResponseContentEvent event is not stored. You can modify which events are skipped by setting the events_to_skip parameter. For example:

Event Types

The following events are yielded by the Agent.run() and Agent.arun() functions depending on the agent’s configuration:

Core Events

Control Flow Events

Tool Events

Reasoning Events

Memory Events

See detailed documentation in the RunResponseEvent documentation.

Structured Input

An agent can be provided with structured input (i.e a pydantic model) by passing it in the Agent.run() or Agent.print_response() as the message parameter.