> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agenticenv.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Runtimes Overview

> Choose between in-process, Temporal, and Restate runtimes based on your distribution and infrastructure requirements

Agent SDK for Go supports three execution backends. **In-process is the default** — pass no Temporal or Restate options — and is **durable by default** via [durable-go](https://github.com/agenticenv/durable-go), with no extra infrastructure. **Temporal** and **Restate** are opt-in **distributed** backends — import `pkg/agent/runtime/temporal` or `pkg/agent/runtime/restate` and add the matching config option when you need multi-process/horizontally-scaled execution.

Your agent code (`NewAgent`, tools, prompts, streaming) stays the same. Only the configuration changes.

## Comparison

| | In-process | Temporal | Restate |
| - | - | - | - |
| **Enable** | Default — omit Temporal/Restate options | `temporal.WithTemporalConfig` or `temporal.WithTemporalClient` | `restate.WithRestateConfig` |
| **Infrastructure** | None beyond your LLM provider — durable-go journals to local disk | Running Temporal server or Temporal Cloud | Running Restate server or Restate Cloud |
| **Where the loop runs** | Inside your Go process | Durable workflow + activities | Durable Restate invocation + embedded SDK endpoint |
| **Crash recovery** | Yes by default — durable-go journal resumes from last completed step (`local.WithLocalConfig` to tune or opt out) | Yes — workflow history replays from last step | Yes — journal resumes from last completed step |
| **Horizontal scale** | Single process only | Add workers on task queues | Register multiple endpoint deployments |
| **Split client / worker** | Not applicable | `DisableLocalWorker` + `NewAgentWorker` | Not applicable — endpoint is embedded in `NewAgent` |
| **Feature parity** | Full | Full | Full |
| **Reconnect fidelity** | Step-granularity replay (one coalesced message per completed step), not the original tokens | Token-level — original AG-UI events replay | Token-level — original AG-UI events replay |
| **Conversation backend** | In-memory (single process) | Redis for split-process deployments | In-memory or Redis as needed for your topology |

## When to use in-process

* Any single-process deployment that still wants crash recovery — this is the default, not a tradeoff
* Zero-infrastructure deployments (serverless, scripts, single binary)
* Skip it only if you need horizontal scaling or a client/worker split — that's what Temporal/Restate add

See [In-Process](/runtimes/in-process) for details, the durability knobs, and the one remaining limitation (reconnect fidelity).

## When to use Temporal

* You need horizontal scaling by adding workers on a task queue
* You want to split the agent client and worker across separate processes (`NewAgentWorker`)
* Reconnect needs token-level fidelity (original AG-UI events replay, not coalesced steps)
* You want mature, battle-tested workflow orchestration tooling (Temporal Web UI, etc.)

Crash recovery alone is not a reason to reach for Temporal — in-process already has it.

See [Temporal](/runtimes/temporal) for cluster setup and SDK connection.

## When to use Restate

* You want durable orchestration with Restate’s ingress + embedded endpoint model
* You need multiple registered endpoint deployments for scale
* Reconnect needs token-level fidelity (original AG-UI events replay, not coalesced steps)

Crash recovery alone is not a reason to reach for Restate — in-process already has it.

See [Restate](/runtimes/restate) for server setup and SDK connection.

## How runtime selection works

The SDK selects a backend from your `NewAgent` options. You never instantiate a runtime directly.

```go theme={null}
// In-process (default)
a, err := agent.NewAgent(
    agent.WithLLMClient(llmClient),
    agent.WithSystemPrompt("You are a helpful assistant."),
)

// Temporal
a, err := agent.NewAgent(
    temporal.WithTemporalConfig(&temporal.TemporalConfig{
        Host: "localhost", Port: 7233,
        Namespace: "default", TaskQueue: "my-app",
    }),
    agent.WithLLMClient(llmClient),
    agent.WithSystemPrompt("You are a helpful assistant."),
)

// Restate
a, err := agent.NewAgent(
    restate.WithRestateConfig(&restate.RestateConfig{
        Ingress:  restate.IngressConfig{URL: "http://localhost:8080"},
        Endpoint: restate.EndpointConfig{ListenAddress: ":9080", AdminURL: "http://localhost:9070"},
    }),
    agent.WithLLMClient(llmClient),
    agent.WithSystemPrompt("You are a helpful assistant."),
)
```

<Warning>
  Provide **either** Temporal options **or** `restate.WithRestateConfig`, not both. For Temporal alone, provide **either** `WithTemporalConfig` or `WithTemporalClient`, not both.
</Warning>

## Switching runtimes

<Tip>
  In-process is already durable in development and production. Add Temporal or Restate only when you need distributed/horizontally-scaled execution — the agent code (tools, prompts, streaming, approvals) does not change.
</Tip>

1. Start in-process with no Temporal or Restate options — durable by default
2. Add `temporal.WithTemporalConfig` (or `WithTemporalClient`) **or** `restate.WithRestateConfig` when you need multi-process/horizontal scale
3. If you use conversation with a Temporal split-process deployment (agent + separate worker), switch from in-memory to Redis. See [Conversation](/features/conversation)

## Related pages

<CardGroup cols={2}>
  <Card title="In-Process" icon="laptop" href="/runtimes/in-process" horizontal>
    Default runtime — zero infrastructure
  </Card>

  <Card title="Temporal" icon="server" href="/runtimes/temporal" horizontal>
    Durable workflows, workers, and production deployment
  </Card>

  <Card title="Restate" icon="cube" href="/runtimes/restate" horizontal>
    Durable invocations with an embedded SDK endpoint
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.