Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
This example demonstrates how to capture and work with agent responses as variables, enabling programmatic access to response data and metadata.
Code
from typing import Iterator # noqa
from rich.pretty import pprint
from agno.agent import Agent, RunOutput
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
model=OpenAIChat(id="gpt-5-mini"),
tools=[
DuckDuckGoTools(
stock_price=True,
analyst_recommendations=True,
company_info=True,
company_news=True,
)
],
instructions=["Use tables where possible"],
markdown=True,
)
run_response: RunOutput = agent.run("What is the stock price of NVDA")
pprint(run_response)
# run_response_strem: Iterator[RunOutputEvent] = agent.run("What is the stock price of NVDA", stream=True)
# for response in run_response_strem:
# pprint(response)
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Install libraries
pip install -U agno openai ddgs rich
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
Create a Python file
Create a Python file and add the above code.touch response_as_variable.py
Run Agent
python response_as_variable.py
Find All Cookbooks
Explore all the available cookbooks in the Agno repository. Click the link below to view the code on GitHub:Agno Cookbooks on GitHub