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 | appTool() | Runs an inference.sh app |
| Agent | agentTool() | Delegates to a sub-agent |
| Webhook | webhookTool() | Calls an external URL |
| Internal | built-in | Plan, memory, widgets, finish |
Quick Example
typescript
1import { tool, string } from '@inferencesh/sdk';23const greet = tool('greet')4 .describe('Greet a user')5 .param('name', string('User name'))6 .handler(args => `Hello, ${args.name}!`)7 .build();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 |
enumOf(['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