Documentation
¶
Index ¶
- Constants
- type AgentConfig
- type ArtifactRetentionConfig
- type ArtifactsConfig
- type ArtifactsServerConfig
- type ArtifactsStorageConfig
- type AuthConfig
- type CapabilitiesConfig
- type ClientTLSConfig
- type Config
- type LogConfig
- type MetricsConfig
- type OTelConfig
- type QueueConfig
- type ResolvedTelemetry
- type ServerConfig
- type TLSConfig
- type TaskRetentionConfig
- type TelemetryConfig
- type ToolBoxConfig
- type TraceConfig
Constants ¶
const ( DefaultAttrSessionIDKey = "session.id" DefaultAttrToolCallIDKey = "gen_ai.tool.call.id" )
Default attribute/baggage keys following OTel semantic conventions. These mirror the `default=` struct tags above so direct struct construction (e.g. in tests) still resolves sensible keys.
const ( MetricsExporterPrometheus = "prometheus" ExporterOTLP = "otlp" ExporterNone = "none" OTLPProtocolHTTP = "http/protobuf" OTLPProtocolGRPC = "grpc" )
Telemetry exporter selection values, following the OpenTelemetry specification.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
AgentName string `env:"NAME" description:"Name of the agent for identification in callbacks and logging"`
Provider string `env:"PROVIDER" description:"LLM provider name"`
Model string `env:"MODEL" description:"LLM model name"`
BaseURL string `env:"BASE_URL" description:"Base URL for the LLM provider API"`
APIKey string `env:"API_KEY" description:"API key for authentication"`
Timeout time.Duration `env:"TIMEOUT,default=30s" description:"Client timeout for requests"`
MaxRetries int `env:"MAX_RETRIES,default=3" description:"Maximum number of retries"`
MaxChatCompletionIterations int `env:"MAX_CHAT_COMPLETION_ITERATIONS,default=50" description:"Maximum chat completion iterations"`
CustomHeaders map[string]string `env:"CUSTOM_HEADERS" description:"Custom headers to include in requests"`
TLSConfig ClientTLSConfig `env:",prefix=TLS_" description:"TLS configuration for client"`
ProxyURL string `env:"PROXY_URL" description:"Proxy URL for requests"`
UserAgent string `env:"USER_AGENT,default=a2a-agent/1.0" description:"User agent string"`
MaxTokens int `env:"MAX_TOKENS,default=4096" description:"Maximum tokens for completion"`
Temperature float64 `env:"TEMPERATURE,default=0.7" description:"Temperature for completion"`
TopP float64 `env:"TOP_P,default=1.0" description:"Top-p for completion"`
FrequencyPenalty float64 `env:"FREQUENCY_PENALTY,default=0.0" description:"Frequency penalty for completion"`
PresencePenalty float64 `env:"PRESENCE_PENALTY,default=0.0" description:"Presence penalty for completion"`
SystemPrompt string `` /* 195-byte string literal not displayed */
MaxConversationHistory int `` /* 126-byte string literal not displayed */
ToolBoxConfig ToolBoxConfig `env:",prefix=TOOLS_" description:"Tool configuration for agents"`
EnableUsageMetadata bool `` /* 129-byte string literal not displayed */
}
AgentConfig holds agent-specific configuration
type ArtifactRetentionConfig ¶ added in v0.12.0
type ArtifactRetentionConfig struct {
MaxArtifacts int `env:"MAX_ARTIFACTS,default=5" description:"Maximum artifacts to retain per task (0 = unlimited)"`
MaxAge time.Duration `env:"MAX_AGE,default=168h" description:"Maximum age for artifacts (0 = no age limit)"`
CleanupInterval time.Duration `env:"CLEANUP_INTERVAL,default=24h" description:"How often to run cleanup (0 = manual cleanup only)"`
}
ArtifactRetentionConfig defines artifact cleanup policies
type ArtifactsConfig ¶ added in v0.12.0
type ArtifactsConfig struct {
Enable bool `env:"ENABLE,default=false" description:"Enable artifacts server"`
ServerConfig ArtifactsServerConfig `env:",prefix=SERVER_" description:"HTTP server configuration for artifacts server"`
StorageConfig ArtifactsStorageConfig `env:",prefix=STORAGE_" description:"Storage configuration for artifacts"`
RetentionConfig ArtifactRetentionConfig `env:",prefix=RETENTION_" description:"Artifact retention and cleanup configuration"`
}
ArtifactsConfig holds artifacts server configuration
type ArtifactsServerConfig ¶ added in v0.12.0
type ArtifactsServerConfig struct {
Host string `env:"HOST,default=localhost" description:"Artifacts server host"`
Port string `env:"PORT,default=8081" description:"Artifacts server port"`
ReadTimeout time.Duration `env:"READ_TIMEOUT,default=30s" description:"Artifacts server read timeout"`
WriteTimeout time.Duration `env:"WRITE_TIMEOUT,default=30s" description:"Artifacts server write timeout"`
IdleTimeout time.Duration `env:"IDLE_TIMEOUT,default=60s" description:"Artifacts server idle timeout"`
TLSConfig TLSConfig `env:",prefix=TLS_" description:"TLS configuration for artifacts server"`
}
ArtifactsServerConfig holds artifacts HTTP server configuration
type ArtifactsStorageConfig ¶ added in v0.12.0
type ArtifactsStorageConfig struct {
Provider string `env:"PROVIDER,default=filesystem" description:"Storage provider (filesystem, minio, s3, gcs)"`
BasePath string `env:"BASE_PATH,default=./artifacts" description:"Base path for filesystem storage"`
BaseURL string `` /* 148-byte string literal not displayed */
Endpoint string `env:"ENDPOINT" description:"Storage endpoint URL (for MinIO, S3, etc.)"`
AccessKey string `env:"ACCESS_KEY" description:"Storage access key"`
SecretKey string `env:"SECRET_KEY" description:"Storage secret key"`
BucketName string `env:"BUCKET_NAME,default=artifacts" description:"Storage bucket name"`
Region string `env:"REGION,default=us-east-1" description:"Storage region"`
UseSSL bool `env:"USE_SSL,default=true" description:"Use SSL for storage connections"`
Credentials map[string]string `env:"CREDENTIALS" description:"Additional provider-specific credentials"`
}
ArtifactsStorageConfig holds storage configuration for artifacts
type AuthConfig ¶
type AuthConfig struct {
Enable bool `env:"ENABLE,default=false"`
IssuerURL string `env:"ISSUER_URL,default=http://keycloak:8080/realms/inference-gateway-realm"`
ClientID string `env:"CLIENT_ID,default=inference-gateway-client"`
ClientSecret string `env:"CLIENT_SECRET"`
}
AuthConfig holds authentication configuration
type CapabilitiesConfig ¶
type CapabilitiesConfig struct {
Streaming bool `env:"STREAMING,default=true" description:"Enable streaming support"`
PushNotifications bool `env:"PUSH_NOTIFICATIONS,default=true" description:"Enable push notifications"`
StateTransitionHistory bool `env:"STATE_TRANSITION_HISTORY,default=false" description:"Enable state transition history"`
}
CapabilitiesConfig defines agent capabilities
type ClientTLSConfig ¶
type ClientTLSConfig struct {
InsecureSkipVerify bool `env:"INSECURE_SKIP_VERIFY,default=false" description:"Skip TLS certificate verification"`
CertFile string `env:"CERT_FILE" description:"Client certificate file"`
KeyFile string `env:"KEY_FILE" description:"Client private key file"`
CAFile string `env:"CA_FILE" description:"Certificate authority file"`
}
ClientTLSConfig holds TLS configuration for LLM client
type Config ¶
type Config struct {
AgentName string // Build-time metadata, not configurable via environment
AgentDescription string // Build-time metadata, not configurable via environment
AgentVersion string // Build-time metadata, not configurable via environment
AgentURL string `env:"AGENT_URL"`
AgentCardFilePath string `env:"AGENT_CARD_FILE_PATH" description:"Path to JSON file containing static agent card definition"`
Debug bool `env:"DEBUG,default=false"`
Timezone string `env:"TIMEZONE,default=UTC" description:"Timezone for timestamps (e.g., UTC, America/New_York, Europe/London)"`
StreamingStatusUpdateInterval time.Duration `env:"STREAMING_STATUS_UPDATE_INTERVAL,default=1s"`
AgentConfig AgentConfig `env:",prefix=AGENT_CLIENT_"`
CapabilitiesConfig CapabilitiesConfig `env:",prefix=CAPABILITIES_"`
AuthConfig AuthConfig `env:",prefix=AUTH_"`
QueueConfig QueueConfig `env:",prefix=QUEUE_"`
TaskRetentionConfig TaskRetentionConfig `env:",prefix=TASK_RETENTION_"`
ServerConfig ServerConfig `env:",prefix=SERVER_"`
TelemetryConfig TelemetryConfig `env:",prefix=TELEMETRY_"`
ArtifactsConfig ArtifactsConfig `env:",prefix=ARTIFACTS_"`
OTelConfig OTelConfig // Standard OpenTelemetry SDK env vars (OTEL_*), read without a prefix
}
Config holds all application configuration
func Load ¶
Load loads configuration from environment variables, merging with the provided base config.
func LoadWithLookuper ¶
func LoadWithLookuper(ctx context.Context, baseConfig *Config, lookuper envconfig.Lookuper) (*Config, error)
LoadWithLookuper creates and loads configuration using a custom lookuper and merges with user config
func NewWithDefaults ¶
NewWithDefaults creates a new config with defaults applied from struct tags.
func (*Config) GetCurrentTime ¶
GetCurrentTime returns the current time in the configured timezone
func (*Config) GetTimezone ¶
GetTimezone returns the timezone location for timestamps
func (*Config) ResolveTelemetry ¶ added in v0.23.0
func (c *Config) ResolveTelemetry() ResolvedTelemetry
ResolveTelemetry computes the effective exporter selection, preferring the standard OTEL_* env vars and falling back to the deprecated TELEMETRY_* ones.
type LogConfig ¶ added in v0.22.0
type LogConfig struct {
Enable bool `env:"ENABLE,default=false" description:"Enable OTLP log export (reserved, not yet wired)"`
Endpoint string `env:"ENDPOINT,default=http://localhost:4318" description:"OTLP log endpoint URL (reserved, not yet wired)"`
Headers map[string]string `env:"HEADERS" description:"Custom headers for OTLP log export (reserved, not yet wired)"`
}
LogConfig holds OTLP log exporter configuration. Reserved for future use - the OTLP log exporter is not yet wired.
type MetricsConfig ¶
type MetricsConfig struct {
Port string `env:"PORT,default=9090" description:"Metrics server port"`
Host string `env:"HOST,default=" description:"Metrics server host (empty for all interfaces)"`
ReadTimeout time.Duration `env:"READ_TIMEOUT,default=30s" description:"Metrics server read timeout"`
WriteTimeout time.Duration `env:"WRITE_TIMEOUT,default=30s" description:"Metrics server write timeout"`
IdleTimeout time.Duration `env:"IDLE_TIMEOUT,default=60s" description:"Metrics server idle timeout"`
}
MetricsConfig holds metrics server configuration
type OTelConfig ¶ added in v0.23.0
type OTelConfig struct {
MetricsExporter string `env:"OTEL_METRICS_EXPORTER" description:"Metrics exporter to use: prometheus, otlp, or none"`
TracesExporter string `env:"OTEL_TRACES_EXPORTER" description:"Traces exporter to use: otlp or none"`
ExporterOTLPEndpoint string `env:"OTEL_EXPORTER_OTLP_ENDPOINT" description:"OTLP endpoint base URL shared by traces and metrics"`
ExporterOTLPProtocol string `env:"OTEL_EXPORTER_OTLP_PROTOCOL" description:"OTLP transport protocol: http/protobuf or grpc"`
PrometheusHost string `env:"OTEL_EXPORTER_PROMETHEUS_HOST" description:"Host for the Prometheus pull endpoint"`
PrometheusPort string `env:"OTEL_EXPORTER_PROMETHEUS_PORT" description:"Port for the Prometheus pull endpoint"`
}
OTelConfig holds the standard OpenTelemetry SDK environment variables. These follow the OTel specification naming and, when set, take precedence over the deprecated TELEMETRY_* aliases. They are read without a prefix so the standard names apply when the ADK config is loaded at the process root.
type QueueConfig ¶
type QueueConfig struct {
Provider string `env:"PROVIDER,default=memory" description:"Message broker provider (memory, redis, sqs, pubsub)"`
URL string `env:"URL" description:"Connection URL for the message broker"`
MaxSize int `env:"MAX_SIZE,default=100"`
CleanupInterval time.Duration `env:"CLEANUP_INTERVAL,default=120s"`
Credentials map[string]string `env:"CREDENTIALS" description:"Broker-specific credentials"`
Options map[string]string `env:"OPTIONS" description:"Broker-specific configuration options"`
}
QueueConfig holds task queue configuration
type ResolvedTelemetry ¶ added in v0.23.0
type ResolvedTelemetry struct {
MetricsExporter string
TracesExporter string
OTLPEndpoint string
OTLPProtocol string
PrometheusHost string
PrometheusPort string
}
ResolvedTelemetry captures the effective telemetry exporter selection after merging the standard OTEL_* variables with the deprecated TELEMETRY_* aliases. Standard OTEL_* values win when set; otherwise the legacy TELEMETRY_* values (and their defaults) are used so existing deployments keep working.
type ServerConfig ¶
type ServerConfig struct {
Port string `env:"PORT,default=8080" description:"HTTP server port"`
ReadTimeout time.Duration `env:"READ_TIMEOUT,default=120s" description:"HTTP server read timeout"`
WriteTimeout time.Duration `env:"WRITE_TIMEOUT,default=120s" description:"HTTP server write timeout"`
IdleTimeout time.Duration `env:"IDLE_TIMEOUT,default=120s" description:"HTTP server idle timeout"`
DisableHealthcheckLog bool `env:"DISABLE_HEALTHCHECK_LOG,default=true" description:"Disable logging for health check requests"`
TLSConfig TLSConfig `env:",prefix=TLS_"`
}
ServerConfig holds HTTP server configuration
type TLSConfig ¶
type TLSConfig struct {
Enable bool `env:"ENABLE,default=false"`
CertPath string `env:"CERT_PATH" description:"TLS certificate path"`
KeyPath string `env:"KEY_PATH" description:"TLS key path"`
}
TLSConfig holds TLS configuration
type TaskRetentionConfig ¶ added in v0.8.0
type TaskRetentionConfig struct {
MaxCompletedTasks int `env:"MAX_COMPLETED_TASKS,default=100" description:"Maximum number of completed tasks to retain (0 = unlimited)"`
MaxFailedTasks int `env:"MAX_FAILED_TASKS,default=50" description:"Maximum number of failed tasks to retain (0 = unlimited)"`
CleanupInterval time.Duration `env:"CLEANUP_INTERVAL,default=5m" description:"How often to run cleanup (0 = manual cleanup only)"`
}
TaskRetentionConfig defines how many completed and failed tasks to retain
type TelemetryConfig ¶
type TelemetryConfig struct {
Enable bool `env:"ENABLE,default=false" description:"Enable telemetry collection"`
MetricsConfig MetricsConfig `env:",prefix=METRICS_"`
TraceConfig TraceConfig `env:",prefix=TRACE_"`
LogConfig LogConfig `env:",prefix=LOG_"`
// AttrSessionIDKey is the span-attribute and baggage-member key used for the
// session id. Defaults to the OTel semantic-convention key `session.id`.
AttrSessionIDKey string `env:"ATTR_SESSION_ID_KEY,default=session.id" description:"Span attribute and baggage member key for the session id"`
// AttrToolCallIDKey is the span-attribute and baggage-member key used for the
// tool call id. Defaults to the OTel semantic-convention key `gen_ai.tool.call.id`.
AttrToolCallIDKey string `` /* 128-byte string literal not displayed */
}
TelemetryConfig holds telemetry configuration
func (TelemetryConfig) SessionIDKey ¶ added in v0.23.0
func (t TelemetryConfig) SessionIDKey() string
SessionIDKey returns the configured session-id attribute/baggage key, falling back to the default when unset (e.g. a config built directly, not loaded).
func (TelemetryConfig) ToolCallIDKey ¶ added in v0.23.0
func (t TelemetryConfig) ToolCallIDKey() string
ToolCallIDKey returns the configured tool-call-id attribute/baggage key, falling back to the default when unset.
type ToolBoxConfig ¶ added in v0.15.0
type ToolBoxConfig struct {
EnableCreateArtifact bool `env:"CREATE_ARTIFACT,default=false" description:"Enable create_artifact tool for autonomous artifact creation"`
}
ToolBoxConfig defines configuration options for creating a DefaultToolBox
type TraceConfig ¶ added in v0.22.0
type TraceConfig struct {
Endpoint string `env:"ENDPOINT,default=http://localhost:4318" description:"OTLP trace endpoint URL"`
Headers map[string]string `env:"HEADERS" description:"Custom headers for OTLP trace export"`
}
TraceConfig holds OTLP trace exporter configuration. Trace export is gated by the top-level TELEMETRY_ENABLE and the OTEL_TRACES_EXPORTER selection, not by a per-signal enable flag.