Skip to content

feat(agents): add tool registry and built-in connectors - #328

Merged
codeforstartups merged 2 commits into
codeforstartups:developmentfrom
Kaap10:feat/tool-registry-connectors
Oct 7, 2026
Merged

codeforstartups merged 2 commits into
codeforstartups:developmentfrom
Kaap10:feat/tool-registry-connectors

Conversation

@Kaap10

@Kaap10 Kaap10 commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR introduces the ToolRegistry and built-in tool connectors, completing the next phase of the dynaflow agent primitives.

It allows agents to discover and dynamically execute registered tools, including natively supported HTTP requests, sandboxed Python code execution, and external MCP servers.

Related issue

Fixes #287

Changes

  • Added ToolRegistry for centralized tool registration, dynamic schema generation (to_chat_tools), and sync/async execution (execute, aexecute).
  • Implemented create_http_tool (REST API connector) with zero external dependencies and graceful error capturing.
  • Implemented create_python_code_tool for sandboxed Python code execution capturing stdout and runtime exceptions.
  • Implemented mcp_tools_from_session (MCP Tool Connector) to map any MCP client session into dynaflow agent tools.
  • Refactored AgentTool (_prepare_call) to robustly handle **kwargs / VAR_KEYWORD.
  • Updated ReActAgent to accept ToolRegistry natively.

Testing

  • Tests pass locally (added 13 new rigorous offline unit tests)
  • Ruff checks pass
  • Strict MyPy tests pass

Checklist

  • My changes are focused and relevant to this pull request.
  • I have added or updated tests where appropriate.
  • I have reviewed my changes for unrelated modifications.
  • I have updated documentation where necessary.

Kaap10 added 2 commits October 5, 2026 12:27
…orstartups#287)

Adds ToolRegistry for tool discovery and execution.

Adds built-in connectors for HTTP requests, Python execution, and MCP.

Updates ReActAgent to consume ToolRegistry natively.
@codeforstartups

Copy link
Copy Markdown
Owner

Reviewed — complete, well-built tool layer (closes #287). 🎯

Registry — ToolRegistry with register/unregister/get/has, tag-filtered list_tools/to_chat_tools, sync+async execute/aexecute (graceful 'not registered' observations), register_all, and a clean dict-like API (__getitem__/__contains__/__len__/__iter__).

Connectors — HTTP tool, Python-code tool, and MCP adapters in both sync (mcp_tools_from_session) and async (mcp_tools_from_session_async) flavors, parsing the standard MCP content-list result shape — good reuse of our existing MCP story.

The AgentTool.execute / ReActAgent refactors here tighten up argument handling and wire in the registry without dropping any #319 behavior. 5 tests cover registry CRUD, async execute, HTTP (mocked), python-code, and the MCP adapter. All 4 CI checks green incl. strict mypy.

One note for the docs later: create_python_code_tool executes arbitrary Python, so it's worth a clear 'trusted use only' callout when we document it — not a blocker. Merging — great work @Kaap10!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool registry + function calling; HTTP/API, code & MCP tool connectors

2 participants