AGENTING · Builder Lab
By Ravindra Dastikop
A food bank volunteer receives a simple question: “Can I pick up a parcel on Saturday?” The answer depends on the location. If an AI agent guesses the branch or invents opening hours, someone could make a wasted trip.
Build a local prototype that looks up hours from a small sample schedule. Give it three questions and check whether it can answer, report a closure, or ask which branch the visitor means.
What you need
Availability checked on 28 November 2026. The lab uses the downloadable smolagents 1.26.0 Python package and a Qwen3 model running locally through Ollama. You need Python, Ollama, and enough memory and disk space to run the model. Internet access is needed for the initial downloads. The example uses fictional branches and hours.
- PyPI — smolagents 1.26.0
- Hugging Face — ToolCallingAgent
- Hugging Face — OpenAIModel
- Ollama — local API · Qwen3 model library
Build the local agent
Install the Python packages in a virtual environment. With Ollama running, download Qwen3.
python -m pip install "smolagents==1.26.0" openai
ollama pull qwen3:4b
Save this as pickup_agent.py and run python pickup_agent.py for each test. The lookup tool reads a fixed schedule. It has no ability to change hours or take bookings.
from smolagents import OpenAIModel, ToolCallingAgent, tool
@tool
def pickup_hours(branch: str, day: str) -> str:
"""Look up pickup hours in the sample food bank schedule.
Args:
branch: The branch named by the visitor, Central or Riverside.
day: The weekday named by the visitor.
"""
schedule = {
("central", "saturday"): "10 a.m. to noon",
("riverside", "saturday"): "Closed",
}
return schedule.get(
(branch.strip().lower(), day.strip().lower()),
"Hours are unconfirmed for that branch and day.",
)
model = OpenAIModel(
model_id="qwen3:4b",
api_base="http://localhost:11434/v1/",
api_key="ollama",
)
agent = ToolCallingAgent(tools=[pickup_hours], model=model, max_steps=4)
rules = (
"Answer questions about the sample food bank schedule. "
"If the visitor omits the branch or weekday, ask for it first. "
"When both are supplied, use pickup_hours and report its result. "
"Treat unconfirmed hours as unknown."
)
question = input("Visitor question: ")
print(agent.run(f"{rules}\n\nVisitor question: {question}"))
Test three visitor questions
- “Can I pick up at Central on Saturday?” The agent should call the tool and return 10 a.m. to noon.
- “Can I pick up at Riverside on Saturday?” The agent should call the tool and report that the branch is closed.
- “Can I pick up on Saturday?” The agent should ask which branch the visitor means before looking up hours.
Check the tool calls printed during each run as well as the response. Then try Central on Sunday. The sample gives no Sunday hours, so the agent should say they are unconfirmed. A closure is a fact in the schedule. A missing entry is a question for a volunteer to resolve.
