Skip to main content
The in-process runtime is the default. When you call NewAgent without Temporal or Restate options, the agent loop runs directly inside your Go process — no external orchestration server.

Enable

Omit all Temporal and Restate configuration:
See Quickstart for a complete example.

How it works

When you call Run or Stream, the SDK executes the full agent loop in your process:
  1. Load conversation history and recalled memory (when configured)
  2. Call the LLM with the merged tool list
  3. Execute tool calls and append results
  4. Repeat until the model finishes or the iteration limit is reached
  5. Return the result or stream events back to your caller
Everything happens in-process — no network hops, no external orchestration.

Capabilities

All SDK capabilities are available on the in-process runtime:
  • LLM providers (OpenAI, Anthropic, Gemini, custom)
  • Tools, MCP, A2A, sub-agents
  • Conversation (in-memory), memory, retrieval (RAG)
  • Streaming, AG-UI events, hooks
  • Human-in-the-loop approvals
  • OpenTelemetry observability
Durable execution (crash recovery) and durable reconnect (GetAgentRun / GetAgentStream + WithOffset) require the Temporal or Restate runtime. Temporal also offers horizontal worker scaling via NewAgentWorker; Restate scales via multiple registered endpoint deployments.

Limitations

Handles from Run / Stream are same-process only. For crash reconnect (GetAgentRun, GetAgentStream + WithOffset), use the Temporal or Restate runtime.

Error handling

On in-process, errors are returned directly to the caller:

Run

Stream

Any panic inside a tool call is caught and returned as a RUN_ERROR event / error result, with the panic message included. The run does not propagate the panic to your caller.

When to use

Switch to a durable runtime

Import a durable runtime package and add its config option — no other code changes: Temporal:
Restate:
A running Temporal or Restate server is required. See Temporal or Restate.

Examples

Simple Agent

Minimal in-process agent with Run()

Stream

Streaming tokens and tool events in-process