Documentation
¶
Overview ¶
Package runtimekit composes agentic-moe into a batteries-included planning runtime.
Index ¶
- Constants
- func Migrate(body []byte) ([]byte, error)
- func Schema() map[string]any
- func SchemaJSON() ([]byte, error)
- type Config
- type Duration
- type ExpertConfig
- type ExpertView
- type HTTPConfig
- type HealthReport
- type Manifest
- type ModelConfig
- type OllamaConfig
- type Options
- type Overrides
- type PlanOptions
- type PlanView
- type ProviderSource
- type ProviderStatus
- type RoutingInput
- type Runtime
- func (r *Runtime) Close() error
- func (r *Runtime) Health(ctx context.Context) HealthReport
- func (r *Runtime) Manifest() Manifest
- func (r *Runtime) Plan(_ context.Context, query string, routing RoutingInput) (PlanView, error)
- func (r *Runtime) PlanForExpert(_ context.Context, id string) (PlanView, error)
- func (r *Runtime) Validate() error
- type RuntimeConfig
- type SelectionView
- type TierView
Examples ¶
Constants ¶
const ConfigVersion = 1
ConfigVersion is the latest supported on-disk configuration version.
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
Migrate upgrades supported legacy configuration to the current schema. Versionless v0 files are the only legacy form and map directly to v1.
func SchemaJSON ¶
SchemaJSON renders the schema deterministically enough for CLI output.
Types ¶
type Config ¶
type Config struct {
Version int `json:"version" yaml:"version"`
Runtime RuntimeConfig `json:"runtime" yaml:"runtime"`
Models ModelConfig `json:"models" yaml:"models"`
Experts []ExpertConfig `json:"experts" yaml:"experts"`
Ollama OllamaConfig `json:"ollama" yaml:"ollama"`
HTTP HTTPConfig `json:"http" yaml:"http"`
}
Config is the portable YAML or JSON configuration contract.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a safe local configuration with general-purpose experts.
type Duration ¶
Duration is a human-readable time.Duration used consistently by YAML and JSON.
func (Duration) MarshalJSON ¶
MarshalJSON renders a quoted human-readable duration.
func (Duration) MarshalText ¶
MarshalText renders a duration in Go's stable duration syntax.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON requires a quoted human-readable duration.
func (*Duration) UnmarshalText ¶
UnmarshalText accepts values such as "5s" and "250ms".
type ExpertConfig ¶
type ExpertConfig struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
Keywords []string `json:"keywords" yaml:"keywords"`
NegativeKeywords []string `json:"negative_keywords,omitempty" yaml:"negative_keywords,omitempty"`
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"`
DefaultTier string `json:"default_tier" yaml:"default_tier"`
Priority int `json:"priority" yaml:"priority"`
CanSynthesize bool `json:"can_synthesize,omitempty" yaml:"can_synthesize,omitempty"`
MaxIterations int `json:"max_iterations,omitempty" yaml:"max_iterations,omitempty"`
MaxToolCalls int `json:"max_tool_calls,omitempty" yaml:"max_tool_calls,omitempty"`
}
ExpertConfig describes a declarative expert available through every SDK.
type ExpertView ¶
type ExpertView struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
DefaultTier string `json:"default_tier"`
CanSynthesize bool `json:"can_synthesize,omitempty"`
}
ExpertView is a stable public projection of an expert definition.
type HTTPConfig ¶
type HTTPConfig struct {
Address string `json:"address" yaml:"address"`
BearerTokenEnv string `json:"bearer_token_env,omitempty" yaml:"bearer_token_env,omitempty"`
AllowedHosts []string `json:"allowed_hosts,omitempty" yaml:"allowed_hosts,omitempty"`
AllowedOrigins []string `json:"allowed_origins,omitempty" yaml:"allowed_origins,omitempty"`
MaxBodyBytes int64 `json:"max_body_bytes" yaml:"max_body_bytes"`
MaxConcurrent int `json:"max_concurrent" yaml:"max_concurrent"`
RequestTimeout Duration `json:"request_timeout" yaml:"request_timeout"`
ShutdownGrace Duration `json:"shutdown_grace" yaml:"shutdown_grace"`
}
HTTPConfig controls the optional stateless MCP HTTP endpoint.
type HealthReport ¶
type HealthReport struct {
Status string `json:"status"`
CheckedAt time.Time `json:"checked_at"`
Providers []ProviderStatus `json:"providers"`
}
HealthReport describes runtime and provider readiness.
type Manifest ¶
type Manifest struct {
SchemaVersion int `json:"schema_version"`
Experts []ExpertView `json:"experts"`
Providers []string `json:"providers,omitempty"`
SideEffectsEnabled bool `json:"side_effects_enabled"`
Transports []string `json:"transports"`
}
Manifest describes capabilities without initiating provider access.
type ModelConfig ¶
type ModelConfig struct {
Fast string `json:"fast" yaml:"fast"`
Balanced string `json:"balanced" yaml:"balanced"`
Strong string `json:"strong" yaml:"strong"`
}
ModelConfig maps abstract planner tiers to host-owned model identifiers.
type OllamaConfig ¶
type OllamaConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
BaseURL string `json:"base_url" yaml:"base_url"`
AllowRemote bool `json:"allow_remote" yaml:"allow_remote"`
Timeout Duration `json:"timeout" yaml:"timeout"`
MaxBodyBytes int64 `json:"max_body_bytes" yaml:"max_body_bytes"`
ContextWindow int `json:"context_window" yaml:"context_window"`
MaxParallel int `json:"max_parallel" yaml:"max_parallel"`
}
OllamaConfig enables read-only discovery against an Ollama API.
type Options ¶
type Options struct {
Skills *skills.Registry
ProviderSources []ProviderSource
}
Options supplies optional host-owned integrations.
type Overrides ¶
type Overrides struct {
HTTPAddress string
}
Overrides are explicit CLI values applied after environment variables.
type PlanOptions ¶
type PlanOptions struct {
ToolCallModel string `json:"tool_call_model,omitempty"`
SynthesisModel string `json:"synthesis_model,omitempty"`
ResponseTokenBudget int `json:"response_token_budget"`
EnableChunking bool `json:"enable_chunking"`
MaxIterations int `json:"max_iterations"`
MaxToolCalls int `json:"max_tool_calls"`
}
PlanOptions are execution limits for the host-owned model loop.
type PlanView ¶
type PlanView struct {
Expert ExpertView `json:"expert"`
Selection SelectionView `json:"selection"`
SystemPromptAugmentation string `json:"system_prompt_augmentation,omitempty"`
ToolNames []string `json:"tool_names,omitempty"`
LoadedSkills []string `json:"loaded_skills,omitempty"`
OmittedSkills []string `json:"omitted_skills,omitempty"`
Options PlanOptions `json:"options"`
Tier TierView `json:"tier"`
PolicyVersion string `json:"policy_version,omitempty"`
CatalogVersion string `json:"catalog_version,omitempty"`
ContextDigest string `json:"context_digest,omitempty"`
}
PlanView is the stable, serializable planner result used by all adapters.
type ProviderSource ¶
type ProviderSource interface {
Name() string
Discover(context.Context) ([]moe.ProviderCandidate, error)
}
ProviderSource discovers model candidates without transferring credentials.
type ProviderStatus ¶
type ProviderStatus struct {
Name string `json:"name"`
Ready bool `json:"ready"`
CandidateCount int `json:"candidate_count"`
Error string `json:"error,omitempty"`
}
ProviderStatus is one provider's health result.
type RoutingInput ¶
type RoutingInput struct {
Topics []string `json:"topics,omitempty"`
HasTraceContext bool `json:"has_trace_context,omitempty"`
HasBuildContext bool `json:"has_build_context,omitempty"`
HasIssueContext bool `json:"has_issue_context,omitempty"`
HasCodeContext bool `json:"has_code_context,omitempty"`
HistoryDepth int `json:"history_depth,omitempty"`
}
RoutingInput is the transport-safe routing context.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is the production composition facade shared by SDK and MCP surfaces.
func (*Runtime) Health ¶
func (r *Runtime) Health(ctx context.Context) HealthReport
Health checks configured read-only providers and reports degraded state without hiding it.
func (*Runtime) Manifest ¶
Manifest returns the stable capabilities offered by the composition layer.
func (*Runtime) Plan ¶
Plan routes a task and returns a transport-safe plan.
Example ¶
package main
import (
"context"
"fmt"
"github.com/Anurag607/amoeba/runtimekit"
)
func main() {
cfg := runtimekit.DefaultConfig()
runtime, err := runtimekit.New(cfg, runtimekit.Options{})
if err != nil {
panic(err)
}
defer func() { _ = runtime.Close() }()
plan, err := runtime.Plan(context.Background(), "Review this API", runtimekit.RoutingInput{HasCodeContext: true})
if err != nil {
panic(err)
}
fmt.Println(plan.Expert.ID)
}
Output: coding
func (*Runtime) PlanForExpert ¶
PlanForExpert selects an expert explicitly inside the default fail-closed tool ceiling.
type RuntimeConfig ¶
type RuntimeConfig struct {
MaxIterations int `json:"max_iterations" yaml:"max_iterations"`
MaxToolCalls int `json:"max_tool_calls" yaml:"max_tool_calls"`
ResponseTokenBudget int `json:"response_token_budget" yaml:"response_token_budget"`
MaxInjectedSkillTokens int `json:"max_injected_skill_tokens" yaml:"max_injected_skill_tokens"`
}
RuntimeConfig controls deterministic planner limits.
type SelectionView ¶
type SelectionView struct {
Primary string `json:"primary"`
Secondary []string `json:"secondary,omitempty"`
Confidences map[string]float64 `json:"confidences"`
Reasoning string `json:"reasoning"`
}
SelectionView describes a routing decision without leaking mutable engine pointers.