Skip to content

Document that tools and searches must be explicitly registered in agent.py#43

Open
n1colasf wants to merge 2 commits intomainfrom
23-feature-document-that-tools-and-searches-must-be-explicitly-registered-in-agentpy
Open

Document that tools and searches must be explicitly registered in agent.py#43
n1colasf wants to merge 2 commits intomainfrom
23-feature-document-that-tools-and-searches-must-be-explicitly-registered-in-agentpy

Conversation

@n1colasf
Copy link
Member

Description

Adds explicit documentation clarifying that after creating a tool or retrieval search, it must be manually registered in the agent's tools list inside agent.py. This step was previously undocumented, causing confusion when newly created tools did not appear to work.

Type of Change

  • Documentation update

Related Issues

Fixes #23

Changes Made

  • Added "Registering with an Agent" subsection under the Tools section in docs/agents-tools.md, with a callout note and code example showing the required import and tools = [...] pattern
  • Added "Registering Retrieval Tools with an Agent" subsection under the Retrieval Tools section in docs/agents-tools.md with the same pattern
  • Updated the Retrieval Tools Important prerequisite list to include agent registration as step 5
  • Updated the Content Workflow to split "Connect to Agent" into two explicit steps: creating the retrieval tool class and registering it in agent.py
  • Updated Table of Contents in docs/agents-tools.md to include the new subsections
  • Added a callout note at the top of the "Adding Tools" section in docs/getting-started.md explaining that tool definition and agent registration are two distinct required steps

Testing Done

  • Tested manually

Checklist

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@n1colasf n1colasf self-assigned this Mar 11, 2026
@n1colasf n1colasf added the documentation Improvements or additions to documentation label Mar 11, 2026
@MicaPerdomo
Copy link

A few observations before this can be merged:

Duplication with existing "Using in Agents" section

agents-tools.md already has a "Using in Agents" subsection under "Connecting to Retrievals" that shows the same pattern (from .searches import ProductDocsSearch / tools = [ProductDocsSearch()]). After merging, there would be two sections explaining the same thing ~40 lines apart, which is a maintenance risk — if one gets updated without the other, they'll contradict each other. I'd suggest unifying into a single canonical location.

Inconsistent import path in the example

The new example uses from ..tools import WeatherTool (double dot), but other places in the same file use from .tools import (single dot). Also, WeatherTool only exists as a standalone example in the previous section — it's not something the reader would have in agents/tools.py. This breaks the narrative flow. I'd suggest using tools from the getting-started guide or clarifying the assumption.

Agree with Virginia's feedback on migrations

The inline makemigrations/migrate block in the reference section gives the impression it must be done immediately after each registration. I'd suggest replacing it with a reference to the Content Workflow, where steps 8 and 9 are already properly separated.

Minor:

  • The SupportAgent example is missing required attributes (temperature, max_responses, initial_message, etc.) — a # ... other required attributes omitted for brevity would help prevent anyone from copying it as a complete template.
  • Both TOC entries show as "Registering with an Agent", making them indistinguishable — I'd suggest differentiating the second one as "Registering Retrieval Tools".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Document that tools and searches must be explicitly registered in agent.py

3 participants