Async Basic Streaming Agent
Code
1import asyncio23from kern.agent import Agent4from kern.models.litellm import LiteLLM56openai_agent = Agent(7 model=LiteLLM(8 id="gpt-5-mini",9 name="LiteLLM",10 ),11 markdown=True,12)1314# Print the response in the terminal15asyncio.run(16 openai_agent.aprint_response("Share a 2 sentence horror story", stream=True)17)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export LITELLM_API_KEY=xxxInstall dependencies
1uv pip install -U litellm kern-aiRun Agent
1python cookbook/11_models/litellm/async_basic_stream.py