You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add @fast.tool decorator for inline function tool registration
Allows users to register Python functions as tools using @fast.tool
(bare or parameterized with name/description). Global tools are
available to all agents by default; agents with explicit function_tools
only see those tools.
Made-with: Cursor
* remove root test script in favor of proper unit tests
The demonstration script was committed to the repo root; the proper
unit tests live in tests/unit/core/test_tool_decorator.py.
Made-with: Cursor
* Add detailed documentation for the @fast.tool decorator in README.md
This update includes examples of registering Python functions as tools using the @fast.tool decorator, highlighting both synchronous and asynchronous support. It also explains the global availability of tools and how to restrict them to specific agents using the function_tools parameter.
* Add examples for using @fast.tool decorator in README.md
* Enhance documentation for agent-specific tools in README.md and examples. Introduce @agent.tool decorator for scoping tools to individual agents, clarifying the distinction between global and agent-specific tools. Update examples to reflect new functionality and improve clarity on tool registration and usage.
* small tidy-ups for type safety, custom agent decorator handling
* stop shared function overwrites
* tweak custom
* add naming notes to add future refactor
---------
Co-authored-by: evalstate <1936278+evalstate@users.noreply.github.com>
Register Python functions as tools directly in code — no MCP server or external file needed. Both sync and async functions are supported. The functionname and docstring are used as the tool name and description by default, or you can override them with `name=` and `description=`.
609
+
610
+
**Per-agent tools (`@agent.tool`)** — scope a tool to a specific agent:
@writer.tool(name="summarize", description="Produce a one-line summary")
622
+
def summarize(text: str) -> str:
623
+
return f"Summary: {text[:80]}..."
624
+
```
625
+
626
+
**Global tools (`@fast.tool`)** — available to all agents that don't declare their own tools:
627
+
628
+
```python
629
+
@fast.tool
630
+
def get_weather(city: str) -> str:
631
+
"""Return the current weather for a city."""
632
+
return f"Sunny in {city}"
633
+
634
+
@fast.agent(name="assistant", instruction="You are helpful.")
635
+
# assistant gets get_weather (global @fast.tool)
636
+
```
637
+
638
+
Agents with `@agent.tool` or `function_tools=` only see their own tools — globals are not injected. Use `function_tools=[]` to explicitly opt out of globals with no tools.
639
+
606
640
### Multimodal Support
607
641
608
642
Add Resources to prompts using either the inbuilt `prompt-server` or MCP Types directly. Convenience class are made available to do so simply, for example:
0 commit comments