Agent with Tools
Code
1"""Run `uv pip install` to install dependencies."""23from kern.agent import Agent4from kern.models.mistral import MistralChat5from kern.tools.hackernews import HackerNewsTools67agent = Agent(8 model=MistralChat(9 id="mistral-large-latest",10 ),11 tools=[HackerNewsTools()],12 markdown=True,13)1415agent.print_response("Whats happening in France?", stream=True)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 MISTRAL_API_KEY=xxxInstall dependencies
1uv pip install -U mistralai kern-aiRun Agent
1python cookbook/11_models/mistral/tool_use.py