Skip to main content

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.

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())

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.