Create your first agent and run it in under 5 minutes
Create a minimal agent on the in-process runtime and run a single prompt. No Temporal or Restate server required.Requirements: Go 1.26+ and an API key for at least one LLM provider. Verify your Go version with go version.
Stops any embedded Temporal worker or Restate SDK endpoint, closes the in-process durable-go engine, and flushes OTLP exporters
defer a.Close() is always required, on every runtime — it shuts down the embedded Temporal worker / Restate SDK endpoint and flushes OTLP exporters.Durability note — runtimes differ here: on Temporal/Restate, Close does not terminate in-flight runs — they continue on the server and resume when a worker or endpoint is available again. On the in-process (local) runtime, Closedoes cancel every in-flight run on the durable-go engine it owns (not just this agent’s run) and waits for that cancellation to be journaled — those runs become terminal, not resumable. A graceful shutdown (Close) is therefore not equivalent to a crash for local durability purposes; only an unclean process exit (kill -9, OOM) that skips Close leaves a run genuinely resumable on restart. See In-Process durability.
Import pkg/agent/runtime/temporal and add temporal.WithTemporalConfig to run the same agent durably. A running Temporal cluster is required — see Temporal runtime.
a, err := agent.NewAgent( temporal.WithTemporalConfig(&temporal.TemporalConfig{ Host: "localhost", Port: 7233, Namespace: "default", TaskQueue: "my-app", }), agent.WithName("quickstart-agent"), agent.WithSystemPrompt("You are a helpful assistant."), agent.WithLLMClient(llmClient),)
No other code changes. The agent loop now runs as a durable Temporal workflow. See Temporal runtime for connection options including Temporal Cloud.
Import pkg/agent/runtime/restate and add restate.WithRestateConfig to run the same agent durably. A running Restate server is required — see Restate runtime and restate-setup.md.
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.WithName("quickstart-agent"), agent.WithSystemPrompt("You are a helpful assistant."), agent.WithLLMClient(llmClient),)
No other code changes. The agent loop now runs as a durable Restate invocation with an embedded SDK endpoint. See Restate runtime for ingress, deployment URL, and Cloud options.
Use either Temporal or Restate — not both on the same agent.