refactor(agents): extract subagent-invocation contract to subagents/shared

The knowledge_base subagent imported subagent_invoke_config + EXCLUDED_STATE_KEYS
from main_agent's checkpointed_subagent_middleware -- a subagent reaching into
main-agent internals. Both symbols (plus the recursion-limit constant they need)
are a subagent-invocation contract shared by the orchestrator's task middleware
and any nested-invoking subagent. Move them to subagents/shared/invocation.py;
config.py keeps the HITL resume side-channel and constants.py keeps the
main-agent tuning knobs. All consumers (task_tool, kb tool, tests) repointed.
This commit is contained in:
CREDO23 2026-06-05 14:18:44 +02:00
parent 490bb3c5c5
commit 88fe213176
7 changed files with 90 additions and 64 deletions

View file

@ -14,9 +14,6 @@ from langgraph.graph import END, START, StateGraph
from langgraph.types import Command, interrupt
from typing_extensions import TypedDict
from app.agents.chat.multi_agent_chat.main_agent.middleware.checkpointed_subagent_middleware.config import (
subagent_invoke_config,
)
from app.agents.chat.multi_agent_chat.main_agent.middleware.checkpointed_subagent_middleware.resume_routing import (
collect_pending_tool_calls,
slice_decisions_by_tool_call,
@ -24,6 +21,9 @@ from app.agents.chat.multi_agent_chat.main_agent.middleware.checkpointed_subagen
from app.agents.chat.multi_agent_chat.main_agent.middleware.checkpointed_subagent_middleware.task_tool import (
build_task_tool_with_parent_config,
)
from app.agents.chat.multi_agent_chat.subagents.shared.invocation import (
subagent_invoke_config,
)
class _SubagentState(TypedDict, total=False):

View file

@ -16,7 +16,7 @@ from __future__ import annotations
from langchain.tools import ToolRuntime
from app.agents.chat.multi_agent_chat.main_agent.middleware.checkpointed_subagent_middleware.config import (
from app.agents.chat.multi_agent_chat.subagents.shared.invocation import (
subagent_invoke_config,
)