Async Basic Streaming Agent
Stream a Mistral-powered Agno agent's response asynchronously.
Code
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/activateSet your API key
export MISTRAL_API_KEY=xxxInstall dependencies
uv pip install -U mistralai agnoRun Agent
Save the code above as async_basic_stream.py, then run:
python async_basic_stream.py