Build and interact with AI agents programmatically.
What is the Agent SDK?
The Agent SDK lets you:
- Use template agents — Chat with agents from your workspace
- Create ad-hoc agents — Build agents on-the-fly with custom tools
- Handle tool calls — Execute tools and return results
- Stream responses — Get real-time message updates
Quick Start
Template Agent
Use an existing agent from your workspace:
1from inferencesh import inference2 3client = inference(api_key="inf_your_key")4 5agent = client.agent("my-team/support-agent@latest")6 7response = agent.send_message("How can I reset my password?")8print(response.text)Ad-hoc Agent
Create an agent on-the-fly:
1from inferencesh import inference, tool, string2 3# Define a tool4calculator = (5 tool("calculator")6 .describe("Perform math calculations")7 .param("expression", string("Math expression"))8 .handler(lambda args: str(eval(args["expression"])))9 .build()10)11 12client = inference(api_key="inf_your_key")13 14agent = client.agent({15 "core_app_ref": "infsh/claude-sonnet-4@latest",16 "system_prompt": "You are a helpful math assistant.",17 "tools": [calculator]18})19 20response = agent.send_message("What is 42 * 17?")21print(response.text)Features
- Template agents — Use agents from your workspace
- Ad-hoc agents — Create agents on-the-fly
- Custom tools — Define tools with fluent API
- Streaming — Real-time message updates
- Multi-turn — Automatic conversation state
Next Steps
- Template Agents — Use existing agents
- Ad-hoc Agents — Create agents on-the-fly
- Building Tools — Define custom tools
- Streaming — Handle real-time responses