Skip to main content

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.

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

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.node addon built
  • Rust: Rust 1.97+ (ish-harness workspace/path crate)
  • Go: Go 1.26+ with the matching native library built (ISH_NATIVE_LIBRARY or target/release)
  • C#: .NET 10+ with libish_core built (ISH_NATIVE_LIBRARY or 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.

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

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.