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)
Create a virtual environment
Terminal
python3 -m venv .venv source .venv/bin/activate
Install libraries
pip install -U agno openai ddgs rich
Run Agent
python cookbook/agents/input_and_output/response_as_variable.py