agentroute

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package agentroute defines the unified Agent ingress route model (docs/plans/unified-agent-runtime.md §6). An AgentRoute targets a stable agent_id; the resolved Agent's runtime.type selects the execution backend, so changing an Agent's runtime never changes its route, URL, or VirtualKey allowlist. M5 exposes this model through Admin, CLI, bundles, Caddy, and the standalone dispatcher.

Index

Constants

View Source
const (
	RouteKindAgent = routecore.RouteKindAgent
)
View Source
const (
	RouteProtocolAgent = routecore.RouteProtocolAgent
)

Variables

View Source
var (
	ErrRouteNotConfigured  = routecore.ErrRouteNotConfigured
	ErrStaticRouteReadOnly = routecore.ErrStaticRouteReadOnly
	ErrInvalidRouteID      = routecore.ErrInvalidRouteID
)

Functions

func DecodeStoredAgentRoute

func DecodeStoredAgentRoute(data []byte) (any, error)

func DecodeTargetAgentID

func DecodeTargetAgentID(targetPolicy json.RawMessage) (string, error)

DecodeTargetAgentID extracts the agent id from a persisted agent route target policy. The dispatcher uses it to stamp explicit agent attribution on the turn span before dispatch.

Types

type AgentLookup

type AgentLookup interface {
	HasAgent(id string) bool
}

AgentLookup reports whether a target Agent exists. Existence is a management validity check only: disabled Agents and Agents whose backend is not currently executable remain valid route targets (plan §6.2).

type AgentRoute

type AgentRoute struct {
	AgentRouteBaseConfig
	AgentID string `json:"agent_id"`
}

AgentRoute is the runtime route object used by dispatcher/runtime code.

func NewAgentRouteFromConfig

func NewAgentRouteFromConfig(cfg AgentRouteBaseConfig) (AgentRoute, error)

func NewRuntimeAgentRoute

func NewRuntimeAgentRoute(cfg AgentRouteConfig) AgentRoute

func (AgentRoute) Config

func (r AgentRoute) Config() AgentRouteConfig

func (AgentRoute) MarshalJSON

func (r AgentRoute) MarshalJSON() ([]byte, error)

func (AgentRoute) ToConfig

func (r AgentRoute) ToConfig() (AgentRouteBaseConfig, error)

func (*AgentRoute) UnmarshalJSON

func (r *AgentRoute) UnmarshalJSON(data []byte) error

type AgentRouteBaseConfig

type AgentRouteBaseConfig = routecore.AgentRouteConfig

type AgentRouteConfig

type AgentRouteConfig struct {
	AgentRouteBaseConfig
	AgentID string `json:"agent_id"`
}

AgentRouteConfig is the expanded config form with direct agent_id access.

func NewAgentRouteConfigFromConfig

func NewAgentRouteConfigFromConfig(cfg AgentRouteBaseConfig) (AgentRouteConfig, error)

func (AgentRouteConfig) MarshalJSON

func (r AgentRouteConfig) MarshalJSON() ([]byte, error)

func (*AgentRouteConfig) Normalize

func (r *AgentRouteConfig) Normalize()

func (*AgentRouteConfig) NormalizeTimestamps

func (r *AgentRouteConfig) NormalizeTimestamps(now time.Time)

func (AgentRouteConfig) ToConfig

func (*AgentRouteConfig) UnmarshalJSON

func (r *AgentRouteConfig) UnmarshalJSON(data []byte) error

type AgentRouteResolver

type AgentRouteResolver struct {
	// contains filtered or unexported fields
}

func NewAgentRouteResolver

func NewAgentRouteResolver(configManager *routecore.AgentRouteConfigManager) *AgentRouteResolver

func (*AgentRouteResolver) ConfigManager

func (*AgentRouteResolver) CreateConfig

func (r *AgentRouteResolver) CreateConfig(ctx context.Context, route routecore.AgentRouteConfig, tag string) error

func (*AgentRouteResolver) DeleteConfig

func (r *AgentRouteResolver) DeleteConfig(ctx context.Context, routeID string) error

func (*AgentRouteResolver) GetConfig

func (*AgentRouteResolver) ListConfigs

func (*AgentRouteResolver) Resolve

func (*AgentRouteResolver) ResolveByID

func (r *AgentRouteResolver) ResolveByID(ctx context.Context, routeID string) (*AgentRoute, error)

func (*AgentRouteResolver) SetAgentLookup

func (r *AgentRouteResolver) SetAgentLookup(lookup AgentLookup)

SetAgentLookup wires the optional target-existence check used by CreateConfig/UpdateConfig. When nil, target validation is skipped.

func (*AgentRouteResolver) UpdateConfig

func (r *AgentRouteResolver) UpdateConfig(ctx context.Context, routeID string, route routecore.AgentRouteConfig) error

type RouteAuthPolicy

type RouteAuthPolicy = routecore.RouteAuthPolicy

type RouteKind

type RouteKind = routecore.RouteKind

type RouteListOptions

type RouteListOptions = routecore.RouteListOptions

type RouteMatch

type RouteMatch = routecore.RouteMatchPolicy

type RouteProtocol

type RouteProtocol = routecore.RouteProtocol

Jump to

Keyboard shortcuts

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