Define tools for agents using the fluent builder API.
Tool Types
Agents can use several types of tools:
| Type | Builder | Description |
|---|---|---|
| Client | tool() | Executed by your code (with handler) |
| App | app_tool() | Runs an inference.sh app |
| Agent | agent_tool() | Delegates to a sub-agent |
| Webhook | webhook_tool() | Calls an external URL |
| Internal | built-in | Plan, memory, widgets, finish |
Quick Example
python
1from inferencesh import tool, string23greet = (4 tool("greet")5 .describe("Greet a user")6 .param("name", string("User's name"))7 .handler(lambda args: f"Hello, {args['name']}!")8 .build()9)Parameter Types
All tool builders share these parameter types:
| Type | Example |
|---|---|
string("desc") | Text input |
number("desc") | Decimal number |
integer("desc") | Whole number |
boolean("desc") | True/false |
enum_of(["a", "b"], "desc") | Choice from list |
array(string(), "desc") | List of items |
obj({"key": string()}, "desc") | Nested object |
optional(string()) | Optional parameter |
Learn More
- Client Tools — Handler-based tools
- App Tools — Run inference.sh apps
- Agent Tools — Delegate to sub-agents
- Webhook Tools — Call external APIs
- Internal Tools — Plan, memory, widgets
- Approval Settings — Human-in-the-loop