Basic Agent
Code
1from kern.agent import Agent2from kern.models.huggingface import HuggingFace34agent = Agent(5 model=HuggingFace(6 id="mistralai/Mistral-7B-Instruct-v0.2", max_tokens=4096, temperature=07 ),8)9agent.print_response(10 "What is meaning of life and then recommend 5 best books to read about it"11)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 HF_TOKEN=xxxInstall dependencies
1uv pip install -U huggingface_hub kern-aiRun Agent
1python cookbook/11_models/huggingface/basic.py