Skip to main content

Tools

Tools are the actions an agent can request, such as looking up an order or reading a file. Each tool has a name, a description, an input schema, and an implementation. Before running it, ISH checks the arguments and configured permissions; after it runs, ISH checks the result and returns it to the model.

from ish import Agent, tool


@tool
def double(value: int) -> int:
"""Double an integer."""
return value * 2


agent = Agent(
name="math_agent",
model="gpt-4o-mini",
instructions="Use the supplied tool when it helps answer.",
tools=[double],
)

Python's @tool can infer a tool's name, description, and JSON Schema from type annotations and a docstring. TypeScript, Go, C#, and Java normally declare the JSON Schema explicitly. The SDKs use the same Rust execution and policy rules.

How tool calls are checked​

Before a tool runs, the runtime checks its arguments against the declared schema and applies configured permissions and guardrails. If an argument contains an authorized data reference, the runtime resolves it before calling the tool. It checks the result before returning it to the model and can save large output outside the prompt.

Tools that read without changing state may run concurrently when a model requests them together. Tools that write, need approval, or rely on ordered checks run in sequence. For sensitive tools, declare the schema precisely and apply least-privilege permissions.

Choose tool behavior​

BehaviorUse it for
Read-onlyLooking up data without changing it
Parallel-safeIndependent reads that can run together
Approval requiredActions that need a person to confirm
Skill-gatedTools that should appear only for an active skill
Direct returnA tool whose result should end the agent turn

Declare the input schema and side effects honestly. The runtime uses those declarations to decide which tools to expose and whether they may run concurrently. See the API reference for advanced tool options and staged execution.

Tool errors, staged results​

A recoverable error is returned to the model as a tool result so it can adjust its next action. A fatal error stops the run when continuing would be unsafe. Staged changes are published only when the result passes configured checks.

Tool callbacks execute in your application. Pair them with Guardrails, Tool Output Management, and skill gating when they access sensitive resources.