config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TaskTimeout

func TaskTimeout(cfg *Config) time.Duration

TaskTimeout returns the per-task deadline derived from cfg.

Types

type Config

type Config struct {
	// Provider selects the LLM backend (e.g. "anthropic"). Set via AGENT_PROVIDER.
	// Defaults to "anthropic".
	Provider         string
	Model            string
	SystemPrompt     string
	MCPServers       []MCPServerConfig
	MaxTokensPerCall int
	TimeoutSeconds   int
	TaskQueueURL     string
	// StreamChannelURL is the connection URL for the StreamChannel backend.
	// Defaults to TaskQueueURL when not set, so the same backend serves both.
	StreamChannelURL string
	ValidatorPrompt  string
	// MaxRetries is the number of times a failed task is requeued before dead-lettering.
	// Set via AGENT_MAX_RETRIES. Defaults to 3.
	MaxRetries int
	// MaxConcurrentTasks is the maximum number of tasks processed in parallel.
	// Set via AGENT_MAX_CONCURRENT_TASKS. Defaults to 5.
	MaxConcurrentTasks int
	// WebhookTools is the list of inline HTTP tools injected by the operator.
	// Set via AGENT_WEBHOOK_TOOLS (JSON array).
	WebhookTools []WebhookToolConfig
	// TeamRoutes maps role names to queue URLs for the delegate() built-in tool.
	// Set via AGENT_TEAM_ROUTES (JSON object: {"role": "queue-url"}).
	// Only present when the agent is a member of an ArkTeam.
	TeamRoutes map[string]string
	// Namespace is the Kubernetes namespace this agent pod runs in.
	// Set via AGENT_NAMESPACE (downward API). Used for OTel metric labels.
	Namespace string
	// AgentName is the name of the ArkAgent CR this pod belongs to.
	// Set via AGENT_NAME. Used for OTel metric labels.
	AgentName string
	// TeamRole is the role this agent plays within an ArkTeam.
	// Set via AGENT_TEAM_ROLE. Empty when not in a team.
	TeamRole string
	// TeamName is the name of the ArkTeam this agent belongs to.
	// Set via AGENT_TEAM_NAME. Empty when not in a team.
	TeamName string
	// DailyTokenLimit is the rolling 24-hour token budget for this agent pod.
	// 0 means no limit. Set via AGENT_DAILY_TOKEN_LIMIT (injected by operator
	// from spec.limits.maxDailyTokens).
	DailyTokenLimit int64
}

Config holds all runtime configuration for an agent pod. All fields are populated from environment variables injected by the operator. Provider-specific credentials (e.g. ANTHROPIC_API_KEY) are read directly by each LLMProvider implementation, not stored here.

func Load

func Load() (*Config, error)

Load reads agent configuration from environment variables.

type MCPServerConfig

type MCPServerConfig struct {
	Name string `json:"name"`
	URL  string `json:"url"`

	// AuthType is "none" (default), "bearer", or "mtls".
	AuthType string `json:"authType,omitempty"`

	// TokenEnvVar is the name of the environment variable containing the bearer token.
	// The operator injects a SecretKeyRef env var with this name; the agent reads it here.
	// Only set when AuthType is "bearer".
	TokenEnvVar string `json:"tokenEnvVar,omitempty"`

	// CertFile and KeyFile are absolute paths inside the pod to the mTLS client certificate
	// and private key. The operator mounts the referenced k8s Secret at these paths.
	// Only set when AuthType is "mtls".
	CertFile string `json:"certFile,omitempty"`
	KeyFile  string `json:"keyFile,omitempty"`
}

MCPServerConfig holds the connection details for one MCP tool server. Serialized into AGENT_MCP_SERVERS by the operator; read by the agent runtime at startup. Secret values are never included — only env var names and file paths are carried here.

type WebhookToolConfig

type WebhookToolConfig struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	URL         string `json:"url"`
	// Method is the HTTP method (GET, POST, PUT, PATCH). Defaults to POST.
	Method string `json:"method"`
	// InputSchema is a JSON Schema string describing the tool's input parameters.
	InputSchema string `json:"inputSchema"`
}

WebhookToolConfig defines an inline HTTP tool injected by the operator via AGENT_WEBHOOK_TOOLS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL