All tutorials
Track 2·Foundation

Swap the local model

Run Track 1's agent on a different Ollama model by changing one string. The agent, primitives, and task stay identical.

beginner3 min
Video coming soon
Browse this tutorial's folder in tutorials-pygithub.com/OpenSymbolicAI/tutorials-py/tree/main/02-swap-model

Before you start

The agent is decoupled from the model. This track swaps qwen2.5-coder:7b for gemma4:e2b by changing one string in LLMConfig. Everything else, the primitives, the task, the result, stays the same.

What changed from Track 1#

Nothing except one line in main.py. The calculator.py agent is identical to Track 1.

diff
- model = "qwen2.5-coder:7b"
+ model = "gemma4:e2b"

Pull the model and run#

bash
ollama pull gemma4:e2b
uv run main.py

Output:

text
53

gemma4:e2b writes its own plan to get there:

python
result1 = multiply(a=7, b=8)
result2 = subtract(a=result1, b=3)

Same agent, same task, smaller model, same answer.

Takeaway#

Swapping models is a config change, not a code change. Your primitives, plan logic, and task stay put while the model behind them changes.

Capability still matters. A model has to be good enough to plan against your primitives, and very small models sometimes can't.