Skip to content

feat(tools): pluggable prebuilt tools framework + Exa (5.8.0) - #92

Closed
abhishekmishragithub wants to merge 1 commit into
mainfrom
feat/tools-framework
Closed

feat(tools): pluggable prebuilt tools framework + Exa (5.8.0)#92
abhishekmishragithub wants to merge 1 commit into
mainfrom
feat/tools-framework

Conversation

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator

What

smallestai.tools: a small, extensible framework for prebuilt tools that plug into a crew. Third-party libraries stay optional (extras, lazy-imported).

The pattern

A tool wraps a capability with a @function_tool-decorated run, so it drops straight into a crew:

from smallestai.tools import ExaSearchTool

class Assistant(OutputCrewNode):
    def __init__(self):
        super().__init__(name="assistant")
        self.tool_registry = ToolRegistry()
        self.tool_registry.discover(self)          # your own @function_tools
        ExaSearchTool().register(self.tool_registry)  # + a prebuilt tool, one line
        self.tool_schemas = self.tool_registry.get_schemas()

Standalone use works too: results = await ExaSearchTool().run(query="..."). Discover with list_tools() / get_tool("exa_search").

Design

  • Optional, lazy. exa-py is an extra (pip install "smallestai[exa]"), imported on first use; missing it gives a clear install error. Importing smallestai.tools never pulls a third-party lib.
  • Uniform shape. Every tool is a Tool with a @function_tool run + register(registry), so the crew's existing schema extraction + execution just work.
  • Non-blocking. ExaSearchTool.run runs the synchronous Exa client via asyncio.to_thread.

Checks

  • pytest tests/custom/test_tools_framework.py — 5 passed (registry, crew-plug, lazy missing-dep path).
  • mypy src/smallestai/tools/ — clean.

Notes for review

Draft — merging bumps the version and auto-publishes. Hold for your review.

Add smallestai.tools: a small registry of prebuilt tools that plug into a crew's
ToolRegistry. Each tool wraps a third-party capability with a @function_tool-decorated
run(), so registering is one line and the LLM can call it; run() is also directly
callable for standalone use.

- smallestai.tools.base.Tool: base with a register(registry) helper.
- smallestai.tools.exa.ExaSearchTool: first integration (web search); lazy-imports exa-py
  and raises a clear "install smallestai[exa]" error otherwise; runs the sync client off
  the event loop.
- list_tools()/get_tool(name) for discovery; third-party libs are optional extras only.

Core deps unchanged. Version 5.8.0.
@abhishekmishragithub

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated release PR release/5.10.0 (single review + single version bump). Branch kept.

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.

1 participant