Give your agent new tools¶
Tools are your agent's hands. The built-ins already read sensors, drive, and edit files — here you control which it has, and add your own.
Manage the toolbox¶
- Panel → bottom TOOLS badge.
- Checkboxes enable or disable each tool. A disabled tool is invisible to the
agent — turning tools off is how you make a safe agent for younger students, or
force it to solve a task "blind". The choice is saved in
~/physicar_ws/agent/settings.json, together with the panel's model, effort, context and read-aloud settings — the file appears on your first change (no file means the defaults) and every window on the machine follows it.
Experiment: disable the camera tools and ask "what do you see?" — watch how the agent copes.
Add a custom tool¶
The fastest way is to ask the tutor itself:
"Add a tool called
patrolthat drives a slow square and returns to start."
The agent writes the tool into your custom tools file,
~/physicar_ws/agent/tools.py — a plain file in your workspace, next to
agent/instructions.md and agent/settings.json, so it survives sessions and
travels with a workspace backup. TOOLS → Edit Code opens it yourself. The rules:
- Every top-level function becomes a tool, named
custom_<function>for the agent (def patrol→custom_patrol). Names starting with_are private helpers. - The docstring is the tool's description; parameters are declared as
Annotated[type, Field(description="...")](typing+pydantic). - It returns a list of contents — any mix of
{"type": "text", "text": ...}and{"type": "image", "mime": ..., "base64": ...}. - Saving reloads the file; a changed tool is callable from the next message. An import error shows in the TOOLS badge while the last working version keeps serving.
The built-in tools use the exact same format — View Code next to a built-in
section shows one as a working example. Once patrol appears in the TOOLS badge
(new tools start enabled), you — and the agent — can call it like any built-in.
Good custom tools are small and single-purpose: one action, clear parameters, a short return message. Compose behaviors in instructions, not inside one giant tool.
Try this¶
Build a report_status tool that returns battery-friendly one-line status (speed +
nearest lidar distance), then add an instruction: "After every drive, call
report_status."
How tool calling works under the hood → Learn: LLM agents