Skip to main content

Start Building with ISH

ISH (Isolated State Harness) is a library for building agents, programs that ask a model what to do and can call tools, named functions you provide. It also supports durable workflows, application-defined steps whose saved results can be reused after a restart. ISH does not make a model more capable, provide a model, or remove the need to review actions that can change real systems. Its SDKs expose the runtime through Python, TypeScript, Go, C#, Java, and Rust. ISH is early software: the checked-out code is at version 0.1.0, but the package registries checked on 2026-12-01 did not contain the public packages. ish-code and ish-studio are separate projects marked as coming soon; neither is needed to use the agent library.

Safety before trying production tools​

The examples use harmless local functions. Before connecting an agent to real files, commands, payments, or customer data, limit its tools and require review for irreversible actions. Model instructions alone do not enforce permissions. The detailed safety section appears below.

Choose an SDK​

Use the language already used by the application that will own the agent. Python and TypeScript are the shortest paths for trying a local example. Go, C#, and Java use the same runtime but also need a matching native library. Rust applications can use the Rust package from the source checkout. The advanced reference describes the lower-level C interface.

LanguageMinimum runtimeAvailability checked 2026-12-01Source checkout command
PythonPython 3.11PyPI package not founduv sync --locked --directory sdks/python --extra all --extra dev
TypeScriptNode.js 22npm package not foundcd sdks/typescript && npm ci && npm run build:native && npm run build
RustRust 1.97crates.io package not foundcargo build --release -p ish-core --locked
GoGo 1.26Go proxy package not foundBuild ish-core, set ISH_NATIVE_LIBRARY, then cd sdks/go && go test ./...
C#.NET 10NuGet package not foundBuild ish-core, set ISH_NATIVE_LIBRARY, then dotnet build sdks/csharp/Ish.csproj
JavaJDK 25Maven Central package not foundBuild ish-core, set ISH_NATIVE_LIBRARY, then mvn -f sdks/java/pom.xml test

For Go, C#, and Java, first download or clone the source repository, then build the shared library from its root:

cargo build -p ish-core --release --locked
export ISH_NATIVE_LIBRARY="$PWD/target/release/libish_core.dylib"

That filename is for macOS. On Linux, use libish_core.so; on Windows, use ish_core.dll and set the variable in PowerShell with $env:ISH_NATIVE_LIBRARY = "...\ish_core.dll". Keep the repository root as the working directory when setting the variable, or provide an absolute path. Then run the SDK command from the table. The Python and TypeScript source-checkout installs were run for this guide. Go, C#, and Java commands come from their checked-in project files and READMEs; they were not run as newcomer installation checks here. All source installs require a checkout of ish-harness. Python and TypeScript also need Rust and Cargo to build their native pieces. Go, C#, and Java need a library built for the same operating system and CPU as the application. The examples repository has additional setup instructions.

For a first Python check, use a local mock model that returns fixed replies. It needs no API key, network connection, or model account:

import asyncio

from ish import Agent, MockModel, ModelResponse


async def main() -> None:
agent = Agent(
name="hello",
model=MockModel([ModelResponse(content="ISH is ready.")]),
instructions="Answer in one short sentence.",
)
try:
result = await agent.run("Say hello.")
print(result.content)
finally:
agent.close()


asyncio.run(main())

Expected output:

ISH is ready.

This mock model is available in the Python package. The Rust test package has its own mock model. The other language examples can use a local local test server that uses the OpenAI API format or a host model callback; this guide does not claim that each SDK has a MockModel class.

Make an agent call your function​

Register a tool with the agent, then provide a mock reply that asks it to call that tool. This verifies the sequence of model reply, tool call, and final model reply without using a real model service.

import asyncio

from ish import Agent, MockModel, ModelResponse, ToolCall, tool


@tool
def add_one(value: int) -> int:
"""Return the number plus one."""
return value + 1


async def main() -> None:
agent = Agent(
name="calculator",
model=MockModel([
ModelResponse(tool_calls=[
ToolCall(name="add_one", arguments={"value": 41}),
]),
ModelResponse(content="The answer is 42."),
]),
instructions="Use add_one for arithmetic.",
tools=[add_one],
)
try:
result = await agent.run("Add one to 41.")
print(result.content)
print(f"Tool calls: {result.tool_calls_count}")
finally:
agent.close()


asyncio.run(main())

This example returned The answer is 42. after one tool call. A real model may choose not to call a tool, so use explicit instructions and test the behavior you expect.

Save conversation history​

Conversation history is the messages exchanged during one agent session. A session ID (glossary) is a stable name that tells ISH which conversation to continue. A persistence store (glossary) saves selected data. History is not saved across runs unless you give the agent a persistence store and pass the same session ID on later runs.

import asyncio

from ish import Agent, MockModel, ModelResponse, SQLiteLogger


async def main() -> None:
store = SQLiteLogger(db_path="agent-state.sqlite")
await store.initialize()
agent = Agent(
name="assistant",
model=MockModel([ModelResponse(content="Your order is ready.")]),
persistence=store,
)
try:
answer = await agent.run(
"Check order 42.",
session_id="customer-42",
)
saved_messages = await store.get_session_history("customer-42")
print(answer.content)
print(f"Saved messages: {len(saved_messages)}")
finally:
agent.close()
await store.close()


asyncio.run(main())

SQLite (glossary) is a database stored in a local file. The database file is agent-state.sqlite in the current directory. Use a stable session ID only for the same conversation; use a different ID for a new conversation. The saved messages are application data, so choose database access and retention rules that fit your product.

Keep working context or memory​

Working context (glossary) is temporary information such as a task status or a document reference. Long-term memory (glossary) is reusable information an agent can search across separate conversations. Both are in memory by default. A namespace (glossary) is a label that keeps saved groups separate. Give each store the same persistence backend and namespace to save and reload it.

JSON (glossary) is a text format for common values such as objects, lists, numbers, and strings.

from ish import Context, MemoryStore, SQLiteLogger

store = SQLiteLogger(db_path="agent-state.sqlite")
context = Context(persistence=store, namespace="project-17")
context.set("ticket", {"status": "open"})

memory = MemoryStore(persistence=store, namespace="assistant-17")
memory.store("preferred_style", "concise", scope="profile")

# In a later process, recreate the stores with the same backend and names.
context_again = Context(persistence=store, namespace="project-17")
memory_again = MemoryStore(persistence=store, namespace="assistant-17")
assert context_again.get("ticket") == {"status": "open"}
assert memory_again.get("preferred_style", scope="profile") == "concise"

This was verified against a temporary database. Context is the Python name for the working-context store. Values must be JSON-compatible to survive a process restart; Python-only objects remain local to the process. Memory is not silently collected from every conversation. The agent can save a memory when you attach its memory tools and tell it when to do so.

Choose an agent or a workflow​

Use an agent when the model should choose among tools while working toward a goal. Use a durable workflow (glossary) when your application knows the steps and their order. A workflow step (glossary) is a named piece of work whose completed result can be reused after a restart.

The example below has two steps. A replay (glossary) is a later run that loads saved results for completed steps. The second run constructs a new workflow with the same workflow ID and database; completed step functions are not called again. Give every terminal path an explicit END edge (a route that marks the workflow as finished).

import asyncio

from ish import DurableWorkflow, SQLiteLogger

calls: list[str] = []


def load(state: dict) -> dict:
calls.append("load")
return {"value": state["value"] + 1}


def double(state: dict) -> dict:
calls.append("double")
return {"answer": state["value"] * 2}


def build_workflow(store: SQLiteLogger) -> DurableWorkflow:
return (
DurableWorkflow(
workflow_id="order-42",
persistence=store,
entry="load",
)
.add_step("load", load)
.add_step("double", double)
.add_edge("load", "double")
.add_edge("double", "END")
)


async def main() -> None:
store = SQLiteLogger(db_path="workflow-state.sqlite")
await store.initialize()
try:
first_workflow = build_workflow(store)
first = await first_workflow.run({"value": 20})
await first_workflow.close()

calls_before_replay = len(calls)
resumed_workflow = build_workflow(store)
resumed = await resumed_workflow.run({"value": 20})
print(first["state"])
print(resumed["state"])
print(f"Callbacks during replay: {len(calls) - calls_before_replay}")
await resumed_workflow.close()
finally:
await store.close()


asyncio.run(main())

The first run produced {"value": 21, "answer": 42}. The recreated workflow returned the same state and called no step callbacks. This reuses recorded results; it does not make an external payment, email, or other side effect happen exactly once. Use an idempotency key (glossary) or query the external service before retrying an uncertain operation.

State at a glance​

StateWhat it containsDefaultWhat makes it persistMinimal setup
Conversation historyUser, assistant, and tool messages for a sessionOnly the current runGive Agent a store and pass a stable session_id on every runAgent(persistence=store) then await agent.run(text, session_id="case-42")
Working contextValues and documents shared during a taskMemoryGive Context a store and a namespaceContext(persistence=store, namespace="project-17")
Long-term memorySearchable notes that can be reused across sessionsMemoryGive MemoryStore a store and a namespaceMemoryStore(persistence=store, namespace="assistant-17")
Persistence storeTraces, saved messages, workflow results, and enabled durable stateA database file only when configured; otherwise many features remain in memoryCreate the store with a file path or connect an external storeSQLiteLogger(db_path="agent-state.sqlite")

SQLite is a small database stored in a file. It can hold private application data; protect the file, set backups, and define retention. A connector-backed store uses the external service you configure; ISH does not choose its database or create tables for you.

Names across languages​

The following host-language APIs were checked against the current SDK source. The table shows common API names and argument-order differences that matter when moving examples between languages.

CapabilityRustPythonTypeScriptGoC#Java
AgentStart with a model, then add instructions and tools with a builder.Agent(name=..., model=..., instructions=...)new Agent({ name, model, instructions })NewAgent(client, AgentRunRequest{...})new Agent(client, new AgentRunRequest { ... })new Agent(client, model, systemPrompt) or IshClient.runAgent(...)
ToolPass a tool implementation to the agent builder.@tool on a function{ name, parameters, execute }ToolDefinition callback on a requestToolDefinition callback on a requestToolDefinition callback on a request
Working contextCreate a context store; it is in memory unless configured otherwise.Context(...) (ContextStore alias)new ContextStore(client, ...)NewContextStore(...)new ContextStore(...)new ContextStore(...)
Long-term memory writeArgument order: scope, key, content.store(key, content, scope=...)store(key, value, scope)Store(key, value, scope)Store(key, value, scope)store(key, value, scope)
PersistenceChoose an in-memory or file-backed store.SQLiteLogger(db_path=...)new PersistenceStore(client, { path })NewPersistenceStore(client, path, ...)new PersistenceStore(client, path: ...)new PersistenceStore(client, path, ...)
Durable workflowDefine ordered steps with functions.DurableWorkflow(workflow_id=..., persistence=..., entry=...)new DurableWorkflow(client, workflowId, store)NewDurableWorkflowWithStore(client, workflowID, store)new DurableWorkflow(client, workflowId, store)new DurableWorkflow(client, workflowId, store)

Python and the other host SDKs write memory as (key, value, scope). The Rust API writes it as (scope, key, content); see the optional details below. Go, C#, and Java expect the native library to be built for the same platform. Check the language README before copying a constructor: optional arguments and close methods use each language's conventions.

Safety before production​

Agent instructions are not a security boundary. Limit the tools you register, validate their arguments, and apply permission rules to sensitive file and command operations. Require human approval before irreversible changes when your application needs that review. Keep database files, provider credentials, and tool outputs out of prompts and source control. Test behavior with the exact model provider and operating system you deploy.

Durable workflow replay saves completed results, but it cannot know whether an external service completed a request just before a process stopped. Give payments, emails, and similar operations an idempotency key; otherwise query the service before retrying. A completed workflow step is not proof that an external side effect happened exactly once.

Troubleshooting​

SymptomLikely causeCheck
No matching distribution foundRegistry package is not publishedUse the source checkout commands above.
Native library cannot loadThe library is missing or built for another OS/CPURebuild it on the target platform and set ISH_NATIVE_LIBRARY for Go, C#, or Java.
Provider authentication errorMissing or invalid provider keySet the provider's key in the environment; the mock examples need no key.
Workflow validation says a step has no outgoing edgeA terminal route is missingAdd an edge from the final step to "END".
A later run starts with no prior conversationNo persistence store, no stable session ID, or a different IDReuse the same store and exact session_id.
Context or memory is empty after restartIt was created without a persistence store or namespaceRecreate it with the same store and namespace.
External action might have run twiceThe process stopped after the service accepted the requestUse an idempotency key or check the service before retrying.
  1. This guide.
  2. Quickstart for provider-backed runs.
  3. Agent guide for tools and run options.
  4. Context guide or Memory guide for state.
  5. Durable workflows when your application controls the steps.
  6. Safety rules before registering sensitive tools.
  7. The relevant language README for exact API details.

Old page names​

Existing pageUse it for
docs/introProduct overview
docs/getting-started/sdksPrerequisites, package status, and source builds
docs/primitivesAgent concepts
docs/contextWorking context and documents
docs/memoryConversation history and saved knowledge
docs/persistenceDatabase-backed state
docs/workflowsMulti-step durable work
docs/integrationsModel, server, and protocol connections
docs/api-referenceTyped API details and low-level interface details

Glossary​

  • Agent: A program that asks a model to choose a response or registered tool.
  • Tool: A function the application makes available for an agent to call.
  • Mock model: A test model that returns replies you choose instead of calling a model service.
  • SDK: A language package used by application code.
  • Session ID: A stable name for one conversation whose messages should be loaded again.
  • Workflow ID: A stable name that lets ISH find the saved state for the same workflow.
  • Working context: Temporary task data an agent or application can read and update.
  • Long-term memory: Searchable notes that can be reused across conversations.
  • Persistence store: A configured file database or external service used to save selected state.
  • Namespace: A label that separates one saved context or memory collection from another.
  • Durable workflow: A named sequence of steps whose completed results can be reused after restart.
  • Workflow step: A named piece of application work in a durable workflow.
  • Replay: Running a workflow again and reusing saved results for matching completed steps.
  • Idempotency key: A stable request ID that lets an external service recognize a retry of the same action.
  • SQLite: A database stored in a local file.
  • JSON: A common text format for objects, lists, numbers, and strings.
  • Callback: An application function that ISH calls at a defined point, such as when a tool runs.
  • Native library: A compiled file that must match the operating system and CPU of the application.

Internals: optional reference​

You do not need this section to build an agent. ISH's shared implementation is written in Rust. The language wrappers convert values, call the shared runtime, and run application callbacks using their host runtimes. The C ABI is a stable low-level interface for the non-Python bindings.

The Rust Agent uses Agent::builder; the Rust memory API orders its write as MemoryStore::store(scope, key, content). The host SDKs order this as store(key, value, scope). Rust AgentResult.content is a String, not an Option<String>. The low-level catalog uses operation names such as agent.run and abi.schema; ordinary SDK users should prefer the typed constructors above. Details for that interface live in the advanced API reference.

Terms found in technical pages: OCC means rejecting a write when the saved revision changed first. Compare-and-swap (CAS) means “write only if the current value still matches the expected version.” A write-ahead log (WAL) is a record of pending database changes used to recover after interruption. OpenTelemetry Protocol (OTLP) is a standard format for sending traces. W3C Trace Context is a standard way to carry trace identity between services. $DATA: is an internal reference to data kept outside the model conversation. Tombstoning replaces an old, large tool result in the conversation with a short note. These details are optional for ordinary agent use.