Agent API overview
Agent APIs configure a model, instructions, tools, and optional runtime
controls, then execute a prompt and return an AgentResult or JSON payload.
Signatures and option builders differ by language; see the
SDK references for complete package details.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
import asyncio
from ish import Agent
async def main() -> None:
agent = Agent(
name="assistant",
model="gpt-4o-mini",
instructions="Answer clearly and briefly.",
max_turns=8,
)
try:
result = await agent.run("Summarize the request.")
print(result.content)
finally:
agent.close()
asyncio.run(main())
import { Agent } from "ish-harness";
async function main(): Promise<void> {
const agent = new Agent({
name: "assistant",
model: { provider: "openai_chat", name: "gpt-4o-mini" },
instructions: "Answer clearly and briefly.",
max_turns: 8,
});
try {
const result = await agent.run("Summarize the request.");
console.log(result.content);
} finally {
agent.close();
}
}
main().catch(console.error);
use std::{env, io, sync::Arc};
use ish_harness::{Agent, OpenAIModel};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let model = OpenAIModel::new(
"gpt-4o-mini".into(),
"https://api.openai.com/v1".into(),
env::var("OPENAI_API_KEY")?,
0.2,
);
let agent = Agent::builder(Arc::new(model))
.name("assistant")
.instructions("Answer clearly and briefly.")
.max_turns(8)
.build()
.map_err(io::Error::other)?;
let result = agent.run("Summarize the request.").await.map_err(io::Error::other)?;
println!("{}", result.content);
Ok(())
}
package main
import (
"context"
"fmt"
ish "github.com/ish-harness/ish-harness/sdks/go"
)
func main() {
client, err := ish.NewClient()
if err != nil {
panic(err)
}
defer client.Close()
agent := ish.NewAgent(client, ish.AgentRunRequest{
AgentName: "assistant",
Model: &ish.AgentModel{Provider: "openai_chat", Name: "gpt-4o-mini"},
SystemPrompt: ish.StringPtr("Answer clearly and briefly."),
MaxTurns: ish.IntPtr(8),
})
result, err := agent.Run(context.Background(), "Summarize the request.")
if err != nil {
panic(err)
}
fmt.Println(result["content"])
}
using System;
using Ish.Harness;
using var client = new IshClient();
var result = client.Run(new AgentRunRequest
{
AgentName = "assistant",
Model = new AgentModel { Provider = "openai_chat", Name = "gpt-4o-mini" },
SystemPrompt = "Answer clearly and briefly.",
UserPrompt = "Summarize the request.",
MaxTurns = 8,
});
Console.WriteLine(result.GetProperty("content").GetString());
import com.fasterxml.jackson.databind.JsonNode;
import io.github.ishharness.IshClient;
import java.nio.file.Path;
public class AgentOverview {
public static void main(String[] args) {
try (var client = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")))) {
var request = new IshClient.AgentRequest(
"gpt-4o-mini",
"Answer clearly and briefly.",
"Summarize the request.")
.provider("openai_chat")
.agentName("assistant")
.maxTurns(8);
JsonNode result = client.runAgent(request);
System.out.println(result.path("content").asText());
}
}
}
Configure an agent
The examples above show the minimum inputs: a model, agent instructions, and a user prompt. Configure the provider credentials required by the selected model before starting a run. Add tools and runtime options only when the application needs them.
Tools, options
Tools are callable capabilities exposed to the model. Their descriptions and
input schemas are sent with model requests, and tool outputs are returned to the
execution loop. See Tools for Python's @tool decorator,
Rust's ToolBackend, and JSON Schema descriptors across TypeScript, Go, C#, and
Java.
Additional options may configure context, subagents, skills, budgets, permissions, persistence, lifecycle hooks, and streaming. Consult each SDK's README and types for exact option names, defaults, and behavior, and see SDK conformance for cross-language coverage.
Reusable agent setup
Reusable Agent wrappers are available in every SDK, including C# and Java. The five host-language SDKs also expose a typed RemoteAgent helper for invoking an ISH HTTP endpoint; Rust callers can invoke the shared remote_agent.run operation directly.