Skip to main content
Set this up once before running any example. Individual example pages only list services or variables needed beyond this base.

Requirements

RequirementNotes
Go 1.26+go version to verify
LLM API keySet LLM_APIKEY in examples/.env
Repository clonegit clone https://github.com/agenticenv/agent-sdk-go && cd agent-sdk-go/examples
Supported providers: openai, anthropic, gemini — configured via LLM_PROVIDER and LLM_MODEL.

Environment file setup

Examples load examples/.env.defaults automatically on startup — do not copy it. Create examples/.env (gitignored) only for your API key and overrides:
cd examples
cat >> .env <<'EOF'
LLM_APIKEY=your-key-here
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o
EOF
Load order: .env.defaults.env → process environment. Process-level exports win last. Never commit API keys.

Optional dependencies

DependencyWhen needed
Docker + ComposeWeaviate, pgvector, Redis, Temporal, OTLP collector
Tasktask infra:*:up targets from examples/
Node.jsMCP stdio server (npx), AG-UI Next.js UI
Temporal serverWhen AGENT_RUNTIME=temporal
Embedding API keypgvector and some memory/retriever examples — EMBEDDING_OPENAI_APIKEY in .env

Runtime modes

ModeSettingRequirement
Local (default)AGENT_RUNTIME=local or unsetNone
TemporalAGENT_RUNTIME=temporalRunning Temporal server — task infra:temporal:up && task infra:temporal:wait

Environment variables

Core

VariableDescription
LLM_PROVIDERopenai, anthropic, or gemini
LLM_APIKEYAPI key — required
LLM_MODELe.g. gpt-4o, claude-sonnet-4-20250514, gemini-2.5-flash
LLM_BASEURLOptional custom or proxy endpoint
AGENT_RUNTIMElocal (default) or temporal
LOG_LEVELerror (default), warn, info, debug — written to stderr
SHOW_LLM_USAGEtrue to print token usage footer after each run
SHOW_TELEMETRYtrue to print run telemetry footer

Temporal

Used when AGENT_RUNTIME=temporal:
VariableDefault
TEMPORAL_HOST127.0.0.1
TEMPORAL_PORT7233
TEMPORAL_NAMESPACEdefault
TEMPORAL_TASKQUEUEagent-sdk-go (each example appends a suffix)

Conversation

VariableDescription
REDIS_ADDRRedis address for conversation examples (default localhost:6379)
CONVERSATION_IDOptional session ID override

MCP

VariableDescription
MCP_TRANSPORTstdio or streamable_http
MCP_STDIO_COMMAND / MCP_STDIO_ARGSLocal subprocess MCP (default: filesystem sandbox via npx)
MCP_STREAMABLE_HTTP_URLRemote MCP URL
MCP_BEARER_TOKEN, MCP_ALLOW_TOOLS, MCP_BLOCK_TOOLSAuth and tool filters
MCP_CLIENT_ID, MCP_CLIENT_SECRET, MCP_TOKEN_URLOAuth client credentials
MCP_SKIP_TLS_VERIFYDev only

A2A

VariableDescription
A2A_URLRemote agent base URL (client examples)
A2A_TOKEN, A2A_HEADERS, A2A_ALLOW_SKILLS, A2A_BLOCK_SKILLSClient options
A2A_SERVER_HOST, A2A_SERVER_PORT, A2A_SERVER_BEARER_TOKENSInbound server example

Observability

VariableDescription
OTEL_EXPORTER_OTLP_ENDPOINTCollector host:port — e.g. localhost:4317
OTLP_PROTOCOLgrpc (default) or http
OTLP_INSECUREtrue for plaintext local collectors

Retriever and memory

VariableDescription
RETRIEVER_MODEagentic, prefetch, or hybrid
WEAVIATE_*Weaviate host, class, field names
PGVECTOR_DSN, PGVECTOR_TABLE, EMBEDDING_*Postgres + embeddings
MEMORY_USER_ID, MEMORY_STORE_MODE, MEMORY_RECALL_*Long-term memory examples
The authoritative default values for all variables live in examples/.env.defaults in the repository.

Running Examples

Commands, Task infra, suggested order, and multi-process examples