Help us shape the future of Go! Take the 2026 Go Developer Survey

gateway

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProviderNotConfigured  = errors.New("provider is not configured")
	ErrProviderDisabled       = errors.New("provider is disabled")
	ErrStaticProviderReadOnly = errors.New("static provider is read-only")
)

Functions

This section is empty.

Types

type ACPBackend added in v0.5.0

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

ACPBackend is the permanent Agent runtime adapter over the native ACP manager.

func NewACPBackend added in v0.5.0

func NewACPBackend(runtime ACPTurnServer, controls ...RuntimeControls) *ACPBackend

func (*ACPBackend) CancelRun added in v0.5.0

func (*ACPBackend) Capabilities added in v0.5.0

func (*ACPBackend) ExpireContinuation added in v0.5.0

func (b *ACPBackend) ExpireContinuation(_ context.Context, token string) error

func (*ACPBackend) Health added in v0.5.0

func (*ACPBackend) ListSessions added in v0.5.0

func (*ACPBackend) LoadTranscript added in v0.5.0

func (*ACPBackend) PrepareRuntimeConfigs added in v0.5.0

func (b *ACPBackend) PrepareRuntimeConfigs(ctx context.Context, agents []agentpkg.Agent) agentpkg.DefinitionCommit

PrepareRuntimeConfigs builds the canonical Agent ACP config snapshot before the definition swap lock is acquired. Its returned commit performs only bounded in-memory publication/retirement; process, permission-continuation, and cancellation I/O is deferred to the returned cleanup.

func (*ACPBackend) RefreshRuntimeConfigs added in v0.5.0

func (b *ACPBackend) RefreshRuntimeConfigs(ctx context.Context, agents []agentpkg.Agent)

RefreshRuntimeConfigs applies a refresh directly for bootstrap and focused backend tests. Definition commits use PrepareRuntimeConfigs instead.

func (*ACPBackend) ResolveContinuation added in v0.5.0

func (b *ACPBackend) ResolveContinuation(_ context.Context, token string, d agentruntime.PermissionDecision, _ time.Time) error

func (*ACPBackend) ResolvePermission added in v0.5.0

func (b *ACPBackend) ResolvePermission(ctx context.Context, a agentpkg.Agent, decision agentruntime.PermissionDecision) error

func (*ACPBackend) RuntimeSummary added in v0.5.0

func (*ACPBackend) RuntimeType added in v0.5.0

func (*ACPBackend) RuntimeType() string

func (*ACPBackend) ServeTurn added in v0.5.0

func (*ACPBackend) ValidateContinuationDecision added in v0.5.0

func (b *ACPBackend) ValidateContinuationDecision(token string, info agentruntime.PendingPermission, d agentruntime.PermissionDecision) error

type ACPTurnServer added in v0.5.0

type ACPTurnServer interface {
	ServeConfiguredTurn(context.Context, string, hostconfig.Config, acphost.TurnRequest, acphost.EventSink) error
}

ACPTurnServer is the native ACP turn execution surface the ACP backend drives. The production implementation is the process-pool runtime manager; tests inject a fake through BootstrapOptions.ACPRuntime.

type AgentGateway

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

func NewAgentGateway

func NewAgentGateway() *AgentGateway

func (*AgentGateway) ACPRuntimeManager added in v0.3.0

func (g *AgentGateway) ACPRuntimeManager() *acphost.Manager

func (*AgentGateway) AgentManager added in v0.4.0

func (g *AgentGateway) AgentManager() *agentpkg.Manager

func (*AgentGateway) AgentRouteConfigManager added in v0.1.0

func (g *AgentGateway) AgentRouteConfigManager() *routecore.AgentRouteConfigManager

func (*AgentGateway) AgentRouteResolver added in v0.5.0

func (g *AgentGateway) AgentRouteResolver() *agentroutepkg.AgentRouteResolver

AgentRouteResolver resolves the unified kind=agent ingress routes. The route surface is the only public Agent ingress.

func (*AgentGateway) Bootstrap

func (g *AgentGateway) Bootstrap(ctx context.Context, opts BootstrapOptions) error

func (*AgentGateway) BuiltinHost added in v0.5.0

func (g *AgentGateway) BuiltinHost() *builtinpkg.Host

BuiltinHost returns the in-process ADK host serving builtin-runtime agents.

func (*AgentGateway) Close added in v0.3.0

func (g *AgentGateway) Close()

func (*AgentGateway) ConfigStoreBackend

func (g *AgentGateway) ConfigStoreBackend() configstore.ConfigStoreBackend

func (*AgentGateway) CredentialManager

func (g *AgentGateway) CredentialManager() *credential.Manager

func (*AgentGateway) CredentialScheduler

func (g *AgentGateway) CredentialScheduler() credentialscheduler.CredentialScheduler

func (*AgentGateway) HTTPRuntimeManager added in v0.6.0

func (g *AgentGateway) HTTPRuntimeManager() *HTTPRuntimeManager

func (*AgentGateway) LLMRouteResolver added in v0.1.0

func (g *AgentGateway) LLMRouteResolver() *llmroutepkg.LLMRouteResolver

func (*AgentGateway) MCPRouteConfigManager added in v0.1.0

func (g *AgentGateway) MCPRouteConfigManager() *routecore.AgentRouteConfigManager

func (*AgentGateway) MCPRouteResolver added in v0.1.0

func (g *AgentGateway) MCPRouteResolver() *mcproutepkg.MCPRouteResolver

func (*AgentGateway) MCPRuntimeRegistry added in v0.1.0

func (g *AgentGateway) MCPRuntimeRegistry() *mcpruntime.Registry

func (*AgentGateway) MCPServiceManager added in v0.1.0

func (g *AgentGateway) MCPServiceManager() *mcpservice.Manager

func (*AgentGateway) Match added in v0.1.0

func (*AgentGateway) ModelCatalog

func (g *AgentGateway) ModelCatalog() modelcatalog.Service

func (*AgentGateway) NewRoutedProvider

func (g *AgentGateway) NewRoutedProvider(route *llmroutepkg.LLMRoute, requestRequirements llmroutepkg.RequestRequirements) (*RoutedProvider, error)

func (*AgentGateway) PermissionBroker added in v0.5.0

func (g *AgentGateway) PermissionBroker() *agentruntime.PermissionBroker

func (*AgentGateway) ProviderManager

func (g *AgentGateway) ProviderManager() *ProviderManager

func (*AgentGateway) Reset

func (g *AgentGateway) Reset()

func (*AgentGateway) ResolveRoute

func (g *AgentGateway) ResolveRoute(ctx context.Context, r *http.Request) (*llmroutepkg.LLMRoute, error)

func (*AgentGateway) ResolveVirtualKey

func (g *AgentGateway) ResolveVirtualKey(ctx context.Context, httpReq *http.Request, r routecore.AgentRouteConfig) (*virtualkeypkg.VirtualKey, error)

func (*AgentGateway) RunRegistry added in v0.5.0

func (g *AgentGateway) RunRegistry() *agentruntime.RunRegistry

func (*AgentGateway) RuntimeRegistry added in v0.5.0

func (g *AgentGateway) RuntimeRegistry() *agentruntime.Registry

RuntimeRegistry returns the runtime-neutral Agent backend registry. Runtime adapters are registered during Bootstrap and consumed by Agent-bound ACP and builtin route turns.

func (*AgentGateway) UsageConfig added in v0.4.0

func (g *AgentGateway) UsageConfig() usage.Config

func (*AgentGateway) UsageObserver added in v0.4.0

func (g *AgentGateway) UsageObserver() usage.InteractionObserver

func (*AgentGateway) UsagePrometheus added in v0.4.0

func (g *AgentGateway) UsagePrometheus() usage.PrometheusProvider

func (*AgentGateway) UsageQuery added in v0.4.0

func (g *AgentGateway) UsageQuery() usage.QueryService

func (*AgentGateway) UsageStats added in v0.4.0

func (g *AgentGateway) UsageStats() usage.RuntimeStats

func (*AgentGateway) VirtualKeyManager

func (g *AgentGateway) VirtualKeyManager() *virtualkeypkg.VirtualKeyManager

type BootstrapOptions

type BootstrapOptions struct {
	StaticLLMRoutes     []routecore.AgentRouteConfig
	StaticMCPRoutes     []routecore.AgentRouteConfig
	StaticAgentRoutes   []routecore.AgentRouteConfig
	StaticProviders     map[string]provider.Provider
	ConfigStoreBackend  configstore.ConfigStoreBackend
	CredentialManager   *credential.Manager
	CredentialScheduler credentialscheduler.CredentialScheduler
	UsageObserver       usage.InteractionObserver
	UsageQuery          usage.QueryService
	UsageStats          usage.RuntimeStats
	UsagePrometheus     usage.PrometheusProvider
	UsageConfig         usage.Config
	Logger              *zap.Logger
	// ACPRuntime overrides the native ACP turn server the registered ACP
	// backend drives. Nil uses the process-pool runtime manager. Tests inject
	// a fake to exercise Agent-dispatched ACP execution without spawning
	// processes.
	ACPRuntime ACPTurnServer
	// HTTPBackend overrides the registered HTTP Agent adapter in focused tests.
	// Nil registers the production Path B backend over HTTPRuntimeManager.
	HTTPBackend agentruntime.Backend
}

type BuiltinBackend added in v0.5.0

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

BuiltinBackend is the permanent Agent runtime adapter over the in-process ADK Host. Cursor state lives beside the Host's process-lifetime checkpoint.

func NewBuiltinBackend added in v0.5.0

func NewBuiltinBackend(host builtinTurnServer, controls ...RuntimeControls) *BuiltinBackend

func (*BuiltinBackend) CancelRun added in v0.5.0

func (*BuiltinBackend) Capabilities added in v0.5.0

func (*BuiltinBackend) DiscardAgentContinuations added in v0.5.0

func (b *BuiltinBackend) DiscardAgentContinuations(agentID string)

DiscardAgentContinuations removes Admin-decided new-stream continuations when an Agent definition is updated or deleted. Pending broker entries are drained separately; these entries have already been claimed by Admin.

func (*BuiltinBackend) DiscardAllContinuations added in v0.5.0

func (b *BuiltinBackend) DiscardAllContinuations()

DiscardAllContinuations removes every Admin-decided continuation during gateway shutdown after the common broker has drained still-pending records.

func (*BuiltinBackend) ExpireContinuation added in v0.5.0

func (b *BuiltinBackend) ExpireContinuation(_ context.Context, token string) error

func (*BuiltinBackend) Health added in v0.5.0

func (*BuiltinBackend) LoadContinuationCursor added in v0.5.0

func (b *BuiltinBackend) LoadContinuationCursor(_ context.Context, a agentpkg.Agent, requestID string) (agentruntime.EventCursor, error)

func (*BuiltinBackend) ResolveContinuation added in v0.5.0

func (b *BuiltinBackend) ResolveContinuation(_ context.Context, token string, d agentruntime.PermissionDecision, expiresAt time.Time) error

func (*BuiltinBackend) ResolvePermission added in v0.5.0

func (b *BuiltinBackend) ResolvePermission(ctx context.Context, a agentpkg.Agent, decision agentruntime.PermissionDecision) error

func (*BuiltinBackend) RuntimeSummary added in v0.5.0

func (*BuiltinBackend) RuntimeType added in v0.5.0

func (*BuiltinBackend) RuntimeType() string

func (*BuiltinBackend) ServeTurn added in v0.5.0

func (*BuiltinBackend) StoreContinuationCursor added in v0.5.0

func (b *BuiltinBackend) StoreContinuationCursor(_ context.Context, a agentpkg.Agent, requestID string, cursor agentruntime.EventCursor) error

func (*BuiltinBackend) ValidateContinuationDecision added in v0.5.0

func (b *BuiltinBackend) ValidateContinuationDecision(token string, info agentruntime.PendingPermission, d agentruntime.PermissionDecision) error

type HTTPBackend added in v0.6.0

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

HTTPBackend translates the common Agent turn contract to A2A 1.0 JSON-RPC.

func NewHTTPBackend added in v0.6.0

func NewHTTPBackend(manager *HTTPRuntimeManager, controls ...RuntimeControls) *HTTPBackend

func (*HTTPBackend) CancelRun added in v0.6.0

func (*HTTPBackend) Capabilities added in v0.6.0

func (b *HTTPBackend) Capabilities(_ context.Context, agent agentpkg.Agent) (agentruntime.Capabilities, error)

func (*HTTPBackend) Health added in v0.6.0

func (b *HTTPBackend) Health(ctx context.Context, agent agentpkg.Agent) (agentruntime.Health, error)

func (*HTTPBackend) RuntimeSummary added in v0.6.0

func (b *HTTPBackend) RuntimeSummary(ctx context.Context, agent agentpkg.Agent) (agentruntime.RuntimeSummary, error)

func (*HTTPBackend) RuntimeType added in v0.6.0

func (*HTTPBackend) RuntimeType() string

func (*HTTPBackend) ServeTurn added in v0.6.0

func (b *HTTPBackend) ServeTurn(ctx context.Context, agent agentpkg.Agent, req agentruntime.TurnRequest, emit agentruntime.EventSink) (returnErr error)

type HTTPExecution added in v0.6.0

type HTTPExecution struct {
	Client      *a2aclient.Client
	Interface   a2a.AgentInterface
	Card        *a2a.AgentCard
	AuthRef     string
	Timeout     time.Duration
	Fingerprint string
	Streaming   bool
	// contains filtered or unexported fields
}

HTTPExecution is one immutable, Card-selected Path B execution view. Its client contains a live credential transport and never retains a secret.

type HTTPHealthProbe added in v0.6.0

type HTTPHealthProbe struct {
	Healthy   bool
	Drift     bool
	CheckedAt time.Time
	Message   string
}

type HTTPProxyTarget added in v0.6.0

type HTTPProxyTarget struct {
	Proxy        *a2aproxy.Proxy
	Interface    a2a.AgentInterface
	CardTemplate *a2a.AgentCard
	AuthRef      string
	Timeout      time.Duration
	Fingerprint  string
}

HTTPProxyTarget is the immutable Path A view selected from the same runtime generation as HTTPExecution. It contains no resolved credential secret.

type HTTPRuntimeManager added in v0.6.0

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

HTTPRuntimeManager owns the single immutable Card-derived generation used by HTTP Agent execution. It is both an Agent definition listener and a credential lifecycle listener.

func NewHTTPRuntimeManager added in v0.6.0

func NewHTTPRuntimeManager(agents *agentpkg.Manager, credentials *credential.Manager, cardClient *http.Client, logger *zap.Logger) *HTTPRuntimeManager

func (*HTTPRuntimeManager) A2AProxyReady added in v0.6.0

func (m *HTTPRuntimeManager) A2AProxyReady(agentID string) error

func (*HTTPRuntimeManager) Close added in v0.6.0

func (m *HTTPRuntimeManager) Close()

func (*HTTPRuntimeManager) OnCredentialDeregistered added in v0.6.0

func (m *HTTPRuntimeManager) OnCredentialDeregistered(_ context.Context, cred *credential.ManagedCredential)

func (*HTTPRuntimeManager) OnCredentialRegistered added in v0.6.0

func (m *HTTPRuntimeManager) OnCredentialRegistered(_ context.Context, cred *credential.ManagedCredential)

func (*HTTPRuntimeManager) OnCredentialUpdated added in v0.6.0

func (m *HTTPRuntimeManager) OnCredentialUpdated(_ context.Context, cred *credential.ManagedCredential)

func (*HTTPRuntimeManager) OnCredentialsReplaced added in v0.6.0

func (m *HTTPRuntimeManager) OnCredentialsReplaced(context.Context, []*credential.ManagedCredential)

func (*HTTPRuntimeManager) PrepareRuntimeConfigs added in v0.6.0

func (m *HTTPRuntimeManager) PrepareRuntimeConfigs(ctx context.Context, agents []agentpkg.Agent) agentpkg.DefinitionCommit

func (*HTTPRuntimeManager) ProbeHealth added in v0.6.0

func (m *HTTPRuntimeManager) ProbeHealth(ctx context.Context, agentID string) HTTPHealthProbe

func (*HTTPRuntimeManager) RefreshRuntimeConfigs added in v0.6.0

func (m *HTTPRuntimeManager) RefreshRuntimeConfigs(ctx context.Context, agents []agentpkg.Agent)

func (*HTTPRuntimeManager) ResolveExecution added in v0.6.0

func (m *HTTPRuntimeManager) ResolveExecution(agentID string) (*HTTPExecution, error)

func (*HTTPRuntimeManager) ResolveProxyTarget added in v0.6.0

func (m *HTTPRuntimeManager) ResolveProxyTarget(agentID string) (*HTTPProxyTarget, error)

type ProviderListOptions

type ProviderListOptions struct {
	ProviderType string
}

type ProviderManager

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

func NewProviderManager

func NewProviderManager(store configstore.ConfigStore) *ProviderManager

func (*ProviderManager) CreateConfig

func (m *ProviderManager) CreateConfig(ctx context.Context, cfg provider.ProviderConfig) error

func (*ProviderManager) DeleteConfig

func (m *ProviderManager) DeleteConfig(ctx context.Context, providerID string) error

func (*ProviderManager) GetConfig

func (m *ProviderManager) GetConfig(ctx context.Context, providerID string) (provider.ProviderConfig, error)

func (*ProviderManager) InitStaticProviders

func (m *ProviderManager) InitStaticProviders(providers map[string]provider.Provider) error

func (*ProviderManager) IsStatic

func (m *ProviderManager) IsStatic(providerID string) bool

func (*ProviderManager) ListConfigs

func (*ProviderManager) Reset

func (m *ProviderManager) Reset()

func (*ProviderManager) ResolveProvider

func (m *ProviderManager) ResolveProvider(ctx context.Context, providerID string) (provider.Provider, error)

ResolveProvider resolves a provider ID to a live provider instance.

Dynamic provider configs are cached after first load and invalidated by the manager's CreateConfig/UpdateConfig/DeleteConfig paths. This keeps config store reads out of the request hot path while preserving Admin API updates.

func (*ProviderManager) UpdateConfig

func (m *ProviderManager) UpdateConfig(ctx context.Context, providerID string, cfg provider.ProviderConfig) error

type ProviderResolver

type ProviderResolver interface {
	ResolveProvider(ctx context.Context, providerID string) (provider.Provider, error)
}

ProviderResolver resolves a provider ID into an executable provider instance.

type ProviderResolverFunc

type ProviderResolverFunc func(ctx context.Context, providerID string) (provider.Provider, error)

ProviderResolverFunc adapts a function into ProviderResolver.

func (ProviderResolverFunc) ResolveProvider

func (f ProviderResolverFunc) ResolveProvider(ctx context.Context, providerID string) (provider.Provider, error)

type RoutedProvider

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

func (*RoutedProvider) Capabilities

func (p *RoutedProvider) Capabilities() provider.ProviderCapabilities

func (*RoutedProvider) Chat

func (*RoutedProvider) Config

func (*RoutedProvider) CreateResponses

func (*RoutedProvider) ExecuteChat added in v0.5.1

func (*RoutedProvider) ExecuteStreamChat added in v0.5.1

func (p *RoutedProvider) ExecuteStreamChat(ctx context.Context, req *provider.ChatRequest) (*provider.StreamExecution, error)

func (*RoutedProvider) ListModels

func (p *RoutedProvider) ListModels(ctx context.Context) ([]provider.ModelInfo, error)

func (*RoutedProvider) StreamChat

type RuntimeControls added in v0.5.0

type RuntimeControls struct {
	Runs        *agentruntime.RunRegistry
	Permissions *agentruntime.PermissionBroker
	Logger      *zap.Logger
}

Directories

Path Synopsis
Package agentroute defines the unified Agent ingress route model described by docs/design/agents-control-plane.md.
Package agentroute defines the unified Agent ingress route model described by docs/design/agents-control-plane.md.

Jump to

Keyboard shortcuts

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