Async Basic Streaming Agent

Stream a Mistral-powered Agno agent's response asynchronously.

Code

async_basic_stream.py
import asyncio

from agno.agent import Agent
from agno.models.mistral import MistralChat

agent = Agent(
    model=MistralChat(id="mistral-large-latest"),
    markdown=True,
)

asyncio.run(agent.aprint_response("Share a 2 sentence horror story", stream=True))

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Set your API key

export MISTRAL_API_KEY=xxx

Install dependencies

uv pip install -U mistralai agno

Run Agent

Save the code above as async_basic_stream.py, then run:

python async_basic_stream.py