Skip to Content

API Reference

Complete API reference for the isA Agent SDK.

Agent Class

The primary interface for creating and running agents.

from isa_agent_sdk import Agent # L1: Zero config agent = Agent("assistant") # L2: Common params agent = Agent("coder", tools=["Read", "Write"], model="claude-sonnet") # L3: Full options agent = Agent("expert", options=ISAAgentOptions( mode=ExecutionMode.COLLABORATIVE, guardrail_mode=GuardrailMode.STRICT, max_iterations=50, ))

Methods

MethodReturnsDescription
agent.run(message)AgentRunResultSend a message and get a complete response
agent.stream(message)AsyncIterable[AgentMessage]Stream events as they arrive
Agent.auto_team(agents)AgentCreate a team that auto-selects the best agent

ISAAgentOptions

Full configuration for agent behavior.

from isa_agent_sdk import ISAAgentOptions, ExecutionMode, ToolDiscovery

Key Fields

FieldTypeDefaultDescription
modelstrNoneModel name for reasoning
system_promptstrNoneSystem prompt override
modeExecutionModeREACTIVEExecution mode
tool_discoveryToolDiscoveryHYBRIDTool discovery strategy
permission_modePermissionModeDEFAULTPermission enforcement
guardrail_modeGuardrailModeMODERATESafety guardrail strictness
toolslist[str][]Tools to make available
skillslist[str][]Skills to enable
max_iterationsint25Max agent loop iterations
temperaturefloatNoneModel temperature
max_tokensintNoneMax response tokens

Enums

ExecutionMode: REACTIVE (default), COLLABORATIVE, PROACTIVE

ToolDiscovery: EXPLICIT, SEMANTIC, HYBRID (default)

PermissionMode: DEFAULT, ACCEPT_EDITS, BYPASS_PERMISSIONS

GuardrailMode: PERMISSIVE, MODERATE (default), STRICT

AgentMessage

Events emitted during agent execution.

from isa_agent_sdk import AgentMessage, EventType

EventType Values

EventDescription
session.createdNew session started
session.resumedExisting session resumed
content.startResponse generation started
content.deltaIncremental content chunk
content.completeFull response complete
tool.startTool execution started
tool.resultTool returned a result
tool.errorTool execution failed

Tool Definition

Define custom tools for agent use.

from isa_agent_sdk import tool @tool() async def get_weather(city: str) -> str: """Get current weather for a city.""" return f"Weather in {city}: sunny"

Parameters are inferred from type hints. The tool is automatically registered with the MCP server.

Multi-Agent Orchestration

Swarm

Dynamic handoff between agents.

from isa_agent_sdk import SwarmOrchestrator swarm = SwarmOrchestrator(agents=[researcher, writer]) result = await swarm.run("Research and write about AI agents")

Fan Out

Parallel execution across agents.

from isa_agent_sdk import fan_out results = await fan_out([analyst, researcher], "Analyze this data")

Refinement

Iterative improvement loop.

from isa_agent_sdk import refine result = await refine(editor, "Write a haiku", max_iterations=3)

Detached AgentRun API

For work that should continue after the request returns, use the current detached run API. It queues the run and exposes status and event streams.

from isa_agent_sdk import submit_agent_run, stream_agent_run handle = await submit_agent_run( prompt="分析这个代码库", options=ISAAgentOptions(model="gpt-4o-mini"), ) async for event in stream_agent_run(handle.run_id): print(event.type, event.status)

ISAAgentClient

HTTP + SSE client for connecting to deployed agents.

from isa_agent_sdk import ISAAgentClient client = ISAAgentClient(base_url="http://localhost:8080") # Non-streaming result = await client.chat.create("Hello", user_id="user-1") # Streaming async for event in client.chat.stream("Hello", user_id="user-1"): print(event.type, event.data)

TypeScript SDK

import { Agent, defineTool, swarm } from "@isa-agent/sdk"; const agent = new Agent("assistant", { model: "claude-sonnet" }); const result = await agent.run("Hello!");

See the TypeScript SDK source  for full API.