Inference Logoinference.sh

Agent Tools

Delegate complex tasks to other agents.


Basic Usage

1from inferencesh import agent_tool2 3researcher = (4    agent_tool("research", "my-team/researcher@latest")5    .describe("Research a topic in depth and return findings")6    .build()7)

How It Works

When the agent calls an agent tool:

  1. A new chat is created with the sub-agent
  2. The tool arguments become the message to the sub-agent
  3. Sub-agent executes and responds (possibly using its own tools)
  4. Sub-agent's result is returned to the parent agent

Builder Methods

MethodDescription
agentTool(name, ref)Create agent tool with agent reference
.describe(text)Set description for LLM
.display(name)Human-readable name
.requireApproval()Require user approval
.build()Build the tool

Agent Reference Formats

code
1# Latest version2namespace/agent-name@latest3 4# Specific version5namespace/agent-name@abc123

Example: Multi-Agent Workflow

1from inferencesh import inference, agent_tool2 3# Sub-agents for specialized tasks4researcher = (5    agent_tool("research", "my-team/researcher@latest")6    .describe("Research a topic thoroughly")7    .build()8)9 10writer = (11    agent_tool("write", "my-team/writer@latest")12    .describe("Write content based on research")13    .build()14)15 16reviewer = (17    agent_tool("review", "my-team/reviewer@latest")18    .describe("Review and improve content")19    .build()20)21 22# Coordinator agent23client = inference(api_key="inf_...")24coordinator = client.agent({25    "core_app_ref": "infsh/claude-sonnet-4@latest",26    "system_prompt": "You coordinate content creation. Use research, write, and review tools.",27    "tools": [researcher, writer, reviewer]28})29 30response = coordinator.send_message("Create a blog post about AI trends")

With Approval

1expensive_agent = (2    agent_tool("expert", "my-team/expert@latest")3    .describe("Consult domain expert (high cost)")4    .require_approval()  # User approves before delegating5    .build()6)

Sub-agent Output Schema

Sub-agents can have a defined output schema. When the sub-agent finishes, it uses the finish tool to return structured data.

See Internal Tools → Finish for details.

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.