Quickstart
This guide runs a first agent and registers a custom tool against OpenAI in all six supported languages: Python, TypeScript, Rust, Go, C#, and Java. See Language SDKs for full repository build steps and runtime prerequisites.
If you are deciding whether an agent or workflow fits your task, see the plain-language adopter guide first.
- 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(
"What is the difference between a list and a tuple in Python?"
)
print(result.content)
finally:
agent.close()
if __name__ == "__main__":
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(
"What is the difference between a list and a tuple in Python?",
);
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("What is the difference between a list and a tuple in Python?")
.await
.map_err(io::Error::other)?;
println!("{}", result.content);
Ok(())
}
package main
import (
"context"
"fmt"
"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(),
"What is the difference between a list and a tuple in Python?",
)
if err != nil {
panic(err)
}
fmt.Println(result["content"])
}
using Ish.Harness;
using var ish = new IshClient();
var result = ish.Run(new AgentRunRequest
{
AgentName = "assistant",
Model = new AgentModel { Provider = "openai_chat", Name = "gpt-4o-mini" },
SystemPrompt = "Answer clearly and briefly.",
UserPrompt = "What is the difference between a list and a tuple in Python?",
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 final class Quickstart {
public static void main(String[] args) {
try (IshClient ish = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")))) {
var request = new IshClient.AgentRequest(
"gpt-4o-mini",
"Answer clearly and briefly.",
"What is the difference between a list and a tuple in Python?")
.provider("openai_chat")
.agentName("assistant")
.maxTurns(8);
JsonNode result = ish.runAgent(request);
System.out.println(result.path("content").asText());
}
}
}
Prerequisites
Set an OpenAI API key in your environment before running any example:
export OPENAI_API_KEY="your-api-key"
- Python: Python 3.11+; use the source-checkout steps until the PyPI package is published.
- TypeScript: Node.js 22+ with the native
ish_node.nodeaddon built - Rust: Rust 1.97+ (
ish-harnessworkspace/path crate) - Go: Go 1.26+ with the matching native library built (
ISH_NATIVE_LIBRARYortarget/release) - C#: .NET 10+ with
libish_corebuilt (ISH_NATIVE_LIBRARYor on library search path) - Java: JDK 25+ with the matching native library configured (
ISH_NATIVE_LIBRARY)
Run an agent
Each example configures an agent with gpt-4o-mini, passes a short system
instruction, runs one prompt, and prints the final text response from the
returned AgentResult.
The Rust runtime executes the model loop and returns the AgentResult payload
whose content field contains the final assistant response. Provider names,
model options, and credentials are described in
Model integrations.
Add a tool
Tools expose application operations to the model. Python provides the
host-specific @tool decorator to infer a JSON Schema from function type
annotations; TypeScript, Go, C#, and Java register explicit JSON Schema tool
descriptors alongside host callbacks. Rust applications provide tool code
through the Rust tool interface.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
import asyncio
from ish import Agent, tool
@tool
async def lookup_order(order_id: str) -> str:
"""Look up the current status of an order."""
return f"Order {order_id} is being prepared."
async def main() -> None:
agent = Agent(
name="order_assistant",
model="gpt-4o-mini",
instructions="Use the order lookup tool when relevant.",
tools=[lookup_order],
)
try:
result = await agent.run("Where is order A-104?")
print(result.content)
finally:
agent.close()
asyncio.run(main())
import { Agent } from "ish-harness";
const agent = new Agent({
name: "order_assistant",
model: { provider: "openai_chat", name: "gpt-4o-mini" },
instructions: "Use the order lookup tool when relevant.",
tools: [
{
name: "lookup_order",
description: "Look up the current status of an order.",
parameters: {
type: "object",
properties: { order_id: { type: "string" } },
required: ["order_id"],
},
execute: async (args) => {
const { order_id } = args as { order_id: string };
return `Order ${order_id} is being prepared.`;
},
},
],
});
const result = await agent.run("Where is order A-104?");
console.log(result.content);
use std::{env, io, sync::Arc};
use async_trait::async_trait;
use ish_harness::{data_plane::tool_backend::ToolBackend, Agent, OpenAIModel};
use serde_json::{json, Value};
struct LookupOrder;
#[async_trait]
impl ToolBackend for LookupOrder {
fn name(&self) -> &str {
"lookup_order"
}
fn description(&self) -> &str {
"Look up the current status of an order."
}
fn schema_json(&self) -> Option<Value> {
Some(json!({
"type": "object",
"properties": { "order_id": { "type": "string" } },
"required": ["order_id"]
}))
}
async fn call(&self, arguments: Value) -> Result<String, String> {
let order_id = arguments["order_id"]
.as_str()
.ok_or_else(|| "order_id must be a string".to_string())?;
Ok(format!("Order {order_id} is being prepared."))
}
}
#[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("order_assistant")
.instructions("Use the order lookup tool when relevant.")
.tool(Arc::new(LookupOrder))
.build()
.map_err(io::Error::other)?;
let result = agent
.run("Where is order A-104?")
.await
.map_err(io::Error::other)?;
println!("{}", result.content);
Ok(())
}
package main
import (
"context"
"fmt"
"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: "order_assistant",
Model: &ish.AgentModel{Provider: "openai_chat", Name: "gpt-4o-mini"},
SystemPrompt: ish.StringPtr("Use the order lookup tool when relevant."),
Tools: []ish.AgentTool{
{
Name: "lookup_order",
Description: "Look up the current status of an order.",
Parameters: map[string]any{
"type": "object",
"properties": map[string]any{
"order_id": map[string]any{"type": "string"},
},
"required": []string{"order_id"},
},
Execute: func(ctx context.Context, args map[string]any) (any, error) {
return fmt.Sprintf("Order %v is being prepared.", args["order_id"]), nil
},
},
},
})
result, err := agent.Run(context.Background(), "Where is order A-104?")
if err != nil {
panic(err)
}
fmt.Println(result["content"])
}
using System.Text.Json;
using Ish.Harness;
using var ish = new IshClient();
using var schemaDoc = JsonDocument.Parse(
"""{"type":"object","properties":{"order_id":{"type":"string"}},"required":["order_id"]}""");
var result = ish.Run(new AgentRunRequest
{
AgentName = "order_assistant",
Model = new AgentModel { Provider = "openai_chat", Name = "gpt-4o-mini" },
SystemPrompt = "Use the order lookup tool when relevant.",
UserPrompt = "Where is order A-104?",
Tools =
[
new AgentTool
{
Name = "lookup_order",
Description = "Look up the current status of an order.",
Parameters = schemaDoc.RootElement.Clone(),
Execute = (args, _) =>
{
var orderId = args.GetProperty("order_id").GetString();
return ValueTask.FromResult<object?>($"Order {orderId} is being prepared.");
},
},
],
});
Console.WriteLine(result.GetProperty("content").GetString());
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.ishharness.IshClient;
import java.nio.file.Path;
public final class OrderAssistant {
public static void main(String[] args) throws Exception {
var schema = new ObjectMapper().readTree(
"{\"type\":\"object\",\"properties\":{\"order_id\":{\"type\":\"string\"}},\"required\":[\"order_id\"]}");
try (IshClient ish = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")))) {
var request = new IshClient.AgentRequest(
"gpt-4o-mini",
"Use the order lookup tool when relevant.",
"Where is order A-104?")
.provider("openai_chat")
.agentName("order_assistant")
.tool(
"lookup_order",
"Look up the current status of an order.",
schema,
toolArgs -> "Order " + toolArgs.path("order_id").asText() + " is being prepared.");
JsonNode result = ish.runAgent(request);
System.out.println(result.path("content").asText());
}
}
}
See Tools for schemas, return values, and execution controls.
Continue learning
- Language SDKs — setup notes and the scope of cross-SDK validation.
- Agents — run configuration, streaming, and results.
- Subagents — isolated delegation and async fleets.
- Context — store state and expose selected values to an agent.