Tyler Wanner
03/30/2026, 12:22 PMMarvin
03/30/2026, 12:22 PMMarvin
03/30/2026, 12:29 PMexport OLLAMA_BASE_URL="<http://localhost:11434/v1>"
3) Use an Ollama model in Marvin:
import marvin
agent = marvin.Agent(model="ollama:llama3.2") # e.g., llama3.2, mistral, qwen2.5, etc.
print(agent.run("Write a haiku about Prefect"))
Explicit provider setup (if you want to be precise in code)
import marvin
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.ollama import OllamaProvider
ollama = OpenAIChatModel(
"llama3.2",
provider=OllamaProvider(base_url="<http://localhost:11434/v1>")
)
agent = marvin.Agent(model=ollama)
print(agent.run("What's 2+2?"))
Notes
- Use any Ollama model name you’ve pulled (e.g., llama3.2, mistral, deepseek-r1).
- If you see connection errors, double‑check that the base URL includes /v1 and that Ollama is running.
- You can also route through a LiteLLM proxy if you prefer.
Links
- Marvin 3 (GitHub)
- Pydantic AI – OpenAI (Ollama‑compatible) model
- Ollama
If you share your target model and environment (local vs. remote), I can tailor the config.Tyler Wanner
03/30/2026, 12:36 PMMarvin
03/30/2026, 12:36 PMresearch_prefect_topic
📊 Tools used:
• research_prefect_topic (1x)