Skip to content

Bug: Agent recreated from manifest config loses SubagentTools capability (session_pool path) #252

Description

@Million-mo

Bug Description

When an Agent is created with toolsets passed via the constructor (e.g., SubagentToolsetConfig().get_provider()), the capability works. But when the session_pool path recreates the agent from manifest config, the toolsets are not preserved — SubagentTools capability is lost.

Failing Test

tests/tools/test_runcontext.py::test_capability_tools

async with AgentPool(manifest) as pool:
    subagent = SubagentToolsetConfig()
    providers = [subagent.get_provider()]
    agent = Agent(name="test", model=default_model, toolsets=providers, agent_pool=pool)
    result = await agent.run("Get available agents using the list_available_nodes tool")
    assert agent.name in str(result.content)  # ← RuntimeError: No final message received

The test is currently marked @pytest.mark.xfail with reason="Test passes toolsets via Agent() constructor, but session_pool path recreates agent from manifest config (without toolsets). SubagentTools capability is lost. Fix: configure SubagentToolsetConfig in manifest.tools."

Verification

Confirmed still failing on main (commit 67710ea) via --runxfail:

RuntimeError: No final message received from stream
src/agentpool/agents/base_agent.py:1984: RuntimeError

Root Cause (preliminary)

The xfail reason identifies the issue clearly:

  1. Test creates Agent with toolsets=[subagent.get_provider()] via constructor
  2. The session_pool execution path recreates the agent from manifest config
  3. The manifest config does not include the SubagentToolsetConfig in manifest.tools
  4. The recreated agent has no SubagentTools capability → the list_available_nodes tool is not registered → the model cannot call it → no final message produced

Suggested Fix

Per the xfail reason: "Fix: configure SubagentToolsetConfig in manifest.tools."

Either:

  1. Make the session_pool path preserve constructor-passed toolsets, or
  2. Require toolsets to be declared in manifest config (and update the test to do so)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions