Skip to main content
Agent SDK for Go supports two execution backends. In-process is the default — pass no Temporal options. Temporal is opt-in — add WithTemporalConfig or WithTemporalClient when you need durable, production-grade execution. Your agent code (NewAgent, tools, prompts, streaming) stays the same. Only the configuration changes.

Comparison

In-processTemporal
EnableDefault — omit Temporal optionsWithTemporalConfig or WithTemporalClient
InfrastructureNone beyond your LLM providerRunning Temporal server or Temporal Cloud
Where the loop runsInside your Go processDurable workflow + activities
Crash recoveryNo — run is lost if the process exitsYes — workflow history replays from last step
Horizontal scaleSingle process onlyAdd workers on task queues
Split client / workerNot applicableDisableLocalWorker + NewAgentWorker
Feature parityFullFull
Conversation backendIn-memory (single process)Redis for split-process deployments

When to use in-process

  • Developing, testing, or prototyping
  • Short-lived runs where crash recovery is not needed
  • Zero-infrastructure deployments (serverless, scripts, single binary)
See In-Process for details and limitations.

When to use Temporal

  • Agent runs must survive process crashes, deploys, and restarts
  • You need horizontal scaling by adding workers
  • You want to split the agent client and worker across separate processes
  • Long-running agent sessions require durable orchestration
See Temporal for cluster setup and SDK connection.

How runtime selection works

The SDK selects a backend from your NewAgent options. You never instantiate a runtime directly.
// In-process (default)
a, err := agent.NewAgent(
    agent.WithLLMClient(llmClient),
    agent.WithSystemPrompt("You are a helpful assistant."),
)

// Temporal
a, err := agent.NewAgent(
    agent.WithTemporalConfig(&agent.TemporalConfig{
        Host: "localhost", Port: 7233,
        Namespace: "default", TaskQueue: "my-app",
    }),
    agent.WithLLMClient(llmClient),
    agent.WithSystemPrompt("You are a helpful assistant."),
)
Provide either WithTemporalConfig or WithTemporalClient, not both. They configure different levels of the Temporal client lifecycle — mixing them is a compile-time option error.

Switching runtimes

Start in-process during development and add Temporal for production with a single config change. The agent code — tools, prompts, streaming, approvals — does not change.
  1. Develop with no Temporal options
  2. Add WithTemporalConfig (or WithTemporalClient) for production
  3. If you use conversation with a split-process deployment (agent + separate worker), switch from in-memory to Redis. See Conversation

In-Process

Default runtime — zero infrastructure

Temporal

Durable workflows, workers, and production deployment

Configuration

WithTemporalConfig, DisableLocalWorker, and all runtime options

Architecture

How the agent loop maps to each backend