Agent with Tools
Code
1from kern.agent import Agent2from kern.models.litellm import LiteLLM3from kern.tools.hackernews import HackerNewsTools45openai_agent = Agent(6 model=LiteLLM(7 id="gpt-5-mini",8 name="LiteLLM",9 ),10 markdown=True,11 tools=[HackerNewsTools()],12)1314# Ask a question that would likely trigger tool use15openai_agent.print_response("What is happening in France?")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 openai kern-aiRun Agent
1python cookbook/11_models/litellm/tool_use.py