Async Basic
Code
1import asyncio23from kern.agent import Agent4from kern.models.ollama import Ollama56agent = Agent(7 model=Ollama(id="llama3.1:8b"),8 description="You help people with their health and fitness goals.",9 instructions=["Recipes should be under 5 ingredients"],10)11# -*- Print a response to the cli12asyncio.run(agent.aprint_response("Share a breakfast recipe.", markdown=True))Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall Ollama
Follow the Ollama installation guide and run:
1ollama pull llama3.1:8bInstall dependencies
1uv pip install -U ollama kern-aiRun Agent
1python cookbook/11_models/ollama/async_basic.py