Inference Logoinference.sh

Building Tools

Define tools for agents using the fluent builder API.


Tool Types

Agents can use several types of tools:

TypeBuilderDescription
Clienttool()Executed by your code (with handler)
Appapp_tool()Runs an inference.sh app
Agentagent_tool()Delegates to a sub-agent
Webhookwebhook_tool()Calls an external URL
Internalbuilt-inPlan, 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:

TypeExample
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

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.