1 - Environment Variables Reference
Complete reference for all environment variables used by AgentHub’s unified abstractions for configuration and observability.
Environment Variables Reference
This reference documents all environment variables used by AgentHub’s unified abstraction system. All components automatically load these variables for configuration.
Core Configuration
Broker Connection
| Variable | Default | Description | Used By | 
|---|
| AGENTHUB_BROKER_ADDR | localhost | Broker server hostname or IP address | Agents | 
| AGENTHUB_BROKER_PORT | 50051 | Broker gRPC port number | Agents | 
| AGENTHUB_GRPC_PORT | :50051 | Server listen address (for broker) | Broker | 
Example:
export AGENTHUB_BROKER_ADDR="production-broker.example.com"
export AGENTHUB_BROKER_PORT="50051"
export AGENTHUB_GRPC_PORT=":50051"
Health Monitoring
| Variable | Default | Description | Used By | 
|---|
| BROKER_HEALTH_PORT | 8080 | Broker health check endpoint port | Broker | 
| PUBLISHER_HEALTH_PORT | 8081 | Publisher health check endpoint port | Publishers | 
| SUBSCRIBER_HEALTH_PORT | 8082 | Subscriber health check endpoint port | Subscribers | 
Health Endpoints Available:
- http://localhost:8080/health- Health check
- http://localhost:8080/metrics- Prometheus metrics
- http://localhost:8080/ready- Readiness check
Example:
export BROKER_HEALTH_PORT="8080"
export PUBLISHER_HEALTH_PORT="8081"
export SUBSCRIBER_HEALTH_PORT="8082"
Observability Configuration
Distributed Tracing
| Variable | Default | Description | Used By | 
|---|
| JAEGER_ENDPOINT | 127.0.0.1:4317 | Jaeger OTLP endpoint for traces | All components | 
| SERVICE_NAME | agenthub-service | Service name for tracing | All components | 
| SERVICE_VERSION | 1.0.0 | Service version for telemetry | All components | 
Example:
export JAEGER_ENDPOINT="http://jaeger.example.com:14268/api/traces"
export SERVICE_NAME="my-agenthub-app"
export SERVICE_VERSION="2.1.0"
Jaeger Integration:
- When JAEGER_ENDPOINTis set: Automatic tracing enabled
- When empty or unset: Tracing disabled (minimal overhead)
- Supports both gRPC (4317) and HTTP (14268) endpoints
Metrics Collection
| Variable | Default | Description | Used By | 
|---|
| PROMETHEUS_PORT | 9090 | Prometheus server port | Observability stack | 
| GRAFANA_PORT | 3333 | Grafana dashboard port | Observability stack | 
| ALERTMANAGER_PORT | 9093 | AlertManager port | Observability stack | 
Example:
export PROMETHEUS_PORT="9090"
export GRAFANA_PORT="3333"
export ALERTMANAGER_PORT="9093"
OpenTelemetry Collector
| Variable | Default | Description | Used By | 
|---|
| OTLP_GRPC_PORT | 4320 | OTLP Collector gRPC port | Observability stack | 
| OTLP_HTTP_PORT | 4321 | OTLP Collector HTTP port | Observability stack | 
Example:
export OTLP_GRPC_PORT="4320"
export OTLP_HTTP_PORT="4321"
Service Configuration
General Settings
| Variable | Default | Description | Used By | 
|---|
| ENVIRONMENT | development | Deployment environment | All components | 
| LOG_LEVEL | INFO | Logging level (DEBUG, INFO, WARN, ERROR) | All components | 
Example:
export ENVIRONMENT="production"
export LOG_LEVEL="WARN"
Environment-Specific Configurations
Development Environment
# .envrc for development
export AGENTHUB_BROKER_ADDR="localhost"
export AGENTHUB_BROKER_PORT="50051"
export AGENTHUB_GRPC_PORT=":50051"
# Health ports
export BROKER_HEALTH_PORT="8080"
export PUBLISHER_HEALTH_PORT="8081"
export SUBSCRIBER_HEALTH_PORT="8082"
# Observability (local stack)
export JAEGER_ENDPOINT="http://localhost:14268/api/traces"
export PROMETHEUS_PORT="9090"
export GRAFANA_PORT="3333"
# Service metadata
export SERVICE_NAME="agenthub-dev"
export SERVICE_VERSION="dev"
export ENVIRONMENT="development"
export LOG_LEVEL="DEBUG"
Staging Environment
# .envrc for staging
export AGENTHUB_BROKER_ADDR="staging-broker.example.com"
export AGENTHUB_BROKER_PORT="50051"
# Health ports (non-conflicting)
export BROKER_HEALTH_PORT="8080"
export PUBLISHER_HEALTH_PORT="8081"
export SUBSCRIBER_HEALTH_PORT="8082"
# Observability (staging stack)
export JAEGER_ENDPOINT="http://staging-jaeger.example.com:14268/api/traces"
export PROMETHEUS_PORT="9090"
export GRAFANA_PORT="3333"
# Service metadata
export SERVICE_NAME="agenthub-staging"
export SERVICE_VERSION="1.2.0-rc1"
export ENVIRONMENT="staging"
export LOG_LEVEL="INFO"
Production Environment
# .envrc for production
export AGENTHUB_BROKER_ADDR="prod-broker.example.com"
export AGENTHUB_BROKER_PORT="50051"
# Health ports
export BROKER_HEALTH_PORT="8080"
export PUBLISHER_HEALTH_PORT="8081"
export SUBSCRIBER_HEALTH_PORT="8082"
# Observability (production stack)
export JAEGER_ENDPOINT="http://jaeger.prod.example.com:14268/api/traces"
export PROMETHEUS_PORT="9090"
export GRAFANA_PORT="3333"
export ALERTMANAGER_PORT="9093"
# Service metadata
export SERVICE_NAME="agenthub-prod"
export SERVICE_VERSION="1.2.0"
export ENVIRONMENT="production"
export LOG_LEVEL="WARN"
Configuration Loading
Automatic Loading by Unified Abstractions
The unified abstractions automatically load environment variables:
// Automatic configuration loading
config := agenthub.NewGRPCConfig("my-component")
// Results in:
// config.BrokerAddr = "localhost:50051" (AGENTHUB_BROKER_ADDR + AGENTHUB_BROKER_PORT)
// config.ServerAddr = ":50051" (AGENTHUB_GRPC_PORT)
// config.HealthPort = "8080" (BROKER_HEALTH_PORT)
// config.ComponentName = "my-component" (from parameter)
Using direnv (Recommended)
- Install direnv: https://direnv.net/docs/installation.html 
- Create .envrc file: - # Create .envrc in project root
cat > .envrc << 'EOF'
export AGENTHUB_BROKER_ADDR="localhost"
export AGENTHUB_BROKER_PORT="50051"
export JAEGER_ENDPOINT="http://localhost:14268/api/traces"
export SERVICE_NAME="my-agenthub-app"
EOF
 
- Allow direnv: 
- Automatic loading: Variables load automatically when entering directory 
Manual Loading
# Source variables manually
source .envrc
# Or set individually
export AGENTHUB_BROKER_ADDR="localhost"
export JAEGER_ENDPOINT="http://localhost:14268/api/traces"
Configuration Validation
Required Variables
Minimal configuration (all have defaults):
- No variables are strictly required
- Defaults work for local development
Production recommendations:
- Set JAEGER_ENDPOINTfor tracing
- Set SERVICE_NAMEfor identification
- Set ENVIRONMENTto “production”
- Configure unique health ports if running multiple services
Configuration Verification
Check loaded configuration:
config := agenthub.NewGRPCConfig("test")
fmt.Printf("Broker: %s\n", config.BrokerAddr)
fmt.Printf("Health: %s\n", config.HealthPort)
fmt.Printf("Component: %s\n", config.ComponentName)
Verify health endpoints:
# Check if configuration is working
curl http://localhost:8080/health
curl http://localhost:8081/health  # Publisher
curl http://localhost:8082/health  # Subscriber
Verify tracing:
- Open Jaeger UI: http://localhost:16686
- Look for traces from your service name
- Check spans are being created
Common Patterns
Docker Compose
# docker-compose.yml
version: '3.8'
services:
  broker:
    build: .
    command: go run broker/main.go
    environment:
      - AGENTHUB_GRPC_PORT=:50051
      - BROKER_HEALTH_PORT=8080
      - JAEGER_ENDPOINT=http://jaeger:14268/api/traces
      - SERVICE_NAME=agenthub-broker
    ports:
      - "50051:50051"
      - "8080:8080"
  publisher:
    build: .
    command: go run agents/publisher/main.go
    environment:
      - AGENTHUB_BROKER_ADDR=broker
      - AGENTHUB_BROKER_PORT=50051
      - PUBLISHER_HEALTH_PORT=8081
      - JAEGER_ENDPOINT=http://jaeger:14268/api/traces
      - SERVICE_NAME=agenthub-publisher
    ports:
      - "8081:8081"
Kubernetes ConfigMap
# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: agenthub-config
data:
  AGENTHUB_BROKER_ADDR: "agenthub-broker.default.svc.cluster.local"
  AGENTHUB_BROKER_PORT: "50051"
  JAEGER_ENDPOINT: "http://jaeger.observability.svc.cluster.local:14268/api/traces"
  SERVICE_NAME: "agenthub-k8s"
  SERVICE_VERSION: "1.0.0"
  ENVIRONMENT: "production"
  LOG_LEVEL: "INFO"
---
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: agenthub-publisher
spec:
  template:
    spec:
      containers:
      - name: publisher
        image: agenthub:latest
        envFrom:
        - configMapRef:
            name: agenthub-config
        env:
        - name: PUBLISHER_HEALTH_PORT
          value: "8080"
Troubleshooting
Common Issues
| Problem | Solution | 
|---|
| Agent can’t connect to broker | Check AGENTHUB_BROKER_ADDRandAGENTHUB_BROKER_PORT | 
| Health endpoint not accessible | Verify *_HEALTH_PORTvariables and port availability | 
| No traces in Jaeger | Set JAEGER_ENDPOINTand ensure Jaeger is running | 
| Port conflicts | Use different ports for each component’s health endpoints | 
| Configuration not loading | Ensure variables are exported, check with printenv | 
Debug Configuration
Check environment variables:
# List all AgentHub variables
printenv | grep AGENTHUB
# List all observability variables
printenv | grep -E "(JAEGER|SERVICE|PROMETHEUS|GRAFANA)"
# Check specific variable
echo $AGENTHUB_BROKER_ADDR
Test configuration:
# Quick test with temporary override
AGENTHUB_BROKER_ADDR=test-broker go run agents/publisher/main.go
# Verify health endpoint responds
curl -f http://localhost:8080/health || echo "Health check failed"
Configuration Precedence
- Environment variables (highest priority)
- Default values (from code)
Example: If AGENTHUB_BROKER_ADDR is set, it overrides the default “localhost”
This environment variable reference provides comprehensive documentation for configuring AgentHub using the unified abstraction system. For practical usage examples, see the Installation and Setup Tutorial and Configuration Reference.
2 - Configuration Reference
Comprehensive reference for configuring AgentHub components using the unified abstraction library with environment-based configuration.
Configuration Reference
This document provides comprehensive reference for configuring AgentHub components using the unified abstraction library with environment-based configuration.
Unified Abstraction Configuration
AgentHub uses environment variables for all configuration with the unified abstraction library providing automatic configuration setup.
Core Environment Variables
gRPC Connection Configuration
| Variable | Default | Description | 
|---|
| AGENTHUB_BROKER_ADDR | localhost | Broker server hostname or IP address | 
| AGENTHUB_BROKER_PORT | 50051 | Broker gRPC port number | 
| AGENTHUB_GRPC_PORT | :50051 | Server listen address (for broker) | 
Note: The unified abstraction automatically combines AGENTHUB_BROKER_ADDR and AGENTHUB_BROKER_PORT into a complete broker address (e.g., localhost:50051).
Health Monitoring Configuration
| Variable | Default | Description | 
|---|
| BROKER_HEALTH_PORT | 8080 | Broker health check endpoint port | 
| PUBLISHER_HEALTH_PORT | 8081 | Publisher health check endpoint port | 
| SUBSCRIBER_HEALTH_PORT | 8082 | Subscriber health check endpoint port | 
Observability Configuration
| Variable | Default | Description | 
|---|
| JAEGER_ENDPOINT | 127.0.0.1:4317 | Jaeger OTLP endpoint for distributed tracing | 
| PROMETHEUS_PORT | 9090 | Prometheus metrics collection port | 
| GRAFANA_PORT | 3333 | Grafana dashboard web interface port | 
| ALERTMANAGER_PORT | 9093 | AlertManager web interface port | 
| OTLP_GRPC_PORT | 4320 | OpenTelemetry Collector gRPC port | 
| OTLP_HTTP_PORT | 4321 | OpenTelemetry Collector HTTP port | 
| Variable | Default | Description | 
|---|
| SERVICE_VERSION | 1.0.0 | Service version for telemetry and observability | 
| ENVIRONMENT | development | Deployment environment (development, staging, production) | 
A2A Protocol Configuration
| Variable | Default | Description | 
|---|
| AGENTHUB_MESSAGE_BUFFER_SIZE | 100 | Buffer size for A2A message processing | 
| AGENTHUB_TASK_UPDATE_INTERVAL | 1s | Interval for publishing task status updates | 
| AGENTHUB_ARTIFACT_MAX_SIZE | 10MB | Maximum size for task artifacts | 
| AGENTHUB_CONTEXT_TIMEOUT | 30s | Timeout for A2A message context | 
| AGENTHUB_A2A_PROTOCOL_VERSION | 1.0 | A2A protocol version for compatibility | 
| AGENTHUB_MESSAGE_HISTORY_LIMIT | 50 | Maximum message history per task | 
Unified Abstraction Usage
Using Configuration with the Unified Abstraction
The unified abstraction library automatically loads configuration from environment variables:
// Create configuration from environment variables
config := agenthub.NewGRPCConfig("my-component")
// Configuration is automatically populated:
// - config.BrokerAddr: "localhost:50051" (combined from AGENTHUB_BROKER_ADDR + AGENTHUB_BROKER_PORT)
// - config.ServerAddr: ":50051" (from AGENTHUB_GRPC_PORT)
// - config.HealthPort: "8080" (from BROKER_HEALTH_PORT)
// - config.ComponentName: "my-component" (from parameter)
Environment Variable Loading
The recommended way to load environment variables:
Option 1: Using direnv (recommended)
# Place variables in .envrc file
direnv allow
Option 2: Source manually
Option 3: Set individual variables
export AGENTHUB_BROKER_ADDR=localhost
export AGENTHUB_BROKER_PORT=50051
export JAEGER_ENDPOINT=127.0.0.1:4317
Configuration Override Examples
You can override defaults by setting environment variables before running:
# Use different broker address
export AGENTHUB_BROKER_ADDR=remote-broker.example.com
export AGENTHUB_BROKER_PORT=9090
go run broker/main.go
# Use different health ports to avoid conflicts
export BROKER_HEALTH_PORT=8083
export PUBLISHER_HEALTH_PORT=8084
export SUBSCRIBER_HEALTH_PORT=8085
go run agents/publisher/main.go
# Use custom observability endpoints
export JAEGER_ENDPOINT=jaeger.example.com:4317
export PROMETHEUS_PORT=9091
go run broker/main.go
Configuration Best Practices
- Use .envrc for Development: Keep all environment variables in .envrcfor consistent development experience
- Override Selectively: Only override specific variables when needed, use defaults otherwise
- Environment-Specific Configs: Use different variable values for development, staging, and production
- Health Port Management: Use different health ports for each component to avoid conflicts
- Observability Integration: Always configure observability endpoints for production deployments
Legacy Configuration Migration
If migrating from previous versions of AgentHub:
Old Configuration Pattern:
// Manual server setup (deprecated)
lis, err := net.Listen("tcp", ":50051")
server := grpc.NewServer()
// ... extensive setup code
New Unified Abstraction Pattern:
// Automatic configuration from environment
config := agenthub.NewGRPCConfig("broker")
server, err := agenthub.NewAgentHubServer(config)
service := agenthub.NewAgentHubService(server)
pb.RegisterAgentHubServer(server.Server, service)
server.Start(ctx)
Command-Line Usage
Basic Commands
The unified abstraction provides simplified command execution:
agenthub-server [OPTIONS]
Options:
  -port int
        Server port (default 50051)
  -host string
        Server host (default "0.0.0.0")
  -config string
        Configuration file path
  -log-level string
        Log level: debug, info, warn, error (default "info")
  -log-file string
        Log file path (default: stdout)
  -max-connections int
        Maximum concurrent connections (default 1000)
  -channel-buffer-size int
        Channel buffer size (default 10)
  -help
        Show help message
  -version
        Show version information
Configuration File
The broker can also be configured using a YAML configuration file:
# agenthub.yaml
server:
  host: "0.0.0.0"
  port: 50051
  max_connections: 1000
  timeout: "30s"
logging:
  level: "info"
  format: "json"
  file: "/var/log/agenthub/broker.log"
performance:
  channel_buffer_size: 10
  max_message_size: "4MB"
  keepalive_time: "30s"
  keepalive_timeout: "5s"
limits:
  max_agents: 10000
  max_tasks_per_agent: 100
  memory_limit: "1GB"
security:
  tls_enabled: false
  cert_file: ""
  key_file: ""
  ca_file: ""
Loading Configuration:
agenthub-server -config /path/to/agenthub.yaml
Agent Configuration
Environment Variables
Agents can be configured using environment variables:
Connection Configuration
| Variable | Default | Description | 
|---|
| AGENTHUB_BROKER_ADDRESS | localhost:50051 | Broker server address | 
| AGENTHUB_AGENT_ID | Generated | Unique agent identifier | 
| AGENTHUB_CONNECTION_TIMEOUT | 10s | Connection timeout | 
| AGENTHUB_RETRY_ATTEMPTS | 3 | Connection retry attempts | 
| AGENTHUB_RETRY_DELAY | 1s | Delay between retries | 
Task Processing Configuration
| Variable | Default | Description | 
|---|
| AGENTHUB_MAX_CONCURRENT_TASKS | 5 | Maximum concurrent task processing | 
| AGENTHUB_TASK_TIMEOUT | 300s | Default task timeout | 
| AGENTHUB_PROGRESS_INTERVAL | 5s | Progress reporting interval | 
| AGENTHUB_TASK_TYPES | "" | Comma-separated list of supported task types | 
Logging Configuration
| Variable | Default | Description | 
|---|
| AGENTHUB_AGENT_LOG_LEVEL | info | Agent logging level | 
| AGENTHUB_AGENT_LOG_FORMAT | text | Agent log format | 
| AGENTHUB_AGENT_LOG_FILE | "" | Agent log file path | 
Agent Configuration Examples
Publisher Configuration
package main
import (
    "os"
    "strconv"
    "time"
)
type PublisherConfig struct {
    BrokerAddress    string
    AgentID          string
    ConnectionTimeout time.Duration
    RetryAttempts    int
    RetryDelay       time.Duration
    LogLevel         string
}
func LoadPublisherConfig() *PublisherConfig {
    config := &PublisherConfig{
        BrokerAddress:    getEnv("AGENTHUB_BROKER_ADDRESS", "localhost:50051"),
        AgentID:          getEnv("AGENTHUB_AGENT_ID", generateAgentID()),
        ConnectionTimeout: getDuration("AGENTHUB_CONNECTION_TIMEOUT", "10s"),
        RetryAttempts:    getInt("AGENTHUB_RETRY_ATTEMPTS", 3),
        RetryDelay:       getDuration("AGENTHUB_RETRY_DELAY", "1s"),
        LogLevel:         getEnv("AGENTHUB_AGENT_LOG_LEVEL", "info"),
    }
    return config
}
func getEnv(key, defaultValue string) string {
    if value := os.Getenv(key); value != "" {
        return value
    }
    return defaultValue
}
func getInt(key string, defaultValue int) int {
    if value := os.Getenv(key); value != "" {
        if i, err := strconv.Atoi(value); err == nil {
            return i
        }
    }
    return defaultValue
}
func getDuration(key string, defaultValue string) time.Duration {
    if value := os.Getenv(key); value != "" {
        if d, err := time.ParseDuration(value); err == nil {
            return d
        }
    }
    d, _ := time.ParseDuration(defaultValue)
    return d
}
Subscriber Configuration
type SubscriberConfig struct {
    BrokerAddress      string
    AgentID            string
    MaxConcurrentTasks int
    TaskTimeout        time.Duration
    ProgressInterval   time.Duration
    SupportedTaskTypes []string
    LogLevel           string
}
func LoadSubscriberConfig() *SubscriberConfig {
    taskTypesStr := getEnv("AGENTHUB_TASK_TYPES", "")
    var taskTypes []string
    if taskTypesStr != "" {
        taskTypes = strings.Split(taskTypesStr, ",")
        for i, taskType := range taskTypes {
            taskTypes[i] = strings.TrimSpace(taskType)
        }
    }
    config := &SubscriberConfig{
        BrokerAddress:      getEnv("AGENTHUB_BROKER_ADDRESS", "localhost:50051"),
        AgentID:            getEnv("AGENTHUB_AGENT_ID", generateAgentID()),
        MaxConcurrentTasks: getInt("AGENTHUB_MAX_CONCURRENT_TASKS", 5),
        TaskTimeout:        getDuration("AGENTHUB_TASK_TIMEOUT", "300s"),
        ProgressInterval:   getDuration("AGENTHUB_PROGRESS_INTERVAL", "5s"),
        SupportedTaskTypes: taskTypes,
        LogLevel:           getEnv("AGENTHUB_AGENT_LOG_LEVEL", "info"),
    }
    return config
}
Agent Configuration File
Agents can also use configuration files:
# agent.yaml
agent:
  id: "data_processor_001"
  broker_address: "broker.example.com:50051"
  connection_timeout: "10s"
  retry_attempts: 3
  retry_delay: "1s"
task_processing:
  max_concurrent_tasks: 5
  task_timeout: "300s"
  progress_interval: "5s"
  supported_task_types:
    - "data_analysis"
    - "data_transformation"
    - "data_validation"
logging:
  level: "info"
  format: "json"
  file: "/var/log/agenthub/agent.log"
health:
  port: 8080
  endpoint: "/health"
  check_interval: "30s"
Security Configuration
TLS Configuration
Broker TLS Setup
# broker configuration
security:
  tls_enabled: true
  cert_file: "/etc/agenthub/certs/server.crt"
  key_file: "/etc/agenthub/certs/server.key"
  ca_file: "/etc/agenthub/certs/ca.crt"
  client_auth: "require_and_verify"
Agent TLS Setup
// Agent TLS connection
func createTLSConnection(address string) (*grpc.ClientConn, error) {
    config := &tls.Config{
        ServerName: "agenthub-broker",
        // Load client certificates if needed
    }
    creds := credentials.NewTLS(config)
    conn, err := grpc.Dial(address, grpc.WithTransportCredentials(creds))
    if err != nil {
        return nil, fmt.Errorf("failed to connect with TLS: %v", err)
    }
    return conn, nil
}
Authentication Configuration
JWT Authentication
# broker configuration
security:
  auth_enabled: true
  auth_method: "jwt"
  jwt_secret: "your-secret-key"
  jwt_issuer: "agenthub-broker"
  jwt_expiry: "24h"
// Agent authentication
type AuthenticatedAgent struct {
    client   pb.AgentHubClient
    token    string
    agentID  string
}
func (a *AuthenticatedAgent) authenticate() error {
    // Add authentication token to context
    ctx := metadata.AppendToOutgoingContext(context.Background(),
        "authorization", "Bearer "+a.token)
    // Use authenticated context for A2A requests
    _, err := a.client.PublishMessage(ctx, request)
    return err
}
Production Configuration Examples
# production-broker.yaml
server:
  host: "0.0.0.0"
  port: 50051
  max_connections: 5000
  timeout: "60s"
performance:
  channel_buffer_size: 50
  max_message_size: "16MB"
  keepalive_time: "10s"
  keepalive_timeout: "3s"
limits:
  max_agents: 50000
  max_tasks_per_agent: 500
  memory_limit: "8GB"
logging:
  level: "warn"
  format: "json"
  file: "/var/log/agenthub/broker.log"
security:
  tls_enabled: true
  cert_file: "/etc/ssl/certs/agenthub.crt"
  key_file: "/etc/ssl/private/agenthub.key"
Cluster Agent Configuration
# cluster-agent.yaml
agent:
  id: "${HOSTNAME}_${POD_ID}"
  broker_address: "agenthub-broker.agenthub.svc.cluster.local:50051"
  connection_timeout: "15s"
  retry_attempts: 5
  retry_delay: "2s"
task_processing:
  max_concurrent_tasks: 10
  task_timeout: "1800s"  # 30 minutes
  progress_interval: "10s"
logging:
  level: "info"
  format: "json"
  file: "stdout"
health:
  port: 8080
  endpoint: "/health"
  check_interval: "30s"
metrics:
  enabled: true
  port: 9090
  endpoint: "/metrics"
Environment-Specific Configurations
Development Environment
# .env.development
AGENTHUB_PORT=50051
AGENTHUB_LOG_LEVEL=debug
AGENTHUB_LOG_FORMAT=text
AGENTHUB_MAX_CONNECTIONS=100
AGENTHUB_CHANNEL_BUFFER_SIZE=5
# Agent settings
AGENTHUB_BROKER_ADDRESS=localhost:50051
AGENTHUB_MAX_CONCURRENT_TASKS=2
AGENTHUB_TASK_TIMEOUT=60s
AGENTHUB_AGENT_LOG_LEVEL=debug
Staging Environment
# .env.staging
AGENTHUB_PORT=50051
AGENTHUB_LOG_LEVEL=info
AGENTHUB_LOG_FORMAT=json
AGENTHUB_MAX_CONNECTIONS=1000
AGENTHUB_CHANNEL_BUFFER_SIZE=20
# Security
AGENTHUB_TLS_ENABLED=true
AGENTHUB_CERT_FILE=/etc/certs/staging.crt
AGENTHUB_KEY_FILE=/etc/certs/staging.key
# Agent settings
AGENTHUB_BROKER_ADDRESS=staging-broker.example.com:50051
AGENTHUB_MAX_CONCURRENT_TASKS=5
AGENTHUB_TASK_TIMEOUT=300s
Production Environment
# .env.production
AGENTHUB_PORT=50051
AGENTHUB_LOG_LEVEL=warn
AGENTHUB_LOG_FORMAT=json
AGENTHUB_LOG_FILE=/var/log/agenthub/broker.log
AGENTHUB_MAX_CONNECTIONS=5000
AGENTHUB_CHANNEL_BUFFER_SIZE=50
# Security
AGENTHUB_TLS_ENABLED=true
AGENTHUB_CERT_FILE=/etc/ssl/certs/agenthub.crt
AGENTHUB_KEY_FILE=/etc/ssl/private/agenthub.key
AGENTHUB_CA_FILE=/etc/ssl/certs/ca.crt
# Performance
AGENTHUB_MAX_MESSAGE_SIZE=16MB
AGENTHUB_KEEPALIVE_TIME=10s
AGENTHUB_MEMORY_LIMIT=8GB
# Agent settings
AGENTHUB_BROKER_ADDRESS=agenthub-prod.example.com:50051
AGENTHUB_MAX_CONCURRENT_TASKS=10
AGENTHUB_TASK_TIMEOUT=1800s
AGENTHUB_CONNECTION_TIMEOUT=15s
AGENTHUB_RETRY_ATTEMPTS=5
Configuration Validation
Broker Configuration Validation
type BrokerConfig struct {
    Port             int           `yaml:"port" validate:"min=1,max=65535"`
    Host             string        `yaml:"host" validate:"required"`
    MaxConnections   int           `yaml:"max_connections" validate:"min=1"`
    Timeout          time.Duration `yaml:"timeout" validate:"min=1s"`
    ChannelBufferSize int          `yaml:"channel_buffer_size" validate:"min=1"`
}
func (c *BrokerConfig) Validate() error {
    validate := validator.New()
    return validate.Struct(c)
}
Agent Configuration Validation
type AgentConfig struct {
    BrokerAddress      string        `yaml:"broker_address" validate:"required"`
    AgentID            string        `yaml:"agent_id" validate:"required,min=1,max=64"`
    MaxConcurrentTasks int           `yaml:"max_concurrent_tasks" validate:"min=1,max=100"`
    TaskTimeout        time.Duration `yaml:"task_timeout" validate:"min=1s"`
}
func (c *AgentConfig) Validate() error {
    validate := validator.New()
    if err := validate.Struct(c); err != nil {
        return err
    }
    // Custom validation
    if !strings.Contains(c.BrokerAddress, ":") {
        return errors.New("broker_address must include port")
    }
    return nil
}
This comprehensive configuration reference covers all aspects of configuring AgentHub for different environments and use cases.