Rust quickstart
The ish-harness package provides an agent builder. Configure a model, tools,
and optional context, memory, or skills, then call the agent's run method.
Lower-level runtime controls are described in the
advanced interface reference.
- 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,
)
result = await agent.run(
"Explain the difference between a list and a tuple in Python."
)
print(result.content)
asyncio.run(main())
import { Agent } from "ish-harness";
const agent = new Agent({
name: "assistant",
model: { provider: "openai_chat", name: "gpt-4o-mini" },
instructions: "Answer clearly and briefly.",
max_turns: 8,
});
const result = await agent.run(
"Explain the difference between a list and a tuple in Python.",
);
console.log(result.content);
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("Explain 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(),
"Explain 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 = "Explain the difference between a list and a tuple in Python.",
MaxTurns = 8,
});
Console.WriteLine(result.GetProperty("content").GetString());
import io.github.ishharness.IshClient;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) {
try (var ish = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")))) {
var request = new IshClient.AgentRequest(
"gpt-4o-mini",
"Answer clearly and briefly.",
"Explain the difference between a list and a tuple in Python.")
.provider("openai_chat")
.agentName("assistant")
.maxTurns(8);
System.out.println(ish.runAgent(request).path("content").asText());
}
}
}
Package status
The ish-harness facade crate and ish-core runtime crate are being prepared
for registry distribution. Their manifests and internal crate dependencies are
configured for packaging, but Cargo's registry packaging check cannot complete
until the internal crates are released first. No registry release has been made.
The required order is ish-data-plane,
ish-storage/ish-context/ish-models/ish-caps/ish-eval, ish-workflows,
ish-engine, ish-testkit, ish-core, and finally ish-harness. Until then,
run the checked-in example from a clone of the repository.
The crates.io sparse index did not have an ish-harness or ish-core entry when checked for
this update. Crate names are first-come, first-served, so check the name again
immediately before any release using the Cargo publishing guidance.
Run an agent from the repository
Install Rust 1.97 or newer using rustup and set an OpenAI API key:
export OPENAI_API_KEY="your-api-key"
cargo run -p ish-core --example basic_agent
The example uses the OpenAIModel adapter, creates an Agent, and prints
the final AgentResult.content. Its source is in the ish-core crate's
examples directory and is compiled with that crate.
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("Explain the difference between a list and a tuple in Python.")
.await
.map_err(io::Error::other)?;
println!("{}", result.content);
Ok(())
}
Other language SDKs
The other SDKs expose the same runtime through APIs designed for their languages. See the advanced interface reference for implementation and compatibility details:
Tool implementations
Implement the Rust tool interface to register a tool. A tool provides its
name, description, parameter schema, and function that runs when selected. See
Tools for the full example and callback behavior. Run
the checked-in end-to-end example with cargo run -p ish-core --example tool_agent.
Learn the shared concepts
- Agents — runner setup and results.
- Tools — expose application operations to the model.
- Context API — read and write shared JSON state.
- SDK overview — package status, runtime boundaries, and all languages.