代码

cookbook/agent_concepts/async/basic.py
import asyncio

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="You help people with their health and fitness goals.",
    instructions=["Recipes should be under 5 ingredients"],
    markdown=True,
)
# -*- 将响应打印到命令行
asyncio.run(agent.aprint_response("Share a breakfast recipe.", stream=True))

用法

1

创建虚拟环境

打开 Terminal 并创建一个 python 虚拟环境。

python3 -m venv .venv
source .venv/bin/activate
2

安装库

pip install -U openai agno
3

运行 Agent

python cookbook/agent_concepts/async/basic.py