Skip to content

collect_classes uses inconsistent key for retrieval tools #39

@MicaPerdomo

Description

@MicaPerdomo

Description

collect_classes stores retrieval tool entries using obj.__name__ (e.g., "ProductDocsSearch"), but collect_definitions resolves them using the explicit name attribute (e.g., "product_docs_search"). When the migration runner looks up classes by definition key, the mismatch causes a "retrieval is required for retrieval tool" error because the class cannot be found.

Steps to Reproduce

  1. Define a BaseRetrievalTool with an explicit name attribute:
    class ProductDocsSearch(BaseRetrievalTool):
        name = "product_docs_search"
        retrieval = ProductDocsRetrieval
  2. Run manage.py migrate agents.
  3. The migration fails with: "retrieval is required for retrieval tool 'product_docs_search'".

Expected Behavior

collect_classes should use getattr(obj, "name", None) or obj.__name__ as the key, matching the logic in collect_definitions.

Actual Behavior

collect_classes uses obj.__name__ as the key. When collect_definitions looks up the class by the explicit name, it doesn't find it, and the retrieval reference cannot be resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions