Skip to content
Embedding

Embedding (Go library)

This page is a curated guided tour. The authoritative API reference lives at pkg.go.dev.

Overview

Fizeau is a Go library that implements a coding agent runtime. The root package github.com/easel/fizeau is a thin facade: it exports the FizeauService interface, request/response/event types, and the New constructor. All concrete execution, transcript, routing health, and quota mechanics live behind internal/ packages.

Quick start

package main

import (
    "context"
    "fmt"

    "github.com/easel/fizeau"
    _ "github.com/easel/fizeau/configinit"
)

func main() {
    svc, err := fizeau.New(fizeau.ServiceOptions{})
    if err != nil {
        panic(err)
    }
    events, err := svc.Execute(context.Background(), fizeau.ServiceExecuteRequest{
        Prompt:  "Read main.go and tell me the package name",
        Policy:  "cheap",
        WorkDir: ".",
    })
    if err != nil {
        panic(err)
    }
    for event := range events {
        fmt.Println(event.Type)
    }
}

The blank import of github.com/easel/fizeau/configinit registers the default YAML config loader via RegisterConfigLoader; without it, New starts with no provider config and ListProviders/HealthCheck will error until config is injected explicitly.

Core types

FizeauService

FizeauService is the entire public Go surface of the fizeau module.

type FizeauService interface {
    Execute(ctx context.Context, req ServiceExecuteRequest) (<-chan ServiceEvent, error)
    TailSessionLog(ctx context.Context, sessionID string) (<-chan ServiceEvent, error)
    ListHarnesses(ctx context.Context) ([]HarnessInfo, error)
    ListProviders(ctx context.Context) ([]ProviderInfo, error)
    ListModels(ctx context.Context, filter ModelFilter) ([]ModelInfo, error)
    ListPolicies(ctx context.Context) ([]PolicyInfo, error)
    HealthCheck(ctx context.Context, health HealthTarget) error
    ResolveRoute(ctx context.Context, req RouteRequest) (*RouteDecision, error)
    RecordRouteAttempt(ctx context.Context, attempt RouteAttempt) error
    RouteStatus(ctx context.Context) (*RouteStatusReport, error)

    // Historical session-log projections. CONTRACT-003 owns these so CLI
    // subcommands such as log/replay/usage do not need to read the
    // internal session-log JSONL schema.
    UsageReport(ctx context.Context, opts UsageReportOptions) (*UsageReport, error)
    ListSessionLogs(ctx context.Context) ([]SessionLogEntry, error)
    WriteSessionLog(ctx context.Context, sessionID string, w io.Writer) error
    ReplaySession(ctx context.Context, sessionID string, w io.Writer) error
}

ServiceOptions

ServiceOptions configures a FizeauService instance.

type ServiceOptions struct {
    seamOptions

    ConfigPath string    // optional override; default $XDG_CONFIG_HOME/fizeau/config.yaml
    Logger     io.Writer // optional; agent writes structured session logs internally regardless

    // ServiceConfig, when non-nil, supplies provider and routing data for
    // ListProviders and HealthCheck. Pass a value wrapping the loaded config.
    // When nil, those methods return an error.
    ServiceConfig ServiceConfig

    // QuotaRefreshDebounce is the minimum interval between live quota probes for
    // a primary subscription harness. Zero uses the service default.
    QuotaRefreshDebounce time.Duration
    // QuotaRefreshStartupWait bounds startup waiting when the durable quota
    // cache is missing, stale, or incomplete. Zero uses the service default.
    QuotaRefreshStartupWait time.Duration
    // QuotaRefreshInterval enables periodic refresh for long-running server
    // processes. Zero disables the timer; cache refresh still happens on startup
    // and service activity.
    QuotaRefreshInterval time.Duration
    // QuotaRefreshContext optionally cancels the periodic server refresh worker.
    // When nil, the worker uses context.Background().
    QuotaRefreshContext context.Context

    // CatalogProbeTimeout bounds live /v1/models discovery during routing.
    // Zero uses the service default of 2s.
    CatalogProbeTimeout time.Duration
    // CatalogReloadTimeout bounds stale-while-revalidate catalog reloads.
    // Zero uses the service default of 30s.
    CatalogReloadTimeout time.Duration

    // LocalCostUSDPer1kTokens is the operator-supplied electricity/operations
    // estimate for local endpoint providers under the embedded agent harness.
    // Zero means local endpoint cost is unknown.
    LocalCostUSDPer1kTokens float64
    // SubscriptionCostCurve optionally overrides the default subscription
    // effective-cost curve used by routing.
    SubscriptionCostCurve *SubscriptionCostCurve

    // SessionLogDir overrides the directory used by historical session-log
    // projections (UsageReport, ListSessionLogs, WriteSessionLog,
    // ReplaySession). Empty falls back to ServiceConfig.SessionLogDir().
    // Per-Execute requests still set their own
    // ServiceExecuteRequest.SessionLogDir.
    SessionLogDir string

    // HarnessCleanupTimeout bounds stopping and reaping one wrapped harness
    // containment boundary. Zero uses the service default of 10 seconds.
    // Negative values are invalid.
    HarnessCleanupTimeout time.Duration

    // StaleHarnessReaperGrace is the minimum age before a startup reaper may
    // terminate an owned subprocess record. Zero uses the default grace window.
    StaleHarnessReaperGrace time.Duration

    // HealthProbeInterval is the interval between background aliveness probes
    // for configured non-cloud providers. Zero uses the default (60s).
    HealthProbeInterval time.Duration
    // HealthSignalTTL is the maximum age of a probe result before it expires
    // for routing purposes and when loading persisted route-health snapshots.
    // Zero uses the default (10 min).
    HealthSignalTTL time.Duration
    // PersistRouteHealth, when non-empty, is the file path where route-attempt
    // feedback and probe results are persisted across processes. The default is
    // "" so persistence stays opt-in.
    PersistRouteHealth string
    // AlivenessProber, when non-nil, overrides the default TCP-connect prober
    // used during startup and periodic aliveness probing. Nil uses the default.
    AlivenessProber ProviderAlivenessProber
}

ServiceExecuteRequest

ServiceExecuteRequest is the public ExecuteRequest type per CONTRACT-003.

type ServiceExecuteRequest struct {
    Prompt            string
    SystemPrompt      string
    Model             string
    Provider          string
    Harness           string
    Policy            string
    WorkDir           string
    Temperature       *float32
    TopP              *float64
    TopK              *int
    MinP              *float64
    RepetitionPenalty *float64
    Seed              *int64
    // SamplingSource is the comma-separated layer attribution produced by
    // internal/sampling.Resolve. Plumbed through to the llm.request
    // telemetry event for ADR-007 override-tracking; never on the wire.
    SamplingSource string
    Reasoning      Reasoning
    NoStream       bool
    Permissions    string
    // Tools overrides the built-in native agent tool set when Harness is
    // "fiz". Nil uses the native built-ins for ToolPreset and WorkDir.
    Tools []Tool
    // ToolPreset is passed through to BuiltinToolsForPreset when Tools is nil.
    // Empty uses the default tool set.
    ToolPreset string

    // PlanningMode, when true, performs one no-tool LLM "planning" call
    // before the main native agent loop and injects the response as an
    // assistant message wrapped in <plan> tags. The benchmark tool preset
    // auto-enables planning; this flag is the per-request opt-in for other
    // callers (e.g. the CLI --plan flag). Only honored when Harness=="fiz"
    // (the native loop). See internal/core.Request.PlanningMode.
    PlanningMode bool

    // EstimatedPromptTokens, when > 0, drives auto-selection's
    // context-window gate (filter out candidates whose context window is
    // too small for the prompt + safety margin).
    EstimatedPromptTokens int
    // RequiresTools, when true, drives auto-selection's tool-support gate
    // (filter out candidates that cannot invoke tools).
    RequiresTools bool
    MinPower      int
    MaxPower      int

    // CachePolicy is the public opt-out for prompt caching. Empty (the zero
    // value) and "default" both request the per-provider default caching
    // behavior; "off" disables caching for this request. Any other value is
    // rejected at the service boundary (see ValidateCachePolicy). Providers
    // that do not implement caching ignore the field; this field is read by
    // the Anthropic cache_control writer (bead C) and the cache-aware cost
    // attribution path (bead D).
    CachePolicy string

    // Three independent timeout knobs:
    //   Timeout         — wall-clock cap on the entire request.
    //   IdleTimeout     — streaming-quiet cap; per-stream gap.
    //   ProviderTimeout — per-HTTP-request cap to the provider.
    Timeout         time.Duration
    IdleTimeout     time.Duration
    ProviderTimeout time.Duration

    // Optional native-loop overrides used when Harness == "fiz". These let
    // the CLI and other callers route fully-resolved execution settings through
    // the service path instead of maintaining a divergent direct loop path.
    MaxIterations           int
    MaxTokens               int
    ReasoningByteLimit      int
    CompactionContextWindow int
    CompactionReserveTokens int

    // CostCapUSD is the per-run cost cap in USD, mirrored to
    // internal/core.Request.CostCapUSD. When > 0, the native loop halts
    // before issuing the next llm.request once running known cost plus the
    // projected next-turn cost would meet or exceed the cap; the resulting
    // final event reports Status="budget_halted". Zero means no cap. Per
    // FEAT-005 §28 / AC-FEAT-005-07, the cap requires turn cost to be known;
    // unknown-cost runs proceed past the cap with a stderr warning. Honored
    // only when Harness=="fiz" (the native loop) — subprocess harnesses
    // manage cost externally.
    CostCapUSD float64

    // Optional stall policy. When non-nil agent enforces and ends with
    // Status="stalled" if any limit hits. Default policy applies when nil.
    StallPolicy *StallPolicy

    // SessionLogDir overrides the default session-log directory for this
    // request (e.g. an execute-bead per-bundle evidence directory).
    SessionLogDir string

    // SelectedRoute is the configured model-route name the caller picked
    // (e.g. "code-pool"). Recorded into the service-owned session log so
    // post-hoc routing analytics can correlate logs to route keys without
    // reconstructing attribution from the event stream.
    SelectedRoute string

    // Metadata is bidirectional: echoed back in every Event AND stamped
    // onto every line of the session log so external consumers correlate.
    Metadata map[string]string

    // Role tags the kind of work this call performs (e.g. "implementer",
    // "reviewer", "decomposer", "summarizer"). Observational: echoed into
    // the routing_decision and final event Metadata, plus the session-log
    // header. Per CONTRACT-003 it is NOT part of the selection precedence
    // chain (Day 1) and does NOT affect routing. Empty means unset.
    //
    // Normalization: lowercased, alphanumeric + hyphen only, max 64 chars;
    // invalid values are rejected pre-dispatch with RoleNormalizationError.
    Role string
    // CorrelationID links calls that share work context (e.g.
    // "bead_123:attempt_4") so reviewer/implementer/retry attempts can be
    // joined in logs and aggregations. Observational: echoed into
    // routing_decision and final event Metadata, plus the session-log
    // header. Per CONTRACT-003 it is NOT part of the selection precedence
    // chain (Day 1) and does NOT affect routing. Empty means unset.
    //
    // Normalization: printable ASCII (no control chars, no whitespace
    // except hyphen, colon, underscore), max 256 chars; invalid values
    // are rejected pre-dispatch with CorrelationIDNormalizationError.
    CorrelationID string
}

ServiceEvent

ServiceEvent is a contract-level event (mirrors harnesses.

type ServiceEvent = harnesses.Event

ServiceConfig

ServiceConfig provides provider and routing data to the service without.

type ServiceConfig interface {
    // ProviderNames returns provider names in stable order (default first).
    ProviderNames() []string
    // DefaultProviderName returns the name of the configured default provider.
    DefaultProviderName() string
    // Provider returns the raw config values for a named provider.
    Provider(name string) (ServiceProviderEntry, bool)
    // HealthCooldown returns the configured cooldown duration (0 = use default 30s).
    HealthCooldown() time.Duration
    // WorkDir is the base directory for file-backed health state.
    WorkDir() string
    // SessionLogDir returns the configured sessions directory.
    SessionLogDir() string
}

ModelFilter

ModelFilter filters ListModels results.

type ModelFilter struct {
    Harness  string
    Provider string
}

ModelInfo

ModelInfo describes a model with full metadata per CONTRACT-003.

type ModelInfo struct {
    ID                            string
    Provider                      string
    ProviderType                  string
    Harness                       string
    EndpointName                  string
    EndpointBaseURL               string
    ServerInstance                string
    ContextLength                 int
    ContextSource                 string
    Utilization                   RouteUtilizationState
    Capabilities                  []string
    Cost                          CostInfo
    PerfSignal                    PerfSignal
    Power                         int
    AutoRoutable                  bool
    ExactPinOnly                  bool
    Billing                       BillingModel
    ActualCashSpend               bool
    EffectiveCost                 float64
    EffectiveCostSource           string
    SupportsTools                 bool
    DeploymentClass               string
    HealthFreshnessAt             time.Time
    HealthFreshnessSource         string
    QuotaFreshnessAt              time.Time
    QuotaFreshnessSource          string
    ModelDiscoveryFreshnessAt     time.Time
    ModelDiscoveryFreshnessSource string
    Available                     bool
    IsDefault                     bool // matches the configured default model
    RankPosition                  int  // ordinal in latest discovery rank; -1 if unranked
}

ProviderInfo

ProviderInfo describes a provider with live status per CONTRACT-003.

type ProviderInfo struct {
    Name             string
    Type             string // "openai" | "openrouter" | "lmstudio" | "omlx" | "ollama" | "anthropic" | "virtual"
    BaseURL          string
    Endpoints        []ServiceProviderEndpoint
    Status           string // "connected" | "unreachable" | "error: <msg>"
    ModelCount       int
    Capabilities     []string       // e.g. {"tool_use","streaming","json_mode"}
    Billing          BillingModel   // "fixed" | "per_token" | "subscription" | ""
    IncludeByDefault bool           // participates in unpinned/default routing
    IsDefault        bool           // matches the configured default_provider
    DefaultModel     string         // per-provider configured default model, if any
    CooldownState    *CooldownState // nil if not in cooldown
    Auth             AccountStatus
    EndpointStatus   []EndpointStatus
    Quota            *QuotaState
    UsageWindows     []UsageWindow
    LastError        *StatusError
}

HarnessInfo

HarnessInfo describes a registered harness as defined in CONTRACT-003.

type HarnessInfo struct {
    Name                 string
    Type                 string // "native" | "subprocess"
    Available            bool
    Path                 string
    Error                string
    Billing              BillingModel
    AutoRoutingEligible  bool
    TestOnly             bool
    ExactPinSupport      bool
    DefaultModel         string   // built-in default model when no override is supplied
    SupportedPermissions []string // subset of {"safe","supervised","unrestricted"}
    SupportedReasoning   []string // values such as {"low","medium","high","xhigh","max"}
    CostClass            string   // "local" | "cheap" | "medium" | "expensive"
    Quota                *QuotaState
    Account              *AccountStatus
    UsageWindows         []UsageWindow
    LastError            *StatusError
    CapabilityMatrix     HarnessCapabilityMatrix
}

RouteRequest

RouteRequest specifies a routing query.

type RouteRequest struct {
    Policy      string // optional named policy bundle: cheap|default|smart|air-gapped
    Model       string
    Provider    string
    Harness     string
    Reasoning   Reasoning
    Permissions string
    AllowLocal  bool
    Require     []string
    MinPower    int
    MaxPower    int

    // EstimatedPromptTokens, when > 0, filters out candidates whose context
    // window cannot accommodate the prompt (with a safety margin).
    EstimatedPromptTokens int

    // RequiresTools, when true, filters out candidates that do not support
    // tool calling.
    RequiresTools bool

    // CachePolicy mirrors ServiceExecuteRequest.CachePolicy. Routing decisions
    // today do not act on it; it is carried through so callers using
    // ResolveRoute as a public surface can plumb the same opt-out the
    // Execute path honors.
    CachePolicy string

    // Role tags the kind of work this call performs (e.g. "implementer",
    // "reviewer", "decomposer"). Observational only — it does NOT enter the
    // routing precedence chain. Mirrors ServiceExecuteRequest.Role so
    // ResolveRoute previews don't diverge from Execute.
    Role string

    // CorrelationID joins calls that share work context (e.g.
    // "bead_123:attempt_4"). Observational only — it does NOT enter the
    // routing precedence chain. Mirrors ServiceExecuteRequest.CorrelationID.
    CorrelationID string

    // ExcludedRoutes lists (Provider, Model, Endpoint) combinations the caller
    // has determined are currently unavailable. The router skips any candidate
    // matching an entry. Provider is required; Model and Endpoint are optional
    // (empty matches any value for that field).
    //
    // Use this to communicate caller-side health signals across calls without
    // redesigning provider config. The routing engine records excluded
    // candidates with FilterReasonCallerExcluded for observability.
    ExcludedRoutes []ExcludedRoute
}

RouteDecision

RouteDecision is the result of ResolveRoute.

type RouteDecision struct {
    // RequestedPolicy is the caller-supplied policy, when any.
    RequestedPolicy string
    // SnapshotCapturedAt records when the model snapshot used for scoring
    // was assembled.
    SnapshotCapturedAt time.Time
    // PowerPolicy records the effective policy inputs used for this
    // resolution. It stays separate from the chosen model so operator
    // surfaces can explain policy without re-deriving it.
    PowerPolicy RoutePowerPolicy
    // Harness is the selected harness name.
    Harness string
    // Provider is the selected provider for native agent routes.
    Provider string
    // Endpoint is the selected named endpoint when the provider exposes more
    // than one endpoint.
    Endpoint string
    // ServerInstance is the normalized server identity used for sticky
    // affinity and route evidence.
    ServerInstance string
    // Model is the selected concrete model.
    Model string
    // Reason summarizes why the selected candidate won.
    Reason string
    // Sticky captures whether this decision reused an existing sticky lease
    // or created a new one.
    Sticky RouteStickyState
    // Utilization captures the endpoint sample that informed the selected
    // candidate, when known.
    Utilization RouteUtilizationState
    // Power is the catalog-projected power of the selected Model
    // (per CONTRACT-003 § Catalog Power Projection). 0 means
    // unknown/exact-pin-only/no catalog entry. DDx callers read this
    // to compute next-attempt MinPower without importing catalog code.
    Power int
    // Candidates is the full ranked decision trace, including rejected
    // candidates and their rejection reasons.
    Candidates []RouteCandidate
}

Core functions

New

New constructs a FizeauService.

func New(opts ServiceOptions) (FizeauService, error)

RegisterConfigLoader

RegisterConfigLoader is called by the config package’s init() to install the.

func RegisterConfigLoader(fn func(dir string) (ServiceConfig, error))

Full exported surface

Generated from go/doc over the root package. For full doc comments, parameter types, and field-level documentation, follow the pkg.go.dev link.

NameKindSynopsis
AccountStatustype (struct)AccountStatus describes authentication/account state without exposing
AnchorStoretype (alias)
AvailableHarnessesfunc (func AvailableHarnesses() []string)AvailableHarnesses returns the canonical names of every harness whose CLI
BashOutputFilterConfigtype (alias)
BillingModeltype (alias)
BillingModelFixedconst
BillingModelPerTokenconst
BillingModelSubscriptionconst
BillingModelUnknownconst
CachePolicyDefaultconstValid CachePolicy values
CachePolicyOffconstValid CachePolicy values
CatalogProbeFunctype (func)CatalogProbeFunc performs a single /v1/models discovery request against a
CatalogResulttype (struct)CatalogResult is what callers receive from catalog discovery
CompactionConfigtype (alias)
ContextSourceCatalogconst
ContextSourceDefaultconst
ContextSourceProviderAPIconst
ContextSourceProviderConfigconst
ContextSourceUnknownconst
CooldownStatetype (struct)CooldownState describes an active routing cooldown for a provider
CorrelationIDNormalizationErrortype (struct)CorrelationIDNormalizationError is returned pre-dispatch when
CostInfotype (struct)CostInfo holds per-token cost metadata for a model
DecisionWithCandidatestype (interface)DecisionWithCandidates is implemented by routing errors that retain the
DecodeServiceEventfunc (func DecodeServiceEvent(ev ServiceEvent) (ServiceDecodedEvent, error))
DefaultOpenrouterCreditBalanceThresholdUSDconstDefaultOpenrouterCreditBalanceThresholdUSD is the floor below which a
DefaultOpenrouterCreditProbeTTLconstDefaultOpenrouterCreditProbeTTL bounds how long a cached balance reading
DiscoverModelsfunc (func DiscoverModels(ctx context.Context, baseURL, apiKey string) ([]string, error))
DrainExecutefunc (func DrainExecute(ctx context.Context, events <-chan ServiceEvent) (*DrainExecuteResult, error))
DrainExecuteResulttype (struct)DrainExecuteResult is a typed aggregate of one Execute event stream
EndpointStatustype (struct)EndpointStatus describes one configured provider endpoint probe
ErrDiscoveryUnsupportedfunc (func ErrDiscoveryUnsupported() error)ErrDiscoveryUnsupported returns the sentinel
ErrHarnessModelIncompatibletype (struct)ErrHarnessModelIncompatible reports an explicit Harness+Model pin that the
ErrModelConstraintAmbiguoustype (struct)ErrModelConstraintAmbiguous reports that an explicit Model pin matched more
ErrModelConstraintNoMatchtype (struct)ErrModelConstraintNoMatch reports that an explicit Model pin matched no
ErrNoLiveProvidertype (struct)ErrNoLiveProvider reports that profile-tier escalation walked the entire
ErrPolicyRequirementUnsatisfiedtype (struct)ErrPolicyRequirementUnsatisfied reports a hard policy requirement that no
ErrRejectedOverridetype (struct)ErrRejectedOverride wraps a pin-rejection error and carries the
ErrUnknownPolicytype (struct)ErrUnknownPolicy reports an explicit policy name that is not present in the
ErrUnknownProvidertype (struct)ErrUnknownProvider reports an explicit Provider pin that is not present in
ErrUnsatisfiablePintype (struct)ErrUnsatisfiablePin reports explicit caller pins that cannot all be true at
EventSessionEndconst
EventSessionStartconst
ExcludedRoutetype (struct)ExcludedRoute identifies a (Provider, Model, optional Endpoint) combination
FilterReasonAboveMaxPowerconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonContextTooSmallconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonEndpointUnreachableconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonMeteredOptInRequiredconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonNoToolSupportconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonProviderExcludedFromDefaultconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonReasoningUnsupportedconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonScoredBelowTopconstFilterReason* enumerate the canonical disqualification reasons surfaced
FilterReasonUnhealthyconstFilterReason* enumerate the canonical disqualification reasons surfaced
FizeauServicetype (interface)FizeauService is the entire public Go surface of the fizeau module
HarnessAvailabilitytype (struct)HarnessAvailability reports the install status of a single harness CLI as
HarnessCapabilitytype (struct)HarnessCapability describes one capability row for one harness
HarnessCapabilityMatrixtype (struct)HarnessCapabilityMatrix is the public, per-harness capability table exposed
HarnessCapabilityStatustypeHarnessCapabilityStatus classifies one harness capability in the public
HarnessInfotype (struct)HarnessInfo describes a registered harness as defined in CONTRACT-003
HealthTargettype (struct)HealthTarget identifies what to health-check
MetadataKeyCorrelationIDconstReserved cross-tool metadata keys (CONTRACT-003 § ExecuteRequest
MetadataKeyRoleconstReserved cross-tool metadata keys (CONTRACT-003 § ExecuteRequest
MetadataWarningCodeKeyCollisionconstMetadataWarningCodeKeyCollision is the ServiceFinalWarning
ModelFiltertype (struct)ModelFilter filters ListModels results
ModelInfotype (struct)ModelInfo describes a model with full metadata per CONTRACT-003
Newfunc (func New(opts ServiceOptions) (FizeauService, error))New constructs a FizeauService
NoViableProviderForNowtype (struct)NoViableProviderForNow reports that every otherwise-eligible routing
NormalizeModelIDfunc (func NormalizeModelID(requested string, catalog []string) (string, error))
OverrideClassBuckettype (struct)OverrideClassBucket is one cell in the override-class pivot
PerfSignaltype (struct)PerfSignal holds observed performance data for a model
PolicyInfotype (struct)
ProviderAlivenessProbertype (func)ProviderAlivenessProber reports whether a provider endpoint is reachable
ProviderBurnRateTrackertype (struct)ProviderBurnRateTracker maintains a per-provider rolling window of token
ProviderInfotype (struct)ProviderInfo describes a provider with live status per CONTRACT-003
ProviderQuotaStatetypeProviderQuotaState is the state of one provider in the quota state machine
ProviderQuotaStateStoretype (struct)ProviderQuotaStateStore is the per-provider quota state machine
QuotaRecoveryProbertype (func)QuotaRecoveryProber reports whether a quota_exhausted provider has recovered
QuotaStatetype (struct)QuotaState is a live quota snapshot for a harness
RankModelsfunc (func RankModels(candidates []string, knownModels map[string]string, pattern string) ([]ScoredModel, error))
ReadSessionEventsfunc (func ReadSessionEvents(path string) ([]SessionEvent, error))
ReadTooltype (alias)
Reasoningtype (alias)
ReasoningAutoconst
ReasoningHighconst
ReasoningLowconst
ReasoningMaxconst
ReasoningMediumconst
ReasoningMinimalconst
ReasoningOffconst
ReasoningXHighconst
RegisterConfigLoaderfunc (func RegisterConfigLoader(fn func(dir string) (ServiceConfig, error)))RegisterConfigLoader is called by the config package’s init() to install the
RoleNormalizationErrortype (struct)RoleNormalizationError is returned pre-dispatch when ServiceExecuteRequest
RouteAttempttype (struct)RouteAttempt is caller feedback about one attempted route candidate
RouteCandidatetype (struct)RouteCandidate is one routing candidate evaluated by ResolveRoute
RouteCandidateComponentstype (struct)RouteCandidateComponents breaks down the inputs that fed a candidate’s
RouteCandidateStatustype (struct)RouteCandidateStatus describes a single live provider/model candidate
RouteDecisiontype (struct)RouteDecision is the result of ResolveRoute
RoutePowerPolicytype (struct)RoutePowerPolicy captures the numeric power-policy inputs associated with
RouteRequesttype (struct)RouteRequest specifies a routing query
RouteStatusEntrytype (struct)RouteStatusEntry describes the live provider candidates serving one model
RouteStatusReporttype (struct)RouteStatusReport is returned by RouteStatus
RouteStatusRoutingQualityWindowconstRouteStatusRoutingQualityWindow caps how many recent Execute calls
RouteStickyStatetype (struct)RouteStickyState describes sticky routing evidence without exposing the
RouteUtilizationStatetype (struct)RouteUtilizationState summarizes the live utilization sample associated
RoutingQualityMetricstype (struct)RoutingQualityMetrics is the bundle of three first-class metrics ADR-006
ScanSkillsDirfunc (func ScanSkillsDir(dir string) (*SkillCatalog, []string, error))ScanSkillsDir walks dir for SKILL
ScoredModeltype (alias)
ServiceCompactionDatatype (struct)
ServiceConfigtype (interface)ServiceConfig provides provider and routing data to the service without
ServiceConfigSourcetype (interface)ServiceConfigSource is retained for source compatibility with consumers that
ServiceDecodedEventtype (struct)ServiceDecodedEvent is a typed view of one ServiceEvent
ServiceEventtype (alias)ServiceEvent is a contract-level event (mirrors harnesses
ServiceEventTypeCompactionconst
ServiceEventTypeFinalconst
ServiceEventTypeOverrideconst
ServiceEventTypeProgressconst
ServiceEventTypeRejectedOverrideconst
ServiceEventTypeRoutingDecisionconst
ServiceEventTypeStallconst
ServiceEventTypeTextDeltaconst
ServiceEventTypeToolCallconst
ServiceEventTypeToolResultconst
ServiceExecuteRequesttype (struct)ServiceExecuteRequest is the public ExecuteRequest type per CONTRACT-003
ServiceFinalDatatype (struct)
ServiceFinalUsagetype (struct)ServiceFinalUsage is the public token-usage payload emitted on service
ServiceFinalWarningtype (struct)
ServiceOptionstype (struct)ServiceOptions configures a FizeauService instance
ServiceOverrideAutoComponentstype (struct)ServiceOverrideAutoComponents mirrors RouteCandidateComponents for the
ServiceOverrideDatatype (struct)ServiceOverrideData is the payload for both override and rejected_override
ServiceOverrideOutcometype (struct)ServiceOverrideOutcome carries post-execution status mirrored from the
ServiceOverridePintype (struct)ServiceOverridePin captures a (harness, provider, model) tuple, used both
ServiceOverridePromptFeaturestype (struct)ServiceOverridePromptFeatures captures prompt-classification inputs that
ServiceProgressDatatype (struct)ServiceProgressData is the bounded progress payload emitted alongside the
ServiceProviderEndpointtype (struct)ServiceProviderEndpoint is one configured provider serving endpoint
ServiceProviderEntrytype (struct)ServiceProviderEntry carries the minimal provider data the service needs
ServiceRoutingActualtype (struct)
ServiceRoutingDecisionCandidatetype (struct)ServiceRoutingDecisionCandidate is one entry in the routing-decision
ServiceRoutingDecisionComponentstype (struct)ServiceRoutingDecisionComponents exposes the per-axis score inputs
ServiceRoutingDecisionDatatype (struct)
ServiceRoutingStickyStatetype (struct)
ServiceRoutingUtilizationStatetype (struct)
ServiceStallDatatype (struct)
ServiceTextDeltaDatatype (struct)
ServiceToolCallDatatype (struct)
ServiceToolResultDatatype (struct)
ServiceUsageSourceEvidencetype (struct)
ServiceUsageTokenCountstype (struct)
SessionEndDatatype (struct)SessionEndData is the root-owned public projection of a durable
SessionEventtype (alias)
SessionEventTypetype (alias)
SessionLogEntrytype (struct)SessionLogEntry describes one historical session log file projected from the
SessionLoggertype (alias)SessionLogger writes session log events
SessionOutcometypeSessionOutcome is the stable coarse result of one accepted Fizeau session
SessionStagetypeSessionStage is the Fizeau-owned lifecycle stage that determined a terminal
SessionStartDatatype (alias)
SessionStatustype (alias)
SkillCatalogtype (alias)
StallPolicytype (struct)StallPolicy bounds how long the agent will spin without making progress
StatusErrortype (struct)StatusError describes the most recent normalized status error for a harness,
StatusSuccessconst
SubscriptionCostCurvetype (struct)SubscriptionCostCurve tunes effective subscription cost by quota utilization
TerminalCausetypeTerminalCause is the stable reason a session terminalized
TokenUsagetype (alias)
Tooltype (alias)
UsageReporttype (struct)UsageReport is the public, service-owned aggregation over historical session
UsageReportOptionstype (struct)UsageReportOptions configures FizeauService
UsageReportRowtype (struct)UsageReportRow aggregates usage for one provider/model pair
UsageReportWindowtype (struct)UsageReportWindow describes the active reporting window
UsageWindowtype (struct)UsageWindow describes normalized usage attribution over a time window
ValidateCachePolicyfunc (func ValidateCachePolicy(v string) error)ValidateCachePolicy returns nil when v is one of the accepted CachePolicy
ValidateCorrelationIDfunc (func ValidateCorrelationID(id string) error)ValidateCorrelationID returns nil when id is empty or normalized, and a
ValidatePowerBoundsfunc (func ValidatePowerBounds(minPower, maxPower int) error)ValidatePowerBounds returns nil when the optional numeric routing power
ValidateRolefunc (func ValidateRole(role string) error)ValidateRole returns nil when role is empty (unset) or already
ValidateUsageSincefunc (func ValidateUsageSince(spec string) error)ValidateUsageSince returns nil when spec is a usage window value accepted by
adaptModelConstraintErrorfunc (func adaptModelConstraintError(err error) error)
appendUniqueModelIDsfunc (func appendUniqueModelIDs(values []string, additions …string) []string)
applyCatalogPolicyResultToRoutingRequestfunc (func applyCatalogPolicyResultToRoutingRequest(req *routing.Request, result serviceimpl.CatalogPolicyResult))
applyRouteSnapshotEvidencefunc (func applyRouteSnapshotEvidence(candidate *RouteCandidate, row modelsnapshot.KnownModel))
applyServiceImplExecuteRouteDecisionfunc (func applyServiceImplExecuteRouteDecision(result *RouteDecision, decision serviceimpl.ExecuteRouteDecision))
assembleModelSnapshotFromServiceConfigfunc (func assembleModelSnapshotFromServiceConfig(ctx context.Context, sc ServiceConfig, cat *modelcatalog.Catalog, cacheRoot string) (modelsnapshot.ModelSnapshot, error))
assembleModelSnapshotFromServiceConfigWithOptionsfunc (func assembleModelSnapshotFromServiceConfigWithOptions(ctx context.Context, sc ServiceConfig, cat *modelcatalog.Catalog, cacheRoot string, opts modelsnapshot.AssembleOptions) (modelsnapshot.ModelSnapshot, error))
attachRuntimeSignalToModelInfofunc (func attachRuntimeSignalToModelInfo(info *ModelInfo, providerName string))
autoRoutingModelsForHarnessfunc (func autoRoutingModelsForHarness(name string, cfg harnesses.HarnessConfig, cat *modelcatalog.Catalog) []string)
axesOverriddenfunc (func axesOverridden(req ServiceExecuteRequest) []string)axesOverridden returns the canonical, ordered list of axes the caller
capabilityScoreForCostClassfunc (func capabilityScoreForCostClass(class string) float64)capabilityScoreForCostClass maps the harness cost class to a coarse
catalogCostAndPerffunc (func catalogCostAndPerf(cat *modelcatalog.Catalog, modelID string) (CostInfo, PerfSignal))catalogCostAndPerf extracts CostInfo and PerfSignal for a model from the catalog
catalogModelsForHarnessfunc (func catalogModelsForHarness(name string, cfg harnesses.HarnessConfig, cat *modelcatalog.Catalog) []string)
catalogPowerEligibilityfunc (func catalogPowerEligibility(cat *modelcatalog.Catalog, modelID string) (int, bool, bool))
catalogPowerForModelfunc (func catalogPowerForModel(cat *modelcatalog.Catalog, modelID string) int)catalogPowerForModel returns the catalog-projected power for a model
claudeCLIExecutableModelfunc (func claudeCLIExecutableModel(model string) string)
cloneStringMapfunc (func cloneStringMap(src map[string]string) map[string]string)
compactionAssertionHookFntype (func)
convertUsageWindowfunc (func convertUsageWindow(w *UsageReportWindow) *session.UsageWindow)
copyScoreComponentsfunc (func copyScoreComponents(in map[string]float64) map[string]float64)
correlationIDMaxLenconstCorrelationID normalization bounds (CONTRACT-003)
decodeServicePayloadfunc (func decodeServicePayload(ev ServiceEvent, dst any) error)
defaultCatalogProbeTimeoutconst
defaultCatalogReloadTimeoutconst
defaultHarnessCleanupTimeoutconst
defaultHarnessInstancesfunc (func defaultHarnessInstances() map[string]harnesses.Harness)defaultHarnessInstances returns the production map of registered
defaultStaleHarnessReaperGraceconst
discoveryUnsupportedErrortype (struct)
effectiveReasoningStringfunc (func effectiveReasoningString(value Reasoning) string)
endpointDisplayNamefunc (func endpointDisplayName(name, baseURL string) string)
endpointProviderReffunc (func endpointProviderRef(providerName, endpointName string) string)
endpointStatusfunc (func endpointStatus(status string) string)
errDiscoveryUnsupportedvarerrDiscoveryUnsupported is the public-package sentinel for an endpoint
errHarnessModelIncompatiblevar
errModelConstraintAmbiguousvar
errModelConstraintNoMatchvar
errNoLiveProvidervar
errNoViableProviderForNowvar
errPolicyRequirementUnsatisfiedvar
errUnknownPolicyvar
errUnknownProvidervar
errUnsatisfiablePinvar
escalatePolicyLadderfunc (func escalatePolicyLadder(req routing.Request, in routing.Inputs, origErr error, displayPolicy string) (bool, *routing.Decision, error))escalatePolicyLadder walks routing
executeCollisionWarningfunc (func executeCollisionWarning(req ServiceExecuteRequest) *harnesses.FinalWarning)
executeOverridePayloadfunc (func executeOverridePayload(ovr *overrideContext, sessionID string) json.RawMessage)executeOverridePayload projects the root override record into the
executeRouteProvidersfunc (func executeRouteProviders(config ServiceConfig) (map[string]serviceimpl.ProviderEntry, []string))
explicitPolicyConstraintfunc (func explicitPolicyConstraint(policy string) (string, bool))
extractStatusCodefunc (func extractStatusCode(msg string) int)extractStatusCode pulls the status code out of the “HTTP NNN:” prefix
generateSessionIDfunc (func generateSessionID() string)generateSessionID returns a unique session identifier for a new Execute
harnessDefaultModelfunc (func harnessDefaultModel(name string, cfg harnesses.HarnessConfig, cat *modelcatalog.Catalog) string)
harnessInstanceHookvarharnessInstanceHook, when non-nil, is applied to the default harness map
harnessRunsInProcessOrHTTPfunc (func harnessRunsInProcessOrHTTP(cfg harnesses.HarnessConfig) bool)
harnessSourcefunc (func harnessSource(req ServiceExecuteRequest) string)
harnessTypefunc (func harnessType(cfg harnesses.HarnessConfig) string)harnessType returns “native” for HTTP/embedded harnesses, “subprocess” for CLI-invoked ones
internalRouteAttemptfunc (func internalRouteAttempt(attempt RouteAttempt) routehealth.Attempt)
isExplicitPinErrorfunc (func isExplicitPinError(err error) bool)
lastDecisionEntrytype (struct)
loadRoutingCatalogvar
loadServiceConfigvarloadServiceConfig, when non-nil, is called by New to load a ServiceConfig
logPersistRouteHealthWarningfunc (func logPersistRouteHealthWarning(w io.Writer, path string, err error))
makeOverrideEventfunc (func makeOverrideEvent(ovr *overrideContext, sessionID string, finalEv ServiceEvent, meta map[string]string) (ServiceEvent, ServiceOverrideData, bool))makeOverrideEvent constructs the wire-level override event, stamping
makeRejectedOverrideEventfunc (func makeRejectedOverrideEvent(ovr *overrideContext, sessionID string, pinErr error, meta map[string]string) (ServiceEvent, ServiceOverrideData, bool))makeRejectedOverrideEvent constructs a rejected_override event from the
metaWithRoleAndCorrelationfunc (func metaWithRoleAndCorrelation(meta map[string]string, role, correlationID string) map[string]string)metaWithRoleAndCorrelation overlays the caller-supplied top-level Role
metadataKeyCollisionMessagefunc (func metadataKeyCollisionMessage(keys []string) string)metadataKeyCollisionMessage formats a human-readable message for the
metadataReservedKeyCollisionsfunc (func metadataReservedKeyCollisions(meta map[string]string, role, correlationID string) []string)metadataReservedKeyCollisions returns the reserved metadata keys whose
modelDiscoveryEndpointtype (struct)
modelSnapshotProviderConfigfunc (func modelSnapshotProviderConfig(entry ServiceProviderEntry) modelsnapshot.ProviderConfig)
modelSupportedForHarnessfunc (func modelSupportedForHarness(name string, cfg harnesses.HarnessConfig, model, provider string) bool)
nativeProviderResolutiontype (struct)
nativeRouteCandidatesfunc (func nativeRouteCandidates(in []RouteCandidate) []serviceimpl.NativeRouteCandidate)
normalizeServiceProviderTypefunc (func normalizeServiceProviderType(t string) string)
openrouterProbeProjectiontype (struct)openrouterProbeProjection is the root facade’s narrow adaptation from
overrideAxisHarnessconstoverrideAxis* enumerates the three independently-tracked override axes
overrideAxisModelconstoverrideAxis* enumerates the three independently-tracked override axes
overrideAxisProviderconstoverrideAxis* enumerates the three independently-tracked override axes
overrideContexttype (struct)overrideContext carries the per-Execute override-event payload from the
overrideReasonHintfunc (func overrideReasonHint(req ServiceExecuteRequest) string)overrideReasonHint returns the caller-supplied free-form reason from
positiveScorePartfunc (func positiveScorePart(v float64) float64)
probeOpenAIModelsfunc (func probeOpenAIModels(ctx context.Context, baseURL, apiKey string) ([]string, error))probeOpenAIModels calls GET /v1/models against baseURL and classifies
promptAssertionHookFntype (func)promptAssertionHookFn / compactionAssertionHookFn / toolWiringHookFn
providerCapabilitiesfunc (func providerCapabilities(entry ServiceProviderEntry) []string)providerCapabilities returns the capability set for a provider entry
providerTypeUsesFixedBillingfunc (func providerTypeUsesFixedBilling(providerType string) bool)
publicCatalogPolicyErrorfunc (func publicCatalogPolicyError(failure *serviceimpl.CatalogPolicyFailure) error)
publicExecuteRouteFailurefunc (func publicExecuteRouteFailure(failure *serviceimpl.ExecuteRouteFailure) error)
publicFilterReasonfunc (func publicFilterReason(c routing.Candidate) string)publicFilterReason maps the typed FilterReason emitted by the internal
publicRoutingErrorfunc (func publicRoutingError(err error, candidates []RouteCandidate, requestedPolicy …string) error)
publicToRoutingExcludedRoutesfunc (func publicToRoutingExcludedRoutes(in []ExcludedRoute) []routing.ExcludedRoute)
quotaStatusfunc (func quotaStatus(fresh bool, windows []harnesses.QuotaWindow) string)
reapStaleHarnessRecordsfunc (func reapStaleHarnessRecords(dir string, grace time.Duration, now time.Time) error)
recordExecuteOverrideOutcomefunc (func recordExecuteOverrideOutcome(ovr *overrideContext, status string))
requestedNativeProviderTypefunc (func requestedNativeProviderType(req ServiceExecuteRequest) string)
resolveContextEvidencefunc (func resolveContextEvidence(ctx context.Context, entry ServiceProviderEntry, modelID string, cat *modelcatalog.Catalog) (int, string))resolveContextEvidence resolves the context window for a model using the
resolveSubprocessModelAliasvar
resolveSubprocessModelAliasWithCatalogfunc (func resolveSubprocessModelAliasWithCatalog(harness, model string, cat *modelcatalog.Catalog) string)
roleMaxLenconstRole normalization bounds (CONTRACT-003)
routeDecisionErrortype (struct)
routeSnapshotCandidateIndexfunc (func routeSnapshotCandidateIndex(snapshot modelsnapshot.ModelSnapshot) map[routeSnapshotCandidateKey]modelsnapshot.KnownModel)
routeSnapshotCandidateKeytype (struct)
routeSnapshotEvidenceForCandidatefunc (func routeSnapshotEvidenceForCandidate(candidate RouteCandidate, snapshot modelsnapshot.ModelSnapshot) (modelsnapshot.KnownModel, bool))
routingHarnessEntryFromMetadatafunc (func routingHarnessEntryFromMetadata(name string, cfg harnesses.HarnessConfig, st harnesses.HarnessStatus) routing.HarnessEntry)
routingHarnessUsesAccountBillingfunc (func routingHarnessUsesAccountBilling(entry *routing.HarnessEntry) bool)
scorePowerHintFitfunc (func scorePowerHintFit(candidate routing.Candidate, policy RoutePowerPolicy) float64)
seamOptionstype (struct)seamOptions is empty in production builds
servicetype (struct)service is the concrete FizeauService implementation
serviceConfigToModelSnapshotConfigfunc (func serviceConfigToModelSnapshotConfig(sc ServiceConfig) *modelsnapshot.Config)
serviceImplExecuteRouteDecisionfunc (func serviceImplExecuteRouteDecision(decision *RouteDecision) serviceimpl.ExecuteRouteDecision)
serviceImplProviderEntryfunc (func serviceImplProviderEntry(entry ServiceProviderEntry) serviceimpl.ProviderEntry)
serviceProviderDefaultInclusionfunc (func serviceProviderDefaultInclusion(entry ServiceProviderEntry) bool)
serviceRoutingCatalogfunc (func serviceRoutingCatalog() *modelcatalog.Catalog)
serviceSnapshotCacheRootfunc (func serviceSnapshotCacheRoot() (string, error))
shouldAutoLoadServiceConfigfunc (func shouldAutoLoadServiceConfig(ServiceOptions) bool)
shouldEscalateOnErrorfunc (func shouldEscalateOnError(err error) bool)shouldEscalateOnError gates ladder escalation to “no eligible candidate”
splitEndpointProviderReffunc (func splitEndpointProviderRef(ref string) (string, string, bool))
staticHarnessAliasesfunc (func staticHarnessAliases(name string) []string)
statusErrorTypefunc (func statusErrorType(status string) string)
statusViewProviderfunc (func statusViewProvider(entry ServiceProviderEntry) statusview.ServiceProvider)
stringInfunc (func stringIn(xs []string, v string) bool)
subprocessHarnessAutoRoutingModelsvar
subprocessHarnessModelIDsvarsubprocessHarnessModelIDs resolves the documented CLI model surface for a
supportedModelsForHarnessfunc (func supportedModelsForHarness(name string, cfg harnesses.HarnessConfig, cat *modelcatalog.Catalog) []string)
supportedPermissionsfunc (func supportedPermissions(cfg harnesses.HarnessConfig) []string)supportedPermissions extracts the permission levels from PermissionArgs keys,
supportedReasoningfunc (func supportedReasoning(cfg harnesses.HarnessConfig) []string)
toRoutingQualityOverridefunc (func toRoutingQualityOverride(ov ServiceOverrideData) *routingquality.OverrideData)
toTranscriptRouteDecisionfunc (func toTranscriptRouteDecision(decision RouteDecision) transcript.RouteProgressDecision)
toolWiringHookFntype (func)
validateExplicitHarnessModelfunc (func validateExplicitHarnessModel(name string, cfg harnesses.HarnessConfig, model, provider string) error)
validateExplicitHarnessPolicyfunc (func validateExplicitHarnessPolicy(name string, cfg harnesses.HarnessConfig, policy string) error)
withRouteCandidatesfunc (func withRouteCandidates(err error, candidates []RouteCandidate) error)

Where to look next

  • github.com/easel/fizeau — the root facade: FizeauService, request and event types, public errors, and compatibility wrappers that keep embedders off internal/.
  • internal/serviceimpl/, internal/transcript/, internal/routehealth/, internal/quota/, and internal/routingquality/ — the concrete runtime owners behind the facade. These are useful for repo orientation but remain intentionally non-importable.
  • AGENTS.md — package layout and the rules about what’s public vs internal/; read this before adding new exports.
  • agentcli/ — mountable command tree backed by the public service facade. Importable from your own CLI binary if you want fiz subcommands.

Sub-packages

Most of the implementation lives under internal/ and is intentionally not importable. The packages a third-party Go consumer can actually use are:

  • github.com/easel/fizeau — the root facade (this page).
  • github.com/easel/fizeau/configinit — blank-import to register the default YAML config loader.
  • github.com/easel/fizeau/agentcli — mountable CLI commands.
  • github.com/easel/fizeau/catalogdist — model catalog distribution helpers.
  • github.com/easel/fizeau/telemetry — runtime telemetry scaffolding for invoke_agent / chat / execute_tool spans.

Regenerating this page

This page is generated by cmd/docgen-embedding from the source code. Regenerate after any change to the public API:

make docs-embedding

The generator is deterministic — running it twice yields byte-identical output.