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 and flushes OTLP exporters; active durable runs are not terminated
defer a.Close() is not optional when using a durable runtime — it shuts down the embedded Temporal worker or Restate SDK endpoint. On the in-process runtime it is a no-op but still good practice.Durability note:Close does not terminate in-flight Temporal workflows or Restate invocations. Runs continue on the server and resume when a worker or endpoint is available again — this is the core durability guarantee.
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.