refactor(agents): colocate KB-search tool with its sole consumer; fix report ImportError

shared/tools/knowledge_base.py had exactly one production consumer: the
report deliverable, which imported it via `from .knowledge_base import ...`
-- a sibling path that did not exist, so the report KB-search path would
raise ImportError at runtime.

Move the module next to report.py (subagents/builtins/deliverables/tools/)
which makes that relative import valid, and move its only dependency
(shared/utils.py date helpers) to multi_agent_chat/shared/date_filters.py,
shared between the KB tool and the knowledge_search middleware.

Drop the now-unused knowledge-base re-exports from the shared/tools barrel
and repoint the integration tests. import-all + error-contract stay green.
This commit is contained in:
CREDO23 2026-06-05 10:28:56 +02:00
parent a7d7155039
commit 2db4ad479e
6 changed files with 12 additions and 17 deletions

View file

@ -239,7 +239,7 @@ def patched_shielded_session(async_engine, monkeypatch):
yield session
monkeypatch.setattr(
"app.agents.shared.tools.knowledge_base.shielded_async_session",
"app.agents.multi_agent_chat.subagents.builtins.deliverables.tools.knowledge_base.shielded_async_session",
_test_shielded,
)

View file

@ -17,7 +17,9 @@ async def test_browse_recent_documents_with_list_type_returns_both(
committed_google_data, patched_shielded_session
):
"""_browse_recent_documents returns docs of all types when given a list."""
from app.agents.shared.tools.knowledge_base import _browse_recent_documents
from app.agents.multi_agent_chat.subagents.builtins.deliverables.tools.knowledge_base import (
_browse_recent_documents,
)
space_id = committed_google_data["search_space_id"]