feat(agentchat): allow scoped AgentTool metadata#7836
feat(agentchat): allow scoped AgentTool metadata#7836maxpetrusenkoagent wants to merge 1 commit into
Conversation
|
@maxpetrusenkoagent please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
Verification update after opening draft PR:\n\n- Exact GitHub PR diff saved via |
Why are these changes needed?
AgentToolpreviously always exposed the wrapped agent's fullnameanddescriptionas the caller-facing tool metadata. That makes it awkward to present a narrower, task-specific delegated capability surface in multi-agent pipelines without mutating the wrapped agent itself.This PR adds optional, keyword-only
nameanddescriptionoverrides toAgentTool, matching the existingTeamToolpattern. The defaults stay unchanged and old serialized configs continue to omit these fields. The README example now calls out that these fields are prompt-visible metadata only, not an authorization boundary, and that least-privilege execution still requires separately scoped tools or workbenches on the wrapped agent.This is intentionally not a full capability-token implementation. It is a small compatibility and documentation hardening step for the delegation concern raised in #7528.
Related issue number
Refs #7528
Checks
Verification
uv run pytest packages/autogen-agentchat/tests/test_task_runner_tool.py::test_agent_tool_component_with_scoped_tool_metadata -qfailed before implementation withTypeError: AgentTool.__init__() got an unexpected keyword argument 'name'.uv run pytest packages/autogen-agentchat/tests/test_task_runner_tool.py -q→ 8 passed.uv run ruff check packages/autogen-agentchat/src/autogen_agentchat/tools/_agent.py packages/autogen-agentchat/tests/test_task_runner_tool.py→ passed.uv run pyright packages/autogen-agentchat/src/autogen_agentchat/tools/_agent.py packages/autogen-agentchat/tests/test_task_runner_tool.py→ 0 errors.uv run mypy --config-file pyproject.toml packages/autogen-agentchat/src/autogen_agentchat/tools/_agent.py packages/autogen-agentchat/tests/test_task_runner_tool.py→ success.uv run poe lint && uv run poe pyright && uv run poe mypyfrompython/packages/autogen-agentchat→ passed.uv run poe testfrompython/packages/autogen-agentchat→ 377 passed, 5 skipped.uv run python check_md_code_blocks.py ../README.mdfrompython→ README code blocks OK.