config

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 14

Documentation

Overview

Package config provides configuration management for PromptKit Arena.

This package handles YAML-based configuration loading and validation for:

  • Test scenarios and conversation definitions
  • LLM provider settings and credentials
  • Prompt template configurations
  • Self-play personas and role assignments
  • Default parameters and execution settings

Configuration files are loaded from disk with support for file references, allowing modular organization of scenarios, providers, and prompts.

The package is organized into:

  • types.go: Core type definitions (Config, Scenario, Provider, etc.)
  • loader.go: Loading functions for config files
  • helpers.go: Utility functions for path resolution
  • persona.go: Self-play persona loading
  • validator.go: Configuration validation

Index

Constants

View Source
const (
	LogLevelTrace = "trace"
	LogLevelDebug = "debug"
	LogLevelInfo  = "info"
	LogLevelWarn  = "warn"
	LogLevelError = "error"
)

LogLevel constants for programmatic use.

View Source
const (
	LogFormatJSON = "json"
	LogFormatText = "text"
)

LogFormat constants for programmatic use.

View Source
const (
	RoleLLM       = "llm"
	RoleTTS       = "tts"
	RoleSTT       = "stt"
	RoleEmbedding = "embedding"
	RoleImage     = "image"
	// RoleVideo marks a video-generation provider. The abstraction
	// (base.VideoProvider) exists so the video__generate tool can resolve a
	// provider from the pool, but no concrete video provider ships yet — a
	// role: video declaration only succeeds once a video provider type is
	// registered in the provider factory.
	RoleVideo = "video"
	// RoleInference covers providers implementing the runtime/classify task
	// interfaces (audio/text/image/video classifiers + embedders). A single
	// inference provider can satisfy several of them — the HuggingFace
	// backend covers four — so engine wiring registers each backend against
	// every interface it implements rather than per-role-per-task.
	RoleInference = "inference"
)

Role values for the Provider.Role field. Defaults to LLM when unset so existing provider yamls (which predate the field) keep working with no migration.

Renamed from "capability" 2026-05-18. The field always meant "what role does this provider fill in the arena" (llm/tts/stt), not "what can this provider do" — the older name collided with the per-model feature-flag list (Provider.Capabilities). One word per concept now.

View Source
const (
	// APIVersion is the Kubernetes-style API version for PromptKit configs
	APIVersion = "promptkit.altairalabs.ai/v1alpha1"

	// SchemaVersion is the version string used in schema URLs and paths
	SchemaVersion = "v1alpha1"
)

Version constants for PromptKit These are the single source of truth for versioning across the codebase

View Source
const SchemaBaseURL = "https://promptkit.altairalabs.ai/schemas/v1alpha1"

SchemaBaseURL is the base URL for PromptKit JSON schemas

View Source
const SchemaLocalPath = "schemas/v1alpha1"

SchemaLocalPath is the path to local schema files (relative to repo root)

Variables

View Source
var SchemaFallbackDisabled atomic.Bool

SchemaFallbackDisabled controls whether local schema fallback is suppressed. When true (non-default), the loader will not fall back to local schemas on remote fetch failure. Uses atomic.Bool for safe concurrent access across goroutines and test init functions.

View Source
var SchemaValidationDisabled atomic.Bool

SchemaValidationDisabled controls whether schema validation is skipped. When true (non-default), schema validation is bypassed (useful for testing or unpublished schemas). Uses atomic.Bool for safe concurrent access across goroutines and test init functions.

Functions

func LoadSimpleK8sManifest added in v1.5.4

func LoadSimpleK8sManifest[T K8sManifest](filename, expectedKind string) (T, error)

LoadSimpleK8sManifest is a generic loader for K8s-style manifest files. This is used for simple config types (Scenario, Provider, Eval, Tool, Persona) that don't support legacy formats.

func ResolveFilePath

func ResolveFilePath(basePath, filePath string) string

ResolveFilePath resolves a file path relative to a base directory

func ResolveOutputPath

func ResolveOutputPath(outDir, filename string) string

ResolveOutputPath resolves an output file path relative to the output directory. If the filename is an absolute path, it is returned as-is. If the filename is empty, an empty string is returned. Otherwise, the filename is joined with the output directory.

func ValidateArenaConfig added in v1.1.2

func ValidateArenaConfig(yamlData []byte) error

ValidateArenaConfig validates an Arena configuration against its schema.

func ValidateConfig added in v1.3.2

func ValidateConfig(configType ConfigType, yamlData []byte) error

ValidateConfig validates YAML data against the JSON schema for the given ConfigType. It returns a formatted error listing all schema violations, or nil if the data is valid.

func ValidateEval added in v1.1.9

func ValidateEval(yamlData []byte) error

ValidateEval validates an Eval configuration against its schema.

func ValidatePersona added in v1.1.2

func ValidatePersona(yamlData []byte) error

ValidatePersona validates a Persona configuration against its schema.

func ValidatePromptConfig added in v1.1.2

func ValidatePromptConfig(yamlData []byte) error

ValidatePromptConfig validates a PromptConfig configuration against its schema.

func ValidateProvider added in v1.1.2

func ValidateProvider(yamlData []byte) error

ValidateProvider validates a Provider configuration against its schema.

func ValidateScenario added in v1.1.2

func ValidateScenario(yamlData []byte) error

ValidateScenario validates a Scenario configuration against its schema.

func ValidateTool added in v1.1.2

func ValidateTool(yamlData []byte) error

ValidateTool validates a Tool configuration against its schema.

Types

type AuthSpec added in v1.4.7

type AuthSpec struct {
	Type string `yaml:"type,omitempty"` // "api_key" | "oauth" | etc.
	Env  string `yaml:"env,omitempty"`  // env var name for api_key auth
}

AuthSpec describes how the provider authenticates.

type CapabilitySpec added in v1.4.7

type CapabilitySpec struct {
	Type     base.ProviderType
	Model    string
	Defaults map[string]any
	Pricing  *base.PricingDescriptor
}

CapabilitySpec is one capability entry under a ProviderSpec.

type ConfigType added in v1.1.2

type ConfigType string

ConfigType represents the type of configuration file

const (
	ConfigTypeArena        ConfigType = "arena"
	ConfigTypeScenario     ConfigType = "scenario"
	ConfigTypeEval         ConfigType = "eval"
	ConfigTypeProvider     ConfigType = "provider"
	ConfigTypePromptConfig ConfigType = "promptconfig"
	ConfigTypeTool         ConfigType = "tool"
	ConfigTypePersona      ConfigType = "persona"
)

func DetectConfigType added in v1.1.2

func DetectConfigType(yamlData []byte) (ConfigType, error)

DetectConfigType attempts to detect the configuration type from YAML data

type CredentialConfig added in v1.1.9

type CredentialConfig = credentials.CredentialConfig

CredentialConfig is an alias for credentials.CredentialConfig. The canonical type lives in runtime/credentials to break the circular module dependency between pkg and runtime.

type EmbeddingProviderConfig added in v1.4.5

type EmbeddingProviderConfig struct {
	// ID is a stable identifier used to reference this provider from
	// other config blocks (e.g. tool_selector via SelectorContext).
	// Empty falls back to the type name.
	ID string `yaml:"id,omitempty" json:"id,omitempty" jsonschema:"title=ID,description=Stable identifier"`
	// Type selects the implementation: openai, gemini, voyageai, ollama.
	//nolint:lll // jsonschema tags require single line
	Type string `` /* 133-byte string literal not displayed */
	// Model overrides the provider's default embedding model.
	Model string `yaml:"model,omitempty" json:"model,omitempty" jsonschema:"title=Model,description=Embedding model name"`
	// BaseURL overrides the provider's default API endpoint. Useful for
	// self-hosted deployments and OpenAI-compatible gateways.
	//nolint:lll // jsonschema tags require single line
	BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty" jsonschema:"title=BaseURL,description=API endpoint override"`
	// Credential names how to obtain the API key. Same shape as the
	// chat-provider credential block.
	//nolint:lll // jsonschema tags require single line
	Credential *CredentialConfig `yaml:"credential,omitempty" json:"credential,omitempty" jsonschema:"title=Credential,description=API key resolution"`
	// Platform identifies hyperscaler hosting (azure/bedrock/vertex) for
	// keyless auth, mirroring the chat Provider.Platform block. Only
	// "azure" (with an OpenAI-wire provider) is functional today.
	//nolint:lll // jsonschema tags require single line
	Platform *PlatformConfig `` /* 160-byte string literal not displayed */
	// AdditionalConfig carries provider-specific extras (e.g. VoyageAI
	// dimensions, input_type). Each provider documents its own keys.
	//nolint:lll // jsonschema tags require single line
	AdditionalConfig map[string]any `` /* 143-byte string literal not displayed */
}

EmbeddingProviderConfig declares an embedding provider — the declarative analog of programmatic providers.NewEmbeddingProvider constructors. Resolved by sdk.WithRuntimeConfig and stored by ID for later lookup; the first declared entry becomes the default retrieval and selector-context provider unless one is set programmatically via WithContextRetrieval.

type ExecBinding added in v1.3.12

type ExecBinding struct {
	// Command is the path to the executable, resolved relative to the config file.
	Command string `yaml:"command" json:"command" jsonschema:"title=Command,description=Path to the executable"`
	// Runtime selects the execution mode: "exec" (one-shot, default) or "server" (long-running JSON-RPC).
	//nolint:lll // jsonschema tags require single line
	Runtime string `` /* 138-byte string literal not displayed */
	// Env lists environment variable names required by the process. Values come from the host environment.
	//nolint:lll // jsonschema tags require single line
	Env []string `yaml:"env,omitempty" json:"env,omitempty" jsonschema:"title=Env,description=Required environment variable names"`
	// Args are additional arguments passed to the command.
	//nolint:lll // jsonschema tags require single line
	Args []string `yaml:"args,omitempty" json:"args,omitempty" jsonschema:"title=Args,description=Additional command arguments"`
	// TimeoutMs is the per-invocation timeout in milliseconds.
	//nolint:lll // jsonschema tags require single line
	TimeoutMs int `` /* 133-byte string literal not displayed */
	// Sandbox names a sandbox backend declared under spec.sandboxes.
	// When empty the built-in "direct" backend is used. Only applies to
	// exec hooks; ignored for exec tools and exec eval handlers (which
	// reuse this struct via embedding but do not yet support sandboxing).
	//nolint:lll // jsonschema tags require single line
	Sandbox string `` /* 136-byte string literal not displayed */
}

ExecBinding defines how to invoke an external process for tool or eval execution.

type ExecHook added in v1.3.12

type ExecHook struct {
	ExecBinding `yaml:",inline"`
	// Hook identifies the hook interface: "provider", "tool", "session", or "eval".
	// "eval" hooks are observational and ignore Phases / Mode — they run
	// once per eval result, fire-and-forget.
	//nolint:lll // jsonschema tags require single line
	Hook string `` /* 126-byte string literal not displayed */
	// Phases lists the hook phases to intercept (e.g. before_call, after_call).
	//nolint:lll // jsonschema tags require single line
	Phases []string `yaml:"phases,omitempty" json:"phases,omitempty" jsonschema:"title=Phases,description=Hook phases to intercept"`
	// Mode is the hook execution mode: "filter" (synchronous, can modify/deny) or "observe" (async, fire-and-forget).
	//nolint:lll // jsonschema tags require single line
	Mode string `` /* 139-byte string literal not displayed */
}

ExecHook defines an external process hook bound to a pipeline lifecycle event.

type FileStateStoreConfig added in v1.4.12

type FileStateStoreConfig struct {
	// Root is the directory under which per-conversation directories live.
	// Required. Created if absent.
	Root string `yaml:"root" json:"root"`

	// FSync controls fsync behavior: "off", "on-save" (default), "on-append".
	//nolint:lll // jsonschema tags require single line
	FSync string `yaml:"fsync,omitempty" json:"fsync,omitempty" jsonschema:"title=FSync Policy,enum=,enum=off,enum=on-save,enum=on-append"`

	// TTLDays, if non-zero, removes conversation directories whose state.json
	// mtime is older than now-TTLDays days at startup.
	TTLDays int `yaml:"ttl_days,omitempty" json:"ttl_days,omitempty"`
}

FileStateStoreConfig configures the filesystem-backed statestore. Required when StateStoreConfig.Type == "file".

type HTTPConfig added in v1.1.2

type HTTPConfig = tools.HTTPConfig

HTTPConfig is an alias for the canonical type in runtime/tools.

type HTTPTransportConfig added in v1.4.2

type HTTPTransportConfig struct {
	// MaxConnsPerHost caps the total TCP connections the transport may
	// open to any single upstream host (in-use + idle). Zero means
	// unlimited (the default, matching Go's http.Transport). Set a
	// positive value to cap connections for backends that need it.
	MaxConnsPerHost int `json:"max_conns_per_host,omitempty" yaml:"max_conns_per_host,omitempty"`
	// MaxIdleConnsPerHost caps idle keep-alive connections retained per
	// host for reuse. Zero or negative falls back to
	// providers.DefaultMaxIdleConnsPerHost (100). Usually tracked to
	// MaxConnsPerHost so the whole pool is reusable.
	MaxIdleConnsPerHost int `json:"max_idle_conns_per_host,omitempty" yaml:"max_idle_conns_per_host,omitempty"`
	// IdleConnTimeout is how long an idle keep-alive connection lingers
	// before being closed. Empty falls back to
	// providers.DefaultIdleConnTimeout (90s). Go duration string, e.g.
	// "60s", "5m".
	IdleConnTimeout string `json:"idle_conn_timeout,omitempty" yaml:"idle_conn_timeout,omitempty"`
}

HTTPTransportConfig configures the per-provider HTTP connection pool used for both request/response and streaming calls. Empty or zero fields fall back to the runtime's built-in defaults (providers.DefaultMaxConnsPerHost etc.), so operators only need to set the values they want to override.

See AltairaLabs/PromptKit#873 for motivation. The promptkit_http_conns_in_use gauge is the operational signal for tuning these values.

type InferenceDefaults added in v1.4.10

type InferenceDefaults struct {
	AudioClassifier string `yaml:"audio_classifier,omitempty" json:"audio_classifier,omitempty"`
	TextClassifier  string `yaml:"text_classifier,omitempty" json:"text_classifier,omitempty"`
	ImageClassifier string `yaml:"image_classifier,omitempty" json:"image_classifier,omitempty"`
	VideoClassifier string `yaml:"video_classifier,omitempty" json:"video_classifier,omitempty"`
	Embedder        string `yaml:"embedder,omitempty" json:"embedder,omitempty"`
}

InferenceDefaults pins which inference provider id serves each runtime/classify task by default. Ids resolve into cfg.LoadedInferenceProviders (populated from `providers:` entries declaring `role: inference`). Handlers may override per-call.

type InferenceProviderConfig added in v1.4.16

type InferenceProviderConfig struct {
	// ID is a stable identifier; defaults to the type when empty.
	ID string `yaml:"id,omitempty" json:"id,omitempty" jsonschema:"title=ID,description=Stable identifier"`
	// Type selects the implementation. Today only "huggingface".
	Type string `yaml:"type" json:"type" jsonschema:"enum=huggingface,title=Type,description=Inference provider type"`
	// Model overrides the provider's default classification model.
	//nolint:lll // jsonschema tags require single line
	Model string `yaml:"model,omitempty" json:"model,omitempty" jsonschema:"title=Model,description=Classification model name"`
	// BaseURL overrides the provider's default API endpoint.
	//nolint:lll // jsonschema tags require single line
	BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty" jsonschema:"title=BaseURL,description=API endpoint override"`
	// Credential names how to obtain the API key.
	//nolint:lll // jsonschema tags require single line
	Credential *CredentialConfig `yaml:"credential,omitempty" json:"credential,omitempty" jsonschema:"title=Credential,description=API key resolution"`
	// AdditionalConfig carries provider-specific extras (e.g. dedicated
	// endpoint flag for HuggingFace).
	//nolint:lll // jsonschema tags require single line
	AdditionalConfig map[string]any `` /* 143-byte string literal not displayed */
}

InferenceProviderConfig declares an inference (classify) provider — the SDK twin of Arena's `providers:` entry with role: inference. Used by classify-backed eval handlers (audio_emotion, text_toxicity, …).

type K8sManifest added in v1.5.4

type K8sManifest interface {
	GetAPIVersion() string
	GetKind() string
	GetName() string
	SetID(id string)
}

K8sManifest is an interface for K8s-style manifest types.

type LoggingConfig added in v1.1.6

type LoggingConfig struct {
	//nolint:lll // jsonschema tags require single line
	APIVersion string `` /* 126-byte string literal not displayed */
	//nolint:lll // jsonschema tags require single line
	Kind     string            `yaml:"kind" jsonschema:"const=LoggingConfig,title=Kind,description=Resource type identifier"`
	Metadata ObjectMeta        `yaml:"metadata,omitempty" jsonschema:"title=Metadata,description=Resource metadata"`
	Spec     LoggingConfigSpec `yaml:"spec" jsonschema:"title=Spec,description=Logging configuration specification"`
}

LoggingConfig represents logging configuration in K8s-style manifest format. This is used for schema generation and external configuration files.

type LoggingConfigSpec added in v1.1.6

type LoggingConfigSpec struct {
	// DefaultLevel is the default log level for all modules.
	// Supported values: trace, debug, info, warn, error.
	//nolint:lll // jsonschema tags require single line
	DefaultLevel string `` /* 174-byte string literal not displayed */

	// Format specifies the output format.
	// "json" produces machine-parseable JSON logs.
	// "text" produces human-readable text logs.
	//nolint:lll // jsonschema tags require single line
	Format string `yaml:"format,omitempty" jsonschema:"enum=json,enum=text,default=text,title=Format,description=Log output format"`

	// CommonFields are key-value pairs added to every log entry.
	// Useful for environment, service name, cluster, etc.
	//nolint:lll // jsonschema tags require single line
	CommonFields map[string]string `yaml:"commonFields,omitempty" jsonschema:"title=Common Fields,description=Key-value pairs added to every log entry"`

	// Modules configures logging for specific modules.
	// Module names use dot notation (e.g., runtime.pipeline).
	//nolint:lll // jsonschema tags require single line
	Modules []ModuleLoggingConfig `yaml:"modules,omitempty" jsonschema:"title=Modules,description=Per-module logging configuration"`
}

LoggingConfigSpec defines the logging configuration parameters.

func DefaultLoggingConfig added in v1.1.6

func DefaultLoggingConfig() LoggingConfigSpec

DefaultLoggingConfig returns a LoggingConfigSpec with sensible defaults.

func (*LoggingConfigSpec) Validate added in v1.1.6

func (c *LoggingConfigSpec) Validate() error

Validate validates the LoggingConfigSpec.

type MCPServerConfig

type MCPServerConfig struct {
	Name       string            `yaml:"name" json:"name"`
	Command    string            `yaml:"command,omitempty" json:"command,omitempty"`
	Args       []string          `yaml:"args,omitempty" json:"args,omitempty"`
	Env        map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
	WorkingDir string            `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	URL        string            `yaml:"url,omitempty" json:"url,omitempty"`
	Headers    map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
	//nolint:lll // jsonschema tags require single line
	Transport string `` /* 310-byte string literal not displayed */
	//nolint:lll // jsonschema tags require single line
	Source string `` /* 226-byte string literal not displayed */
	//nolint:lll // jsonschema tags require single line
	Scope string `` /* 211-byte string literal not displayed */
	//nolint:lll // jsonschema tags require single line
	SourceArgs map[string]any `` /* 223-byte string literal not displayed */
	TimeoutMs  int            `yaml:"timeout_ms,omitempty" json:"timeout_ms,omitempty"`
	ToolFilter *MCPToolFilter `yaml:"tool_filter,omitempty" json:"tool_filter,omitempty"`
}

MCPServerConfig represents configuration for an MCP server.

Exactly one transport must be specified:

  • Command: stdio (PromptKit spawns a local subprocess).
  • URL: HTTP transport — by default the legacy SSE adapter is used. Set Transport to "streamable_http" to opt into the modern Streamable HTTP transport (MCP 2025-03-26).
  • Source: host-provisioned (a named MCPSource opens the endpoint at a scope boundary). Requires Scope.

type MCPToolFilter added in v1.3.11

type MCPToolFilter struct {
	Allowlist []string `yaml:"allowlist,omitempty" json:"allowlist,omitempty"`
	Blocklist []string `yaml:"blocklist,omitempty" json:"blocklist,omitempty"`
}

MCPToolFilter controls which tools from an MCP server are exposed to the LLM.

type MockMediaSpec added in v1.3.10

type MockMediaSpec struct {
	FilePath string `json:"file_path,omitempty" yaml:"file_path,omitempty"` // Local file path (resolved at execution)
	URL      string `json:"url,omitempty" yaml:"url,omitempty"`             // External URL
	MIMEType string `json:"mime_type" yaml:"mime_type"`
	Width    *int   `json:"width,omitempty" yaml:"width,omitempty"`
	Height   *int   `json:"height,omitempty" yaml:"height,omitempty"`
	Caption  string `json:"caption,omitempty" yaml:"caption,omitempty"`
}

MockMediaSpec describes media content in a mock part (schema generation).

type MockPartSpec added in v1.3.10

type MockPartSpec struct {
	Type  string         `json:"type" yaml:"type"`                     // "text", "image", "audio", "video", "document"
	Text  string         `json:"text,omitempty" yaml:"text,omitempty"` // For type=text
	Media *MockMediaSpec `json:"media,omitempty" yaml:"media,omitempty"`
}

MockPartSpec describes a single multimodal content part in mock_parts (schema generation).

type ModuleLoggingConfig added in v1.1.6

type ModuleLoggingConfig struct {
	// Name is the module name pattern using dot notation.
	// Examples: "runtime", "runtime.pipeline", "providers.openai".
	// More specific names take precedence over less specific ones.
	//nolint:lll // jsonschema tags require single line
	Name string `yaml:"name" jsonschema:"title=Name,description=Module name pattern using dot notation (e.g. runtime.pipeline)"`

	// Level is the log level for this module.
	// Overrides the default level for matching loggers.
	//nolint:lll // jsonschema tags require single line
	Level string `` /* 128-byte string literal not displayed */

	// Fields are additional key-value pairs added to logs from this module.
	//nolint:lll // jsonschema tags require single line
	Fields map[string]string `yaml:"fields,omitempty" jsonschema:"title=Fields,description=Additional fields added to logs from this module"`
}

ModuleLoggingConfig configures logging for a specific module.

type MultimodalConfig added in v1.3.11

type MultimodalConfig = tools.MultimodalConfig

MultimodalConfig is an alias for the canonical type in runtime/tools.

type ObjectMeta added in v1.1.2

type ObjectMeta struct {
	Name      string            `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"title=Name,description=Name of the resource"`                      //nolint:lll
	Namespace string            `yaml:"namespace,omitempty" json:"namespace,omitempty" jsonschema:"title=Namespace,description=Namespace for the resource"` //nolint:lll
	Labels    map[string]string ``                                                                                                                          //nolint:lll
	/* 126-byte string literal not displayed */
	Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty" jsonschema:"title=Annotations,description=Additional metadata"` //nolint:lll
}

ObjectMeta is a simplified metadata structure for PromptKit configs Based on K8s ObjectMeta but with YAML-friendly tags and optional fields

type PlatformConfig added in v1.1.9

type PlatformConfig = credentials.PlatformConfig

PlatformConfig is an alias for credentials.PlatformConfig.

type Pricing

type Pricing struct {
	InputCostPer1K  float64 `json:"input_cost_per_1k" yaml:"input_cost_per_1k"`
	OutputCostPer1K float64 `json:"output_cost_per_1k" yaml:"output_cost_per_1k"`
}

Pricing defines cost per 1K tokens for input and output

type Provider

type Provider struct {
	ID    string `json:"id,omitempty" yaml:"id,omitempty"`
	Type  string `json:"type" yaml:"type"`
	Model string `json:"model,omitempty" yaml:"model,omitempty"`
	// Voice is the vendor-specific voice identifier used when Capability is
	// "tts". For Cartesia it's the voice UUID; for ElevenLabs the voice ID;
	// for OpenAI the voice name (alloy, nova, etc.). Ignored for LLM/STT
	// providers.
	Voice string `json:"voice,omitempty" yaml:"voice,omitempty"`
	// SampleRate is the audio sample rate in Hz for TTS providers. Common
	// values: 16000 (telephony), 24000 (default for most TTS vendors),
	// 48000 (high quality). Ignored for non-TTS providers.
	SampleRate int `json:"sample_rate,omitempty" yaml:"sample_rate,omitempty"`
	// AudioFiles is the list of PCM fixtures used by the mock TTS provider
	// (capability=tts, type=mock). The mock service rotates through these
	// files on each Synthesize() call. Paths are relative to the arena
	// config directory. Ignored when type != "mock" or capability != "tts".
	AudioFiles []string `json:"audio_files,omitempty" yaml:"audio_files,omitempty"`
	// Role tags what this provider does. One of "llm" (default), "tts", or
	// "stt". The arena uses this to route the provider to the correct
	// registry and to skip non-llm providers when building the
	// agent-under-test matrix. Distinct from the Capabilities field which
	// lists per-model feature flags (vision, tools, etc.).
	//
	// Renamed from "capability" 2026-05-18 to avoid singular/plural
	// collision with Capabilities. The field is required for tts/stt
	// providers; defaults to "llm" when empty.
	Role string `` //nolint:lll // enum list can't be split inside a struct tag
	/* 135-byte string literal not displayed */
	BaseURL string `json:"base_url,omitempty" yaml:"base_url,omitempty"`
	// Headers specifies custom HTTP headers to include in every request to
	// this provider. Useful for OpenAI-compatible gateways (OpenRouter,
	// LiteLLM, etc.) that require app attribution or custom auth headers.
	// Values are plain strings — use the credentials field for secrets.
	// Collisions with built-in provider headers (Authorization, Content-Type,
	// etc.) are rejected at request time.
	Headers          map[string]string      `json:"headers,omitempty" yaml:"headers,omitempty"`
	RateLimit        RateLimit              `json:"rate_limit,omitempty" yaml:"rate_limit,omitempty"`
	Defaults         ProviderDefaults       `json:"defaults,omitempty" yaml:"defaults,omitempty"`
	Pricing          Pricing                `json:"pricing,omitempty" yaml:"pricing,omitempty"`
	PricingCorrectAt string                 `json:"pricing_correct_at,omitempty" yaml:"pricing_correct_at,omitempty"`
	IncludeRawOutput bool                   `json:"include_raw_output,omitempty" yaml:"include_raw_output,omitempty"` // Include raw API requests in output for debugging
	AdditionalConfig map[string]interface{} `json:"additional_config,omitempty" yaml:"additional_config,omitempty"`   // Additional provider-specific configuration
	Credential       *CredentialConfig      `json:"credential,omitempty" yaml:"credential,omitempty"`
	Platform         *PlatformConfig        `json:"platform,omitempty" yaml:"platform,omitempty"`
	// Capabilities lists what this provider supports: text, streaming, vision, tools, json, audio, video, documents
	Capabilities []string `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
	// UnsupportedParams lists model parameters not supported by this provider model
	// (e.g. "temperature", "top_p", "max_tokens").
	UnsupportedParams []string `json:"unsupported_params,omitempty" yaml:"unsupported_params,omitempty"`
	// RequestTimeout caps the wall-clock duration of request/response HTTP
	// calls (Predict, embeddings, etc.) via http.Client.Timeout. Does NOT
	// apply to SSE streaming calls, which are unbounded by wall-clock and
	// governed only by StreamIdleTimeout and context cancellation. Empty
	// falls back to the provider's default (typically 60s). Go duration
	// string, e.g. "2m", "90s".
	RequestTimeout string `json:"request_timeout,omitempty" yaml:"request_timeout,omitempty"`
	// StreamIdleTimeout bounds how long an SSE streaming body may remain
	// silent (no bytes) between reads before the stream is aborted. The
	// timer resets on every byte received, so legitimately long-running
	// streams (e.g. hours-long sessions delivering sparse output) are not
	// affected. Empty falls back to providers.DefaultStreamIdleTimeout
	// (30s). Go duration string, e.g. "60s", "2m".
	StreamIdleTimeout string `json:"stream_idle_timeout,omitempty" yaml:"stream_idle_timeout,omitempty"`
	// StreamRetry configures bounded retry for streaming requests that fail
	// before any content chunk has been forwarded downstream (the
	// "pre-first-chunk window"). Targets transient HTTP/2 stream resets and
	// initial-connection errors without risking duplicate content emission.
	// Disabled by default. See docs/local-backlog/STREAMING_RETRY_AT_SCALE.md.
	StreamRetry *StreamRetryConfig `json:"stream_retry,omitempty" yaml:"stream_retry,omitempty"`
	// StreamMaxConcurrent caps the number of concurrent streaming requests
	// the provider will have in flight at any time. Requests beyond the
	// limit block on the caller's context — a short deadline acts as
	// fail-fast, a long one queues. Zero or negative means unlimited
	// (current default). Reduces goroutine/timer explosion under load.
	StreamMaxConcurrent int `json:"stream_max_concurrent,omitempty" yaml:"stream_max_concurrent,omitempty"`
	// HTTPTransport configures the per-provider HTTP connection pool.
	// Lets operators raise MaxConnsPerHost and related limits above the
	// single-process defaults when scaling up concurrent streams per
	// upstream. Note that raising MaxConnsPerHost alone is not sufficient
	// if the upstream advertises a low SETTINGS_MAX_CONCURRENT_STREAMS
	// (RFC 7540 §6.5.2) — the effective ceiling is
	// MaxConnsPerHost × SETTINGS_MAX_CONCURRENT_STREAMS per upstream.
	// See AltairaLabs/PromptKit#873.
	HTTPTransport *HTTPTransportConfig `json:"http_transport,omitempty" yaml:"http_transport,omitempty"`
}

Provider defines API connection and defaults

func LoadProvider

func LoadProvider(filename string) (*Provider, error)

LoadProvider loads and parses a provider configuration from a YAML file in K8s-style manifest format

func (*Provider) GetRole added in v1.4.9

func (p *Provider) GetRole() string

GetRole returns the provider's role, defaulting to "llm".

func (*Provider) ValidateRole added in v1.4.9

func (p *Provider) ValidateRole() error

ValidateRole returns an error if Role is set to an unrecognized value. Empty is treated as LLM and accepted.

type ProviderConfig

type ProviderConfig struct {
	APIVersion string     `yaml:"apiVersion" json:"apiVersion"`
	Kind       string     `yaml:"kind" json:"kind"`
	Metadata   ObjectMeta `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Spec       Provider   `yaml:"spec" json:"spec"`
}

ProviderConfig represents a Provider configuration in K8s-style manifest format

func (*ProviderConfig) GetAPIVersion

func (c *ProviderConfig) GetAPIVersion() string

K8s manifest interface implementation for ProviderConfig

func (*ProviderConfig) GetKind

func (c *ProviderConfig) GetKind() string

func (*ProviderConfig) GetName

func (c *ProviderConfig) GetName() string

func (*ProviderConfig) SetID

func (c *ProviderConfig) SetID(id string)

type ProviderConfigK8s added in v1.1.2

type ProviderConfigK8s struct {
	APIVersion string            `yaml:"apiVersion" json:"apiVersion"`
	Kind       string            `yaml:"kind" json:"kind"`
	Metadata   metav1.ObjectMeta `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Spec       Provider          `yaml:"spec" json:"spec"`
}

ProviderConfigK8s is the K8s-compatible version for unmarshaling

func (*ProviderConfigK8s) GetAPIVersion added in v1.1.2

func (c *ProviderConfigK8s) GetAPIVersion() string

K8s manifest interface implementation for ProviderConfigK8s

func (*ProviderConfigK8s) GetKind added in v1.1.2

func (c *ProviderConfigK8s) GetKind() string

func (*ProviderConfigK8s) GetName added in v1.1.2

func (c *ProviderConfigK8s) GetName() string

func (*ProviderConfigK8s) SetID added in v1.1.2

func (c *ProviderConfigK8s) SetID(id string)

type ProviderDefaults

type ProviderDefaults struct {
	Temperature float32 `json:"temperature" yaml:"temperature"`
	TopP        float32 `json:"top_p" yaml:"top_p"`
	MaxTokens   int     `json:"max_tokens" yaml:"max_tokens"`
	// PromptCaching controls Anthropic prompt caching. Omit or set true to enable
	// (the default); set false to disable. Only affects Claude providers.
	PromptCaching *bool `json:"prompt_caching,omitempty" yaml:"prompt_caching,omitempty"`
}

ProviderDefaults defines default parameters for a provider

type ProviderSpec added in v1.4.7

type ProviderSpec struct {
	Name         string // from metadata.name
	Impl         string // implementation discriminator (e.g. "openai", "imagen")
	Endpoint     string // base URL
	Auth         AuthSpec
	Timeouts     TimeoutsSpec
	Retry        RetrySpec
	Capabilities []CapabilitySpec
}

ProviderSpec is the unified, post-compat shape used internally for any provider type (inference, TTS, STT, embedding, image).

Loaded by config.LoadProviderSpec which accepts both legacy (top-level type/model/pricing) and unified (impl + capabilities[]) YAML shapes.

func LoadProviderSpec added in v1.4.7

func LoadProviderSpec(data []byte) (*ProviderSpec, error)

LoadProviderSpec reads a Provider YAML document and returns the canonical ProviderSpec.

The 2026-05-18 cleanup removed the multi-role "unified" shape (spec.impl + spec.capabilities: [{type, model, pricing}, ...]) and the singular spec.capability field. Yamls using either are rejected here with an explicit migration message — there is no compat shim.

type RateLimit

type RateLimit struct {
	RPS   int `json:"rps" yaml:"rps"`
	Burst int `json:"burst" yaml:"burst"`
}

RateLimit defines rate limiting parameters

type RedisConfig

type RedisConfig struct {
	// Address of the Redis server (e.g., "localhost:6379")
	Address string `yaml:"address" json:"address"`

	// Password for Redis authentication (optional)
	Password string `yaml:"password,omitempty" json:"password,omitempty"`

	// Database number (0-15, default is 0)
	Database int `yaml:"database,omitempty" json:"database,omitempty"`

	// TTL for conversation state (e.g., "24h", "7d"). Default is "24h"
	TTL string `yaml:"ttl,omitempty" json:"ttl,omitempty"`

	// Prefix for Redis keys (default is "promptkit")
	Prefix string `yaml:"prefix,omitempty" json:"prefix,omitempty"`
}

RedisConfig contains Redis-specific configuration

type RequestMapping added in v1.3.11

type RequestMapping = tools.RequestMapping

RequestMapping is an alias for the canonical type in runtime/tools.

type ResponseMapping added in v1.3.11

type ResponseMapping = tools.ResponseMapping

ResponseMapping is an alias for the canonical type in runtime/tools.

type RetrySpec added in v1.4.7

type RetrySpec struct {
	MaxAttempts int    `yaml:"max_attempts,omitempty"`
	Backoff     string `yaml:"backoff,omitempty"`
}

RetrySpec configures generic retry policy.

type RuntimeConfig added in v1.3.12

type RuntimeConfig struct {
	//nolint:lll // jsonschema tags require single line
	APIVersion string `` /* 144-byte string literal not displayed */
	Kind       string `yaml:"kind" json:"kind" jsonschema:"const=RuntimeConfig,title=Kind,description=Resource type"`
	//nolint:lll // jsonschema tags require single line
	Metadata ObjectMeta `yaml:"metadata,omitempty" json:"metadata,omitempty" jsonschema:"title=Metadata,description=Resource metadata"`
	//nolint:lll // jsonschema tags require single line
	Spec RuntimeConfigSpec `yaml:"spec" json:"spec" jsonschema:"title=Spec,description=Runtime configuration specification"`
}

RuntimeConfig represents a runtime environment configuration in K8s-style manifest format. It declares how to run a pack in a specific environment: providers, tool bindings, MCP servers, state store, logging, and (in future phases) exec bindings and hooks.

The pack defines _what_ the agent does (portable). RuntimeConfig defines _how_ to run it (environment-specific).

func LoadRuntimeConfig added in v1.3.12

func LoadRuntimeConfig(path string) (*RuntimeConfig, error)

LoadRuntimeConfig loads and validates a RuntimeConfig from a YAML file.

type RuntimeConfigSpec added in v1.3.12

type RuntimeConfigSpec struct {
	// Providers configures LLM providers (credentials, models, rate limits).
	//nolint:lll // jsonschema tags require single line
	Providers []Provider `yaml:"providers,omitempty" json:"providers,omitempty" jsonschema:"title=Providers,description=LLM provider configurations"`

	// EmbeddingProviders configures embedding providers (OpenAI, Gemini,
	// VoyageAI, Ollama). Used for RAG retrieval and as the shared
	// provider supplied to selectors via SelectorContext.Embeddings.
	// First entry becomes the default RAG provider unless one is set
	// programmatically via WithContextRetrieval.
	//nolint:lll // jsonschema tags require single line
	EmbeddingProviders []EmbeddingProviderConfig `` /* 158-byte string literal not displayed */

	// TTSProviders configures text-to-speech providers (OpenAI,
	// ElevenLabs, Cartesia). First entry becomes the default TTS
	// service unless one is set programmatically via WithTTS or
	// WithVADMode.
	//nolint:lll // jsonschema tags require single line
	TTSProviders []TTSProviderConfig `` /* 145-byte string literal not displayed */

	// STTProviders configures speech-to-text providers (OpenAI). First
	// entry becomes the default STT service unless one is set
	// programmatically via WithVADMode.
	//nolint:lll // jsonschema tags require single line
	STTProviders []STTProviderConfig `` /* 145-byte string literal not displayed */

	// InferenceProviders configures inference (classify) providers
	// (HuggingFace). Used by classify-backed eval handlers
	// (audio_emotion, text_toxicity, …). First declared provider
	// implementing a task becomes that task's default.
	//nolint:lll // jsonschema tags require single line
	InferenceProviders []InferenceProviderConfig `` /* 169-byte string literal not displayed */

	// Tools binds pack tool names to implementations (HTTP, mock, or exec).
	//nolint:lll // jsonschema tags require single line
	Tools map[string]*ToolSpec `` /* 130-byte string literal not displayed */

	// MCPServers configures MCP tool servers.
	//nolint:lll // jsonschema tags require single line
	MCPServers []MCPServerConfig `` /* 126-byte string literal not displayed */

	// StateStore configures conversation state persistence.
	//nolint:lll // jsonschema tags require single line
	StateStore *StateStoreConfig `` /* 145-byte string literal not displayed */

	// Logging configures log levels, format, and per-module settings.
	//nolint:lll // jsonschema tags require single line
	Logging *LoggingConfigSpec `yaml:"logging,omitempty" json:"logging,omitempty" jsonschema:"title=Logging,description=Logging configuration"`

	// Evals binds pack eval type names to external process implementations.
	// Eval types not bound here resolve to built-in Go handlers.
	//nolint:lll // jsonschema tags require single line
	Evals map[string]*ExecBinding `` /* 137-byte string literal not displayed */

	// Hooks configures external process hooks for pipeline lifecycle events.
	//nolint:lll // jsonschema tags require single line
	Hooks map[string]*ExecHook `yaml:"hooks,omitempty" json:"hooks,omitempty" jsonschema:"title=Hooks,description=External hook process configurations"`

	// Sandboxes declares named sandbox backends that exec hooks can
	// reference via their "sandbox:" field. Each entry's "mode" selects
	// a factory registered via runtime/hooks/sandbox.RegisterFactory;
	// the remaining fields are passed verbatim to that factory as the
	// config map. The built-in "direct" mode resolves without any
	// consumer opt-in; other modes (docker_run, docker_exec, kubectl_exec,
	// or custom) require that their factory has been registered before
	// RuntimeConfig is loaded.
	//nolint:lll // jsonschema tags require single line
	Sandboxes map[string]*SandboxConfig `` /* 149-byte string literal not displayed */

	// Selectors declares named selectors that narrow the skill or tool
	// set surfaced to the LLM. Each entry spawns an external process
	// that reads a JSON query on stdin and writes selected IDs on
	// stdout. Referenced from spec.skills.selector / spec.tools.selector
	// by name.
	//nolint:lll // jsonschema tags require single line
	Selectors map[string]*SelectorConfig `` /* 162-byte string literal not displayed */

	// Skills carries skill-specific runtime configuration, most notably
	// the selector binding. Pack-level skill definitions live in the
	// pack itself; this block only covers runtime wiring.
	//nolint:lll // jsonschema tags require single line
	Skills *SkillsConfig `yaml:"skills,omitempty" json:"skills,omitempty" jsonschema:"title=Skills,description=Runtime skill configuration"`

	// ToolSelector names a selector declared under spec.selectors that
	// narrows the pack-declared tool set surfaced to the LLM each turn.
	// System tools (skill__, a2a__, workflow__, mcp__, memory__) are
	// always preserved regardless of selection. When empty, the prompt's
	// full allowedTools list is offered to the provider.
	//
	// This is a flat field (not nested under tools:) because the existing
	// spec.tools map binds exec tool implementations.
	//nolint:lll // jsonschema tags require single line
	ToolSelector string `` /* 203-byte string literal not displayed */
}

RuntimeConfigSpec defines the runtime environment configuration.

func (*RuntimeConfigSpec) Validate added in v1.3.12

func (s *RuntimeConfigSpec) Validate() error

Validate validates the RuntimeConfigSpec.

type STTProviderConfig added in v1.4.5

type STTProviderConfig struct {
	// ID is a stable identifier; defaults to the type when empty.
	ID string `yaml:"id,omitempty" json:"id,omitempty" jsonschema:"title=ID,description=Stable identifier"`
	// Type selects the implementation. Today only "openai".
	Type string `yaml:"type" json:"type" jsonschema:"enum=openai,title=Type,description=STT provider type"`
	// Model overrides the provider's default transcription model.
	//nolint:lll // jsonschema tags require single line
	Model string `yaml:"model,omitempty" json:"model,omitempty" jsonschema:"title=Model,description=Transcription model name"`
	// BaseURL overrides the provider's default API endpoint.
	//nolint:lll // jsonschema tags require single line
	BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty" jsonschema:"title=BaseURL,description=API endpoint override"`
	// Credential names how to obtain the API key.
	//nolint:lll // jsonschema tags require single line
	Credential *CredentialConfig `yaml:"credential,omitempty" json:"credential,omitempty" jsonschema:"title=Credential,description=API key resolution"`
	// AdditionalConfig carries provider-specific extras.
	//nolint:lll // jsonschema tags require single line
	AdditionalConfig map[string]any `` /* 143-byte string literal not displayed */
}

STTProviderConfig declares a speech-to-text provider — the declarative analog of programmatic stt.NewOpenAI constructors. Today only "openai" is supported; more types slot in via the stt.RegisterSTTFactory pattern.

type SandboxConfig added in v1.4.5

type SandboxConfig struct {
	// Mode names a registered sandbox factory. "direct" ships in-tree
	// and needs no extra registration.
	//nolint:lll // jsonschema tags require single line
	Mode string `` /* 164-byte string literal not displayed */

	// Config carries mode-specific configuration. Each factory
	// documents its own keys. For example, the docker_run example
	// expects "image", "network", and "mounts".
	Config map[string]any `yaml:",inline" json:"-" jsonschema:"-"`
}

SandboxConfig declares a named sandbox backend. Mode selects a factory registered via runtime/hooks/sandbox.RegisterFactory; every other field is passed to the factory as its config map.

type SchemaValidationError added in v1.1.2

type SchemaValidationError struct {
	Field       string
	Description string
	Value       interface{}

	// Keyword mirrors runtime/prompt/schema.ValidationError.Keyword
	// (e.g. "enum", "additional_property_not_allowed").
	Keyword string
	// ValidValues lists valid alternatives when computable — enum allowed
	// values, or sibling property names for additionalProperties.
	ValidValues []string
	// Suggestions are nearest-match candidates from ValidValues.
	Suggestions []string
}

SchemaValidationError represents a validation error from JSON schema validation

func (SchemaValidationError) Error added in v1.1.2

func (e SchemaValidationError) Error() string

Error implements the error interface

type SchemaValidationResult added in v1.1.2

type SchemaValidationResult struct {
	Valid  bool
	Errors []SchemaValidationError
}

SchemaValidationResult contains the results of schema validation

func ValidateWithLocalSchema added in v1.1.2

func ValidateWithLocalSchema(yamlData []byte, configType ConfigType, schemaDir string) (*SchemaValidationResult, error)

ValidateWithLocalSchema validates YAML data against a local JSON schema file

func ValidateWithSchema added in v1.1.2

func ValidateWithSchema(yamlData []byte, configType ConfigType) (*SchemaValidationResult, error)

ValidateWithSchema validates YAML data against a JSON schema

type SelectorConfig added in v1.4.5

type SelectorConfig struct {
	// Command is the path to the selector executable, resolved relative
	// to the config file by the loader.
	Command string `yaml:"command" json:"command" jsonschema:"title=Command,description=Path to the selector executable"`
	// Args are additional arguments passed to the command.
	//nolint:lll // jsonschema tags require single line
	Args []string `yaml:"args,omitempty" json:"args,omitempty" jsonschema:"title=Args,description=Additional command arguments"`
	// Env lists environment variable names required by the process.
	// Values come from the host environment.
	//nolint:lll // jsonschema tags require single line
	Env []string `yaml:"env,omitempty" json:"env,omitempty" jsonschema:"title=Env,description=Required environment variable names"`
	// TimeoutMs is the per-invocation timeout in milliseconds.
	//nolint:lll // jsonschema tags require single line
	TimeoutMs int `` /* 133-byte string literal not displayed */
	// Sandbox names a sandbox backend declared under spec.sandboxes.
	// When empty the built-in "direct" backend is used.
	//nolint:lll // jsonschema tags require single line
	Sandbox string `` /* 136-byte string literal not displayed */
}

SelectorConfig declares an external selector process. Command, Args, Env, TimeoutMs, and Sandbox mirror the exec hook shape.

type SkillsConfig added in v1.4.5

type SkillsConfig struct {
	// Selector names a selector declared under spec.selectors.
	// When empty, all eligible skills are surfaced (current behavior).
	//nolint:lll // jsonschema tags require single line
	Selector string `` /* 140-byte string literal not displayed */
}

SkillsConfig carries runtime-level skill wiring.

type StateStoreConfig

type StateStoreConfig struct {
	// Type specifies the state store implementation: "memory", "redis", or "file"
	Type string `yaml:"type" json:"type"`

	// Redis configuration (only used when Type is "redis")
	Redis *RedisConfig `yaml:"redis,omitempty" json:"redis,omitempty"`

	// File configuration (only used when Type is "file")
	File *FileStateStoreConfig `yaml:"file,omitempty" json:"file,omitempty"`
}

StateStoreConfig represents configuration for conversation state storage

type StreamRetryBudgetConfig added in v1.4.2

type StreamRetryBudgetConfig struct {
	// RatePerSec is the sustained token refill rate. Empty or non-positive
	// disables the budget (unbounded retries).
	RatePerSec float64 `json:"rate_per_sec,omitempty" yaml:"rate_per_sec,omitempty"`
	// Burst is the maximum number of tokens that can accumulate. Empty
	// or non-positive disables the budget.
	Burst int `json:"burst,omitempty" yaml:"burst,omitempty"`
}

StreamRetryBudgetConfig configures the token bucket that gates retry attempts to prevent thundering-herd reconnects under upstream degradation. Only retries consume tokens; the initial attempt of each request is always allowed through.

type StreamRetryConfig added in v1.4.2

type StreamRetryConfig struct {
	// Enabled turns the retry loop on. Defaults to false — streaming retry
	// changes latency/billing semantics and must be opt-in per provider.
	Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	// MaxAttempts is the total number of attempts including the initial
	// request. A value of 2 means "initial request plus at most one retry".
	// Values <1 are treated as 1 (no retry). Empty falls back to 2.
	MaxAttempts int `json:"max_attempts,omitempty" yaml:"max_attempts,omitempty"`
	// InitialDelay is the base delay before the first retry. Subsequent
	// retries use exponential backoff with full jitter up to MaxDelay. Go
	// duration string. Empty falls back to "250ms".
	InitialDelay string `json:"initial_delay,omitempty" yaml:"initial_delay,omitempty"`
	// MaxDelay caps the per-attempt backoff delay. Go duration string.
	// Empty falls back to "2s".
	MaxDelay string `json:"max_delay,omitempty" yaml:"max_delay,omitempty"`
	// RetryWindow controls which point in the stream lifecycle is still
	// eligible for retry. "pre_first_chunk" (the only currently supported
	// value) retries only if no content chunk has been forwarded yet.
	// Future values may be gated on deduplication support.
	RetryWindow string `json:"retry_window,omitempty" yaml:"retry_window,omitempty"`
	// Budget configures a token bucket that rate-limits retry attempts
	// across all in-flight requests on this provider. Protects against
	// thundering-herd reconnects when a single upstream connection reset
	// kills many streams simultaneously. When nil, retries are unbounded
	// (Phase 1 behavior).
	Budget *StreamRetryBudgetConfig `json:"budget,omitempty" yaml:"budget,omitempty"`
}

StreamRetryConfig configures pre-first-chunk streaming retry behavior for a provider. See docs/local-backlog/STREAMING_RETRY_AT_SCALE.md for design.

type TTSProviderConfig added in v1.4.5

type TTSProviderConfig struct {
	// ID is a stable identifier; defaults to the type when empty.
	ID string `yaml:"id,omitempty" json:"id,omitempty" jsonschema:"title=ID,description=Stable identifier"`
	// Type selects the implementation: openai, elevenlabs, cartesia.
	//nolint:lll // jsonschema tags require single line
	Type string `yaml:"type" json:"type" jsonschema:"enum=openai,enum=elevenlabs,enum=cartesia,title=Type,description=TTS provider type"`
	// Model overrides the provider's default voice/model.
	Model string `yaml:"model,omitempty" json:"model,omitempty" jsonschema:"title=Model,description=Voice or model name"`
	// BaseURL overrides the provider's default API endpoint.
	//nolint:lll // jsonschema tags require single line
	BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty" jsonschema:"title=BaseURL,description=API endpoint override"`
	// Credential names how to obtain the API key.
	//nolint:lll // jsonschema tags require single line
	Credential *CredentialConfig `yaml:"credential,omitempty" json:"credential,omitempty" jsonschema:"title=Credential,description=API key resolution"`
	// AdditionalConfig carries provider-specific extras (Cartesia
	// `ws_url`, etc.).
	//nolint:lll // jsonschema tags require single line
	AdditionalConfig map[string]any `` /* 143-byte string literal not displayed */
}

TTSProviderConfig declares a text-to-speech provider — the declarative analog of programmatic tts.NewOpenAI / NewElevenLabs / NewCartesia constructors. Resolved by sdk.WithRuntimeConfig.

type TimeoutsSpec added in v1.4.7

type TimeoutsSpec struct {
	Request time.Duration `yaml:"request,omitempty"`
}

TimeoutsSpec holds request-level timeouts.

type ToolClientConfig added in v1.3.8

type ToolClientConfig struct {
	Consent        *ToolConsentConfig `json:"consent,omitempty" yaml:"consent,omitempty"`
	TimeoutMs      int                `json:"timeout_ms,omitempty" yaml:"timeout_ms,omitempty"`
	Categories     []string           `json:"categories,omitempty" yaml:"categories,omitempty"`
	ValidateOutput bool               `json:"validate_output,omitempty" yaml:"validate_output,omitempty"`
}

ToolClientConfig defines configuration for client-side tool execution (schema generation)

type ToolConsentConfig added in v1.3.8

type ToolConsentConfig struct {
	Required        bool   `json:"required" yaml:"required"`
	Message         string `json:"message,omitempty" yaml:"message,omitempty"`
	DeclineStrategy string `json:"decline_strategy,omitempty" yaml:"decline_strategy,omitempty"`
}

ToolConsentConfig defines consent requirements for client-side tools (schema generation)

type ToolData

type ToolData struct {
	FilePath string `json:"file_path,omitempty"`
	Data     []byte `json:"data,omitempty"`
}

ToolData holds raw tool configuration data

type ToolSpec added in v1.1.2

type ToolSpec struct {
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Description string `json:"description" yaml:"description"`
	// InputSchema is a JSON Schema Draft-07 document for the tool's arguments.
	InputSchema interface{} `json:"input_schema" yaml:"input_schema"`
	// OutputSchema is a JSON Schema Draft-07 document for the tool's return value.
	OutputSchema interface{} `json:"output_schema" yaml:"output_schema"`
	Mode         string      `` //nolint:lll
	/* 218-byte string literal not displayed */
	TimeoutMs  int         `json:"timeout_ms,omitempty" yaml:"timeout_ms,omitempty"`
	MockResult interface{} `` //nolint:lll
	/* 230-byte string literal not displayed */
	MockTemplate string `` //nolint:lll
	/* 385-byte string literal not displayed */
	MockParts  []MockPartSpec `json:"mock_parts,omitempty" yaml:"mock_parts,omitempty"`
	HTTPConfig *HTTPConfig    `json:"http,omitempty" yaml:"http,omitempty"`
	// Exec subprocess configuration (mode: exec)
	ExecConfig *ExecBinding `json:"exec,omitempty" yaml:"exec,omitempty"`
	// Client-side execution configuration
	ClientConfig *ToolClientConfig `json:"client,omitempty" yaml:"client,omitempty"`
}

ToolSpec represents a tool descriptor (re-exported from runtime/tools for schema generation)

type ValidationError added in v1.1.6

type ValidationError struct {
	Field   string
	Message string
	Value   string
}

ValidationError represents a configuration validation error.

func (*ValidationError) Error added in v1.1.6

func (e *ValidationError) Error() string

type VoiceBinding added in v1.4.7

type VoiceBinding struct {
	ID       string `yaml:"id" json:"id"`             // Voice id used by personas
	Provider string `yaml:"provider" json:"provider"` // TTS provider id (must exist in spec.tts_providers)
}

VoiceBinding binds a voice id (the namespace personas reference) to a loaded TTS provider id. Parallel to SelfPlayRoleGroup's id→provider shape.

Jump to

Keyboard shortcuts

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