Image Agent
Code
1import httpx23from kern.agent import Agent4from kern.media import Image5from kern.models.lmstudio import LMStudio67agent = Agent(8 model=LMStudio(id="llama3.2-vision"),9 markdown=True,10)1112response = httpx.get(13 "https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg"14)1516agent.print_response(17 "Tell me about this image",18 images=[Image(content=response.content)],19 stream=True,20)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall LM Studio
Install LM Studio from here and download the model you want to use.
Install dependencies
bash uv pip install -U kern-ai Run Agent
1python cookbook/11_models/lmstudio/image_agent.py