Documentation
¶
Index ¶
- func A2ABuildAgentConfig(cfg *Config) (agent.A2AConfig, error)
- func A2ADefaultServerName(cfg *Config) string
- func A2AInboundServerOption(cfg *Config) agent.Option
- func A2AServerDisplayURL(cfg *Config) string
- func ApplyMCPStreamableHTTPAuth(transport *mcp.MCPStreamableHTTP, m *MCPSettings)
- func FormatNewAgentError(prefix string, err error) string
- func MCPDefaultServerName(cfg *Config) string
- func MCPLoadTransport(cfg *Config) (mcp.MCPTransportConfig, error)
- func MCPToolFilterFromConfig(cfg *Config) (mcp.MCPToolFilter, error)
- func MCPUsesOAuthFromEnv() bool
- func NewLLMClientFromConfig(cfg *Config) (interfaces.LLMClient, error)
- func NewLoggerFromLogConfig(cfg *Config) logger.Logger
- type A2AServerEnv
- type A2ASettings
- type Config
- type MCPSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func A2ABuildAgentConfig ¶ added in v0.1.9
A2ABuildAgentConfig builds agent.A2AConfig from env. Requires non-empty A2A_URL.
func A2ADefaultServerName ¶ added in v0.1.9
A2ADefaultServerName returns A2A_SERVER_NAME or "remote".
func A2AInboundServerOption ¶ added in v0.1.9
A2AInboundServerOption returns agent.WithA2ADefaultServer when no custom listen address or tokens are set; otherwise agent.WithA2AServer with hostname/port defaults applied by the agent.
func A2AServerDisplayURL ¶ added in v0.1.9
A2AServerDisplayURL returns the agent base URL (scheme + host + port) for logs and docs, using the same defaults as the SDK when env leaves host/port unset.
func ApplyMCPStreamableHTTPAuth ¶ added in v0.1.2
func ApplyMCPStreamableHTTPAuth(transport *mcp.MCPStreamableHTTP, m *MCPSettings)
ApplyMCPStreamableHTTPAuth sets optional auth on transport from m and process env. Unauthenticated MCP (URL only) is valid. When the OAuth trio is set, OAuth is used; otherwise m.BearerToken sets a bearer token when non-empty. MCP_SKIP_TLS_VERIFY=true sets SkipTLSVerify.
func FormatNewAgentError ¶ added in v0.1.3
FormatNewAgentError formats errors from agent.NewAgent or agent.NewAgentWorker for log output when running examples from a clone of this repository. It appends a pointer to temporal-setup.md when the failure is a Temporal connection or namespace timeout from this SDK.
func MCPDefaultServerName ¶ added in v0.1.2
MCPDefaultServerName returns MCP_SERVER_NAME or a default from transport (local / remote).
func MCPLoadTransport ¶ added in v0.1.2
func MCPLoadTransport(cfg *Config) (mcp.MCPTransportConfig, error)
MCPLoadTransport builds mcp.MCPStdio or mcp.MCPStreamableHTTP from cfg and process env. streamable_http requires MCP_STREAMABLE_HTTP_URL. stdio requires MCP_STDIO_COMMAND; optional MCP_STDIO_ARGS (JSON array) and MCP_STDIO_ENV (JSON object).
func MCPToolFilterFromConfig ¶ added in v0.1.2
func MCPToolFilterFromConfig(cfg *Config) (mcp.MCPToolFilter, error)
MCPToolFilterFromConfig returns allow/block lists from comma-separated MCP_ALLOW_TOOLS / MCP_BLOCK_TOOLS.
func MCPUsesOAuthFromEnv ¶ added in v0.1.2
func MCPUsesOAuthFromEnv() bool
MCPUsesOAuthFromEnv reports whether OAuth2 client-credentials env vars are all non-empty.
func NewLLMClientFromConfig ¶
func NewLLMClientFromConfig(cfg *Config) (interfaces.LLMClient, error)
NewLLMClientFromConfig creates an LLM client from config using the new llm.Option-based API. BaseURL is applied only for OpenAI; set LLM_BASEURL when using a non-default OpenAI-compatible API.
func NewLoggerFromLogConfig ¶
NewLoggerFromLogConfig returns logger.Logger for use with the agent. Logs to stderr so conversation (stdout) stays separate; set LOG_LEVEL=info or debug to see logs.
Types ¶
type A2AServerEnv ¶ added in v0.1.9
type A2AServerEnv struct {
// Hostname is the bind address (empty with Port 0 and no tokens → use SDK defaults via [agent.WithA2ADefaultServer]).
Hostname string
// Port is the TCP listen port (0 means default 9999 when combined with [agent.WithA2AServer]).
Port int
// BearerTokens are accepted static Bearer tokens for JSON-RPC (comma-separated in env).
BearerTokens []string
}
A2AServerEnv configures the built-in A2A HTTP server (listen address and optional bearer tokens). Used by A2AInboundServerOption and A2AServerDisplayURL.
type A2ASettings ¶ added in v0.1.9
type A2ASettings struct {
// URL is the A2A agent base URL for card resolution (required for the A2A examples).
URL string
// Name is the stable connection id used as the server key in tool names (default: remote).
Name string
// TimeoutSeconds caps each A2A HTTP operation when > 0; zero uses the SDK default.
TimeoutSeconds int
// Token is an optional bearer token (Authorization: Bearer ...).
Token string
// HeadersRaw is optional JSON object of extra HTTP headers, e.g. {"X-Api-Key":"..."}.
HeadersRaw string
// SkipTLSVerify disables TLS verification for the A2A client (development only).
SkipTLSVerify bool
// AllowSkills is comma-separated skill IDs to expose (mutually exclusive with BlockSkills).
AllowSkills string
// BlockSkills is comma-separated skill IDs to hide (mutually exclusive with AllowSkills).
BlockSkills string
}
A2ASettings holds env-driven settings for wiring agent.WithA2AConfig or pkg/a2a/client.NewClient.
type Config ¶
type Config struct {
Host string
Port int
Namespace string
TaskQueue string
LogLevel string
Provider interfaces.LLMProvider
APIKey string
Model string
// BaseURL is optional and only used for the OpenAI client (custom or Azure-compatible endpoints).
// Ignored for Anthropic and Gemini.
BaseURL string
MCP MCPSettings
// A2A holds A2A_* environment values for agent_with_a2a_* examples.
A2A A2ASettings
// A2AServer holds A2A_SERVER_* values for agent_with_a2a_server (inbound HTTP server).
A2AServer A2AServerEnv
}
func LoadFromEnv ¶
func LoadFromEnv() *Config
LoadFromEnv loads config from environment variables. .env is loaded on package init if present.
func (*Config) A2ATimeout ¶ added in v0.1.9
A2ATimeout returns cfg.A2A.TimeoutSeconds as a duration, or zero if unset.
func (*Config) MCPTimeout ¶ added in v0.1.2
MCPTimeout returns cfg.MCP.TimeoutSeconds as a duration, or zero if unset (applies to any MCP transport).
type MCPSettings ¶ added in v0.1.2
type MCPSettings struct {
// Transport is required for MCPLoadTransport: stdio or streamable_http (aliases: local; http, remote, streamable).
Transport string
// StreamableHTTPURL is the remote MCP endpoint when transport is streamable_http.
StreamableHTTPURL string
// StdioCommand is the executable for MCP stdio transport (required when transport is stdio).
StdioCommand string
// StdioArgsRaw is JSON array of strings for subprocess argv, e.g. ["-y","@scope/mcp-server","/data"].
StdioArgsRaw string
// StdioEnvRaw is JSON object of extra env vars for the subprocess, e.g. {"API_KEY":"..."}.
StdioEnvRaw string
// BearerToken is an optional static bearer for MCP HTTP. Ignored when OAuth env trio is all set.
BearerToken string
// Name is the stable server id for this MCP connection (empty defaults to local for stdio, remote for HTTP).
Name string
// RetryAttempts is max connect+RPC attempts per operation when > 0; zero uses SDK default.
RetryAttempts int
// AllowTools is comma-separated tool names to allow-list (optional); mutually exclusive with BlockTools in validation.
AllowTools string
// BlockTools is comma-separated tool names to block-list (optional).
BlockTools string
// TimeoutSeconds caps each MCP connect+RPC attempt when > 0 (seconds). Zero uses SDK defaults.
TimeoutSeconds int
}
MCPSettings holds MCP_* environment values for agent_with_mcp_* examples. This is not github.com/agenticenv/agent-sdk-go/pkg/agent.MCPConfig (per-server agent transport + filter).
Directories
¶
| Path | Synopsis |
|---|---|
|
agent_copilotkit
|
|
|
server
command
|
|
|
agent_with_observability
|
|
|
config
command
OTLP via agent.WithObservabilityConfig — the SDK constructs tracer, metrics, and logs (OTLP log export for the default SDK logger via the slog bridge; internal default batching/export timing).
|
OTLP via agent.WithObservabilityConfig — the SDK constructs tracer, metrics, and logs (OTLP log export for the default SDK logger via the slog bridge; internal default batching/export timing). |
|
objects
command
OTLP via pre-built observability.NewTracer, observability.NewMetrics, observability.NewLogs, then agent.WithTracer, agent.WithMetrics, agent.WithLogs.
|
OTLP via pre-built observability.NewTracer, observability.NewMetrics, observability.NewLogs, then agent.WithTracer, agent.WithMetrics, agent.WithLogs. |
|
setup
Package setup shares OTLP env parsing and base agent options for the config/ and objects/ examples.
|
Package setup shares OTLP env parsing and base agent options for the config/ and objects/ examples. |
|
agent_with_retriever
|
|
|
common
Package common holds shared configuration and agent options for the agent_with_retriever examples.
|
Package common holds shared configuration and agent options for the agent_with_retriever examples. |
|
pgvector
command
Example agent using a PostgreSQL pgvector retriever.
|
Example agent using a PostgreSQL pgvector retriever. |
|
weaviate
command
Example agent using a Weaviate vector retriever.
|
Example agent using a Weaviate vector retriever. |
|
agent_with_run_async demonstrates RunAsync: result and approval channels without WithApprovalHandler or Stream.
|
agent_with_run_async demonstrates RunAsync: result and approval channels without WithApprovalHandler or Stream. |
|
agent_with_temporal_client demonstrates using WithTemporalClient to pass a pre-configured Temporal client to the agent.
|
agent_with_temporal_client demonstrates using WithTemporalClient to pass a pre-configured Temporal client to the agent. |
|
agent_with_worker
|
|
|
agent
command
Interactive streaming REPL for the agent_with_worker example.
|
Interactive streaming REPL for the agent_with_worker example. |
|
worker
command
|
|
|
durable_agent
|
|
|
agent
command
Interactive streaming REPL for the durable_agent example.
|
Interactive streaming REPL for the durable_agent example. |
|
worker
command
|
|