Async Basic

Code

1import asyncio
2
3from kern.agent import Agent
4from kern.models.neosantara import Neosantara
5
6agent = Agent(
7 model=Neosantara(id="grok-4.1-fast-non-reasoning"),
8 markdown=True,
9)
10
11# Print the response in the terminal
12asyncio.run(agent.aprint_response("Share a 2 sentence horror story"))

Usage

Set up your virtual environment

1uv venv --python 3.12
2source .venv/bin/activate
1uv venv --python 3.12
2.venv\Scripts\activate

Set your API key

1export NEOSANTARA_API_KEY=xxx

Install dependencies

1uv pip install -U openai kern-ai

Run Agent

1python cookbook/90_models/neosantara/async_basic.py