Documentation
¶
Index ¶
- Constants
- Variables
- func AdaptTaskInputViaContextAdapter(ctx context.Context, namespace string, adapterStoreKey string, ...) (map[string]string, error)
- func AgentHasOrlojTools(agent resources.Agent) bool
- func AgentTokenBudget(policies []resources.AgentPolicy, agentName string) int
- func BuiltinMemoryToolNames() []string
- func BuiltinOrlojToolNames() []string
- func CanRunAsJob(agent resources.Agent, tools []resources.Tool, ...) bool
- func ConfigureA2ARuntime(rt ToolRuntime, a2aRT ToolRuntime, namespace string)
- func ConfigureCliRuntime(rt ToolRuntime, secrets SecretResolver, runner CLICommandRunner, ...)
- func ConfigureExternalRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
- func ConfigureGRPCRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
- func ConfigureHttpRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
- func ConfigureKubernetesRuntime(rt ToolRuntime, k8sRT ToolRuntime, namespace string)
- func ConfigureMcpRuntime(rt ToolRuntime, sessionManager *McpSessionManager, ...)
- func ConfigureWasmRuntime(rt ToolRuntime, wasmRT ToolRuntime, namespace string)
- func ConfigureWebhookCallbackRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
- func DefaultSafeHTTPClient(allowPrivate bool) *http.Client
- func EncodeReviewRequestPayload(payload ReviewRequestPayload) string
- func EnforcePoliciesForAgent(agent resources.Agent, effectiveModel string, policies []resources.AgentPolicy) error
- func ExecutionToAgentJobResult(r AgentExecutionResult, execErr error) *resources.AgentJobResult
- func IsApprovalRequiredError(err error) bool
- func IsBuiltinMemoryTool(name string) bool
- func IsBuiltinOrlojTool(name string) bool
- func IsToolDeniedError(err error) bool
- func IsWASMToolModuleContractError(err error) bool
- func MatchedPolicies(task resources.Task, system resources.AgentSystem, all []resources.AgentPolicy) []resources.AgentPolicy
- func MinimumChildDepth(policies []resources.AgentPolicy) int
- func MinimumChildTasks(policies []resources.AgentPolicy) int
- func MinimumTokenBudget(policies []resources.AgentPolicy) int
- func NewToolDeniedError(message string, details map[string]string, cause error) error
- func NewToolError(status string, code string, reason string, retryable bool, message string, ...) error
- func ParseInputFromApprovalError(err error) string
- func ParseToolFromApprovalError(err error) string
- func RedactSensitive(s string) string
- func RegisterModelProvider(plugin ModelProviderPlugin) error
- func RegisterToolIsolationBackend(mode string, factory ToolIsolationBackendFactory) error
- func ResumeMessageFromAgentMessage(msg AgentMessage) resources.TaskApprovalResumeMessage
- func RetryAfter(delay time.Duration, cause error) error
- func SafeDialer(allowPrivate bool) *net.Dialer
- func SafeHTTPClient(allowPrivate bool, timeout time.Duration) *http.Client
- func SafeModelGatewayHTTPClient(allowPrivate bool, timeout time.Duration) *http.Client
- func TaskApprovalResourceName(taskKey, checkpointID string, cycle int) string
- func ToolApprovalResourceName(taskKey, messageID string) string
- func ToolApprovalScopedStoreKey(taskKey, messageID string) string
- func ToolErrorMeta(err error) (code string, reason string, retryable bool, ok bool)
- func ValidateEndpointURL(rawURL string, allowPrivate bool) error
- type AgentExecutionResult
- type AgentJobStore
- type AgentMessage
- type AgentMessageBus
- type AgentMessageConsumerManager
- type AgentMessageConsumerOptions
- type AgentMessageDelivery
- type AgentMessageHandler
- type AgentMessageSubscription
- type AgentPolicyLookup
- type AgentRegistry
- type AgentRoleLookup
- type AgentStepEvent
- type AgentSystemRegistry
- type AgentToolAuthorizer
- type AgentWorker
- func NewAgentWorker(agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, ...) *AgentWorker
- func NewAgentWorkerWithInterval(agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, ...) *AgentWorker
- func NewAgentWorkerWithIntervalAndGateway(agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, ...) *AgentWorker
- func NewAgentWorkerWithIntervalAndGatewayAndInput(agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, ...) *AgentWorker
- type AnthropicModelGateway
- type AnthropicModelGatewayConfig
- type AuditEvent
- type AuditSink
- type AuthInjector
- type AuthResult
- type AuthorizeResult
- type AzureOpenAIModelGateway
- type AzureOpenAIModelGatewayConfig
- type BedrockModelGateway
- type BedrockModelGatewayConfig
- type BoundedWriter
- type CLICommandRunner
- type CLIToolRuntime
- type CLIToolRuntimeConfig
- type Capability
- type CapabilityProvider
- type CapabilitySnapshot
- type ChainSecretResolver
- type ChatMessage
- type ChatToolCall
- type Chunk
- type ContainerCommandRunner
- type ContainerToolRuntime
- func NewContainerToolRuntime(registry ToolCapabilityRegistry, config ContainerToolRuntimeConfig) *ContainerToolRuntime
- func NewContainerToolRuntimeWithRunner(registry ToolCapabilityRegistry, config ContainerToolRuntimeConfig, ...) *ContainerToolRuntime
- func NewContainerToolRuntimeWithRunnerAndSecrets(registry ToolCapabilityRegistry, config ContainerToolRuntimeConfig, ...) *ContainerToolRuntime
- type ContainerToolRuntimeConfig
- type ContextAdapterDeps
- type ContextAdapterGetter
- type ContextAdapterHook
- type EmbeddingProvider
- type EnvSecretResolver
- type EvalScoreResult
- type EvalScorer
- type ExecutionEngine
- type Extensions
- type ExternalToolRuntime
- func (r *ExternalToolRuntime) Call(ctx context.Context, tool string, input string) (string, error)
- func (r *ExternalToolRuntime) SetAllowPrivateEndpoints(allow bool)
- func (r *ExternalToolRuntime) WithNamespace(namespace string) ToolRuntime
- func (r *ExternalToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
- type GRPCDialer
- type GRPCToolRuntime
- func (r *GRPCToolRuntime) Call(ctx context.Context, tool string, input string) (string, error)
- func (r *GRPCToolRuntime) SetAllowInsecure(allow bool)
- func (r *GRPCToolRuntime) WithNamespace(namespace string) ToolRuntime
- func (r *GRPCToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
- type GovernedToolApprovalContext
- type GovernedToolRuntime
- func (r *GovernedToolRuntime) Call(ctx context.Context, tool string, input string) (string, error)
- func (r *GovernedToolRuntime) ResolveToolSchemas(toolNames []string) map[string]ToolSchemaInfo
- func (r *GovernedToolRuntime) SetMcpRuntime(mcpRuntime ToolRuntime)
- func (r *GovernedToolRuntime) SetWasmRuntime(wasmRuntime ToolRuntime)
- type HTTPDoer
- type HTTPMemoryBackend
- func (b *HTTPMemoryBackend) Get(ctx context.Context, key string) (string, bool, error)
- func (b *HTTPMemoryBackend) List(ctx context.Context, prefix string) ([]MemorySearchResult, error)
- func (b *HTTPMemoryBackend) Ping(ctx context.Context) error
- func (b *HTTPMemoryBackend) Put(ctx context.Context, key, value string) error
- func (b *HTTPMemoryBackend) Search(ctx context.Context, query string, topK int) ([]MemorySearchResult, error)
- type HTTPToolClient
- func (r *HTTPToolClient) Call(ctx context.Context, tool string, input string) (string, error)
- func (r *HTTPToolClient) SetAllowPrivateEndpoints(allow bool)
- func (r *HTTPToolClient) WithNamespace(namespace string) ToolRuntime
- func (r *HTTPToolClient) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
- type InMemoryBackend
- func (b *InMemoryBackend) Get(_ context.Context, key string) (string, bool, error)
- func (b *InMemoryBackend) List(_ context.Context, prefix string) ([]MemorySearchResult, error)
- func (b *InMemoryBackend) Ping(_ context.Context) error
- func (b *InMemoryBackend) Put(_ context.Context, key, value string) error
- func (b *InMemoryBackend) Search(_ context.Context, query string, topK int) ([]MemorySearchResult, error)
- type KubernetesAgentConfig
- type KubernetesAgentRuntime
- type KubernetesJobClient
- type KubernetesSecretClient
- type KubernetesSecretResolver
- type KubernetesToolConfig
- type KubernetesToolRuntime
- type MCPToolRuntime
- type Manager
- type McpCapabilities
- type McpContent
- type McpInitResult
- type McpServerInfo
- type McpServerLookup
- type McpSession
- type McpSessionManager
- func (m *McpSessionManager) Close()
- func (m *McpSessionManager) GetOrCreate(ctx context.Context, server resources.McpServer) (*McpSession, error)
- func (m *McpSessionManager) Remove(server resources.McpServer)
- func (m *McpSessionManager) SetAllowedCommands(cmds []string)
- func (m *McpSessionManager) SetContainerConfig(cfg ContainerToolRuntimeConfig)
- func (m *McpSessionManager) StartReaper(ctx context.Context, interval time.Duration)
- type McpToolCapability
- type McpToolDefinition
- type McpToolResult
- type McpTransport
- type MemoryAgentMessageBus
- type MemoryManager
- type MemoryProviderConfig
- type MemoryProviderFactory
- type MemoryProviderRegistry
- type MemoryResourceLookup
- type MemorySearchResult
- type MemoryStore
- type MemoryToolRuntime
- type MeteringEvent
- type MeteringSink
- type MockModelGateway
- type MockToolClient
- type ModelEndpointLookup
- type ModelGateway
- type ModelGatewayConfig
- type ModelGatewayError
- type ModelProviderPlugin
- type ModelProviderRegistry
- type ModelRequest
- type ModelResponse
- type ModelRouter
- type ModelRouterConfig
- type ModelToolCall
- type ModelUsage
- type ModuleSource
- type NATSJetStreamAgentMessageBus
- type OAuth2TokenCache
- type OCIArtifactPuller
- type OCIAuth
- type OllamaModelGateway
- type OllamaModelGatewayConfig
- type OpenAIEmbeddingProvider
- type OpenAIModelGateway
- type OpenAIModelGatewayConfig
- type OrlojTaskStore
- type OrlojToolConfig
- type OrlojToolRuntime
- type PersistentMemoryBackend
- type PersistentMemoryBackendRegistry
- type PgvectorBackend
- func (b *PgvectorBackend) Get(ctx context.Context, key string) (string, bool, error)
- func (b *PgvectorBackend) List(ctx context.Context, prefix string) ([]MemorySearchResult, error)
- func (b *PgvectorBackend) Ping(ctx context.Context) error
- func (b *PgvectorBackend) Put(ctx context.Context, key, value string) error
- func (b *PgvectorBackend) Search(ctx context.Context, queryText string, topK int) ([]MemorySearchResult, error)
- type PgvectorOptions
- type ReActExecutionEngine
- type RegistryAuthResolver
- type RetryRequestError
- type ReviewRequestPayload
- type SecretResolver
- type SecretResourceLookup
- type SharedMemoryStore
- func (s *SharedMemoryStore) Get(key string) (string, bool)
- func (s *SharedMemoryStore) List(prefix string) []memoryEntry
- func (s *SharedMemoryStore) Put(key, value string)
- func (s *SharedMemoryStore) Search(query string, topK int) []memoryEntry
- func (s *SharedMemoryStore) Snapshot() map[string]string
- type StaticToolCapabilityRegistry
- type StdioMcpTransport
- func (t *StdioMcpTransport) CallTool(ctx context.Context, name string, arguments map[string]any) (*McpToolResult, error)
- func (t *StdioMcpTransport) Close() error
- func (t *StdioMcpTransport) Initialize(ctx context.Context) (*McpInitResult, error)
- func (t *StdioMcpTransport) ListTools(ctx context.Context) ([]McpToolDefinition, error)
- type StdioMcpTransportConfig
- type StoreSecretResolver
- type StreamableHTTPMcpTransport
- func (t *StreamableHTTPMcpTransport) CallTool(ctx context.Context, name string, arguments map[string]any) (*McpToolResult, error)
- func (t *StreamableHTTPMcpTransport) Close() error
- func (t *StreamableHTTPMcpTransport) Initialize(ctx context.Context) (*McpInitResult, error)
- func (t *StreamableHTTPMcpTransport) ListTools(ctx context.Context) ([]McpToolDefinition, error)
- type StreamableHTTPMcpTransportConfig
- type TaskApprovalUpserter
- type TaskExecutor
- type TaskStateStore
- type ToolApprovalRequiredError
- type ToolApprovalUpserter
- type ToolBackedContextAdapter
- type ToolCallAuthorizer
- type ToolCapabilityRegistry
- type ToolClient
- type ToolContractExecutor
- type ToolError
- type ToolExecutionAuth
- type ToolExecutionFailure
- type ToolExecutionOutput
- type ToolExecutionRequest
- type ToolExecutionRequestTool
- type ToolExecutionResponse
- type ToolExecutionRuntime
- type ToolExecutionTraceContext
- type ToolExecutionUsage
- type ToolIsolationBackendFactory
- type ToolIsolationBackendOptions
- type ToolIsolationBackendRegistry
- type ToolPermissionLookup
- type ToolResourceLookup
- type ToolRuntime
- func BuildGovernedToolRuntimeForAgent(ctx context.Context, baseRuntime ToolRuntime, isolatedRuntime ToolRuntime, ...) ToolRuntime
- func BuildGovernedToolRuntimeForAgentWithGovernance(ctx context.Context, baseRuntime ToolRuntime, isolatedRuntime ToolRuntime, ...) ToolRuntime
- func BuildSanitizerToolRuntime(ctx context.Context, namespace string, toolRef string, ...) (ToolRuntime, error)
- func BuildToolIsolationRuntime(options ToolIsolationBackendOptions) (ToolRuntime, error)
- type ToolSchemaInfo
- type ToolSchemaResolver
- type UnsupportedIsolatedToolRuntime
- type WASMModuleResolver
- type WASMModuleResolverConfig
- type WASMToolExecuteRequest
- type WASMToolExecuteResponse
- type WASMToolExecutor
- type WASMToolExecutorFactory
- type WASMToolModuleReqAuth
- type WASMToolModuleReqRuntime
- type WASMToolModuleRequest
- type WASMToolModuleResponse
- type WASMToolRuntime
- func (r *WASMToolRuntime) Call(ctx context.Context, tool string, input string) (string, error)
- func (r *WASMToolRuntime) WithConfig(config WASMToolRuntimeConfig) *WASMToolRuntime
- func (r *WASMToolRuntime) WithNamespace(namespace string) ToolRuntime
- func (r *WASMToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
- type WASMToolRuntimeConfig
- type WazeroExecutor
- type WazeroExecutorFactory
- type WebhookCallbackToolRuntime
- func (r *WebhookCallbackToolRuntime) Call(ctx context.Context, tool string, input string) (string, error)
- func (r *WebhookCallbackToolRuntime) DeliverCallback(requestID string, resp ToolExecutionResponse) bool
- func (r *WebhookCallbackToolRuntime) SetAllowPrivateEndpoints(allow bool)
- func (r *WebhookCallbackToolRuntime) WithNamespace(namespace string) ToolRuntime
- func (r *WebhookCallbackToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
Constants ¶
const ( ToolMemoryRead = "memory.read" ToolMemoryWrite = "memory.write" ToolMemorySearch = "memory.search" ToolMemoryList = "memory.list" ToolMemoryIngest = "memory.ingest" )
const ( ToolOrlojTaskCreate = "orloj.task.create" ToolOrlojTaskList = "orloj.task.list" )
const ( AuthorizeVerdictAllow = "allow" AuthorizeVerdictDeny = "deny" AuthorizeVerdictApprovalRequired = "approval_required" )
const ( ToolContractVersionV1 = "v1" ToolOperationInvoke = "invoke" )
const ( ToolExecutionStatusOK = "ok" ToolExecutionStatusError = ToolStatusError ToolExecutionStatusDenied = ToolStatusDenied )
const ( ToolStatusError = "error" ToolStatusDenied = "denied" )
const ( ToolCodeInvalidInput = "invalid_input" ToolCodeUnsupportedTool = "unsupported_tool" ToolCodeRuntimePolicyInvalid = "runtime_policy_invalid" ToolCodePermissionDenied = "permission_denied" ToolCodeSecretResolution = "secret_resolution_failed" ToolCodeTimeout = "timeout" ToolCodeCanceled = "canceled" ToolCodeExecutionFailed = "execution_failed" ToolCodeAuthExpired = "auth_expired" ToolCodeAuthInvalid = "auth_invalid" ToolCodeAuthForbidden = "auth_forbidden" ToolCodeApprovalPending = "approval_pending" ToolCodeApprovalDenied = "approval_denied" ToolCodeApprovalTimeout = "approval_timeout" )
const ( ToolReasonInvalidInput = "tool_invalid_input" ToolReasonToolUnsupported = "tool_unsupported" ToolReasonRuntimePolicyInvalid = "tool_runtime_policy_invalid" ToolReasonPermissionDenied = "tool_permission_denied" ToolReasonSecretResolution = "tool_secret_resolution_failed" ToolReasonExecutionTimeout = "tool_execution_timeout" ToolReasonExecutionCanceled = "tool_execution_canceled" ToolReasonBackendFailure = "tool_backend_failure" ToolReasonAuthExpired = "tool_auth_expired" ToolReasonAuthInvalid = "tool_auth_invalid" ToolReasonAuthForbidden = "tool_auth_forbidden" ToolReasonApprovalPending = "tool_approval_pending" ToolReasonApprovalDenied = "tool_approval_denied" ToolReasonApprovalTimeout = "tool_approval_timeout" ToolReasonAgentContractViolation = "agent_contract_violation" )
const DefaultMaxToolOutputBytes = 16 * 1024 * 1024
DefaultMaxToolOutputBytes is the default cap for tool stdout/stderr capture. 16 MiB is generous for legitimate tool output while preventing OOM from runaway processes.
const WASMToolModuleContractVersionV1 = "v1"
Variables ¶
var ( ErrUnsupportedTool = errors.New("unsupported tool") ErrInvalidToolRuntimePolicy = errors.New("invalid tool runtime policy") ErrToolPermissionDenied = errors.New("tool permission denied") ErrToolApprovalRequired = errors.New("tool approval required") )
var ErrModelGatewayConfiguration = errors.New("model gateway configuration error")
var ErrOutputLimitExceeded = fmt.Errorf("tool output exceeded maximum allowed size")
ErrOutputLimitExceeded is returned when a tool's stdout or stderr exceeds the configured maximum.
var ErrToolSecretNotFound = errors.New("tool secret not found")
var ErrToolSecretResolution = errors.New("tool secret resolution failed")
Functions ¶
func AdaptTaskInputViaContextAdapter ¶ added in v0.12.0
func AdaptTaskInputViaContextAdapter( ctx context.Context, namespace string, adapterStoreKey string, lookup ContextAdapterGetter, deps ContextAdapterDeps, raw map[string]string, ) (map[string]string, error)
AdaptTaskInputViaContextAdapter runs the ContextAdapter tool chain on raw task input maps.
func AgentHasOrlojTools ¶ added in v0.6.0
AgentHasOrlojTools returns true if any of the agent's allowed_tools are orloj tools.
func AgentTokenBudget ¶ added in v0.12.0
func AgentTokenBudget(policies []resources.AgentPolicy, agentName string) int
AgentTokenBudget returns the smallest positive MaxTokensPerRun across policies that apply to the named agent, or 0 when no budget is configured. Policies with target_agents only match the listed agents; policies without target_agents apply to all agents.
func BuiltinMemoryToolNames ¶
func BuiltinMemoryToolNames() []string
BuiltinMemoryToolNames returns the sorted list of built-in memory tool names.
func BuiltinOrlojToolNames ¶ added in v0.6.0
func BuiltinOrlojToolNames() []string
BuiltinOrlojToolNames returns the sorted list of built-in orloj tool names.
func CanRunAsJob ¶ added in v0.16.0
func CanRunAsJob(agent resources.Agent, tools []resources.Tool, mcpServers map[string]resources.McpServer) bool
CanRunAsJob checks whether an agent can run as a K8s Job. Agents with Docker-dependent tools (container isolation or stdio MCP with image) cannot run as Jobs and fall back to in-process execution.
func ConfigureA2ARuntime ¶ added in v0.17.0
func ConfigureA2ARuntime(rt ToolRuntime, a2aRT ToolRuntime, namespace string)
ConfigureA2ARuntime builds and attaches a runtime for type=a2a tools. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureCliRuntime ¶ added in v0.5.0
func ConfigureCliRuntime(rt ToolRuntime, secrets SecretResolver, runner CLICommandRunner, config CLIToolRuntimeConfig, namespace string)
ConfigureCliRuntime builds and attaches a CLI runtime for direct (non-containerized) CLI tool execution. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureExternalRuntime ¶ added in v0.6.0
func ConfigureExternalRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
ConfigureExternalRuntime builds and attaches a runtime for type=external tools. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureGRPCRuntime ¶ added in v0.6.0
func ConfigureGRPCRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
ConfigureGRPCRuntime builds and attaches a runtime for type=grpc tools. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureHttpRuntime ¶ added in v0.9.0
func ConfigureHttpRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
ConfigureHttpRuntime replaces the HTTP base runtime with one that has a secret resolver, enabling HTTP tools with auth.secretRef to resolve their credentials. Must be called after BuildGovernedToolRuntimeForAgent* when the caller has a secret resolver available (e.g. a store-backed resolver in the worker).
func ConfigureKubernetesRuntime ¶ added in v0.16.0
func ConfigureKubernetesRuntime(rt ToolRuntime, k8sRT ToolRuntime, namespace string)
ConfigureKubernetesRuntime builds and attaches a runtime for isolation_mode=kubernetes tools. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureMcpRuntime ¶
func ConfigureMcpRuntime(rt ToolRuntime, sessionManager *McpSessionManager, mcpServerStore McpServerLookup, namespace string)
ConfigureMcpRuntime builds and attaches an MCP runtime using the given session manager and server store. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureWasmRuntime ¶ added in v0.11.0
func ConfigureWasmRuntime(rt ToolRuntime, wasmRT ToolRuntime, namespace string)
ConfigureWasmRuntime builds and attaches a WASM runtime for type=wasm tools. The runtime is scoped to the governed runtime's registry and the provided namespace.
func ConfigureWebhookCallbackRuntime ¶ added in v0.6.0
func ConfigureWebhookCallbackRuntime(rt ToolRuntime, secrets SecretResolver, namespace string)
ConfigureWebhookCallbackRuntime builds and attaches a runtime for type=webhook-callback tools. The runtime is scoped to the governed runtime's registry and the provided namespace.
func DefaultSafeHTTPClient ¶ added in v0.8.0
DefaultSafeHTTPClient returns a shared *http.Client whose transport enforces SSRF policy at dial time. Prefer this over constructing a fresh client when the default 30-second timeout is acceptable.
func EncodeReviewRequestPayload ¶ added in v0.10.0
func EncodeReviewRequestPayload(payload ReviewRequestPayload) string
func EnforcePoliciesForAgent ¶ added in v0.6.0
func EnforcePoliciesForAgent(agent resources.Agent, effectiveModel string, policies []resources.AgentPolicy) error
EnforcePoliciesForAgent checks that the agent's effective model and declared tools comply with all matched AgentPolicy resources. Returns an error on the first violation. This must be called in both synchronous and message-driven execution paths before the agent runs.
func ExecutionToAgentJobResult ¶ added in v0.16.0
func ExecutionToAgentJobResult(r AgentExecutionResult, execErr error) *resources.AgentJobResult
ExecutionToAgentJobResult converts an AgentExecutionResult into an AgentJobResult for storage by the agent pod.
func IsApprovalRequiredError ¶
func IsBuiltinMemoryTool ¶
IsBuiltinMemoryTool returns true if the tool name is a built-in memory tool.
func IsBuiltinOrlojTool ¶ added in v0.6.0
IsBuiltinOrlojTool returns true if the tool name is a built-in orloj tool.
func IsToolDeniedError ¶
func MatchedPolicies ¶ added in v0.6.0
func MatchedPolicies(task resources.Task, system resources.AgentSystem, all []resources.AgentPolicy) []resources.AgentPolicy
MatchedPolicies returns the subset of policies that apply to the given task/system combination, respecting apply_mode (global vs scoped).
func MinimumChildDepth ¶ added in v0.6.0
func MinimumChildDepth(policies []resources.AgentPolicy) int
MinimumChildDepth returns the smallest positive MaxChildDepth across the given policies, or 0 when no limit is configured.
func MinimumChildTasks ¶ added in v0.6.0
func MinimumChildTasks(policies []resources.AgentPolicy) int
MinimumChildTasks returns the smallest positive MaxChildTasks across the given policies, or 0 when no limit is configured.
func MinimumTokenBudget ¶ added in v0.6.0
func MinimumTokenBudget(policies []resources.AgentPolicy) int
MinimumTokenBudget returns the smallest positive MaxTokensPerRun across system-wide policies (those without target_agents), or 0 when no budget is configured. Policies with target_agents are per-agent budgets and are handled by AgentTokenBudget instead.
func NewToolDeniedError ¶
func NewToolError ¶
func ParseInputFromApprovalError ¶ added in v0.13.0
ParseInputFromApprovalError extracts the tool input from a structured ToolApprovalRequiredError in the error chain. Returns empty string if not found.
func ParseToolFromApprovalError ¶ added in v0.6.0
ParseToolFromApprovalError extracts the tool name from an approval-required error chain by looking for "tool=..." in the error message.
func RedactSensitive ¶
RedactSensitive replaces known sensitive patterns (auth headers, API keys, tokens) in s with a redacted placeholder. This is applied as defense-in-depth before including process output (stderr, error messages) in logs or traces.
func RegisterModelProvider ¶
func RegisterModelProvider(plugin ModelProviderPlugin) error
RegisterModelProvider registers a plugin globally for model gateway and router usage.
func RegisterToolIsolationBackend ¶
func RegisterToolIsolationBackend(mode string, factory ToolIsolationBackendFactory) error
func ResumeMessageFromAgentMessage ¶ added in v0.10.0
func ResumeMessageFromAgentMessage(msg AgentMessage) resources.TaskApprovalResumeMessage
func RetryAfter ¶
RetryAfter builds a handler error that asks the bus to requeue this delivery after delay.
func SafeDialer ¶ added in v0.8.0
SafeDialer returns a *net.Dialer whose Control hook enforces SSRF policy against the actual IP the runtime is about to connect to. This closes the hostname-bypass gap in ValidateEndpointURL and defends against DNS rebinding: even if a hostname resolves to a public IP during validation and a private IP at dial time, the dial is aborted.
Pass allowPrivate=true to permit connections to RFC 1918 / ULA / CGNAT addresses (e.g. self-hosted Ollama, vLLM, LM Studio, internal services). Loopback, link-local, cloud metadata, and unspecified addresses are always blocked regardless of allowPrivate.
func SafeHTTPClient ¶ added in v0.8.0
SafeHTTPClient returns an *http.Client whose transport dials through SafeDialer, enforcing SSRF policy on every outbound connection. Pass timeout<=0 to use the default 30-second timeout.
func SafeModelGatewayHTTPClient ¶ added in v0.14.0
SafeModelGatewayHTTPClient returns a safe HTTP client for trusted model endpoints. With allowPrivate=true it permits loopback and private model servers, but still blocks cloud metadata, link-local, and unspecified addresses.
func TaskApprovalResourceName ¶ added in v0.10.0
TaskApprovalResourceName returns a deterministic resource name for a TaskApproval keyed by (taskKey, checkpointID, cycle).
func ToolApprovalResourceName ¶ added in v0.6.0
ToolApprovalResourceName returns the deterministic resource name for a ToolApproval keyed by (taskKey, messageID).
func ToolApprovalScopedStoreKey ¶
ToolApprovalScopedStoreKey returns the same lookup key used for ToolApproval resources created by pauseTaskForToolApproval (namespace/name).
func ToolErrorMeta ¶
func ValidateEndpointURL ¶
ValidateEndpointURL checks that a URL is safe for outbound requests from tool and MCP runtimes. It blocks dangerous URL schemes and, when the host is a literal IP address, rejects loopback, link-local, cloud metadata, and (optionally) private addresses.
When the host is a hostname (not a literal IP), scheme validation still applies but IP-level checks are deferred to the dial layer installed by SafeHTTPClient / SafeDialer. Callers that build an *http.Client with SafeHTTPClient get dial-time enforcement automatically; callers that do not (e.g. code that predates SafeHTTPClient) MUST call SafeHTTPClient rather than relying on ValidateEndpointURL alone for SSRF protection.
Pass allowPrivate=true to skip the private/internal address checks (e.g. for development or explicitly trusted internal services).
Types ¶
type AgentExecutionResult ¶
type AgentExecutionResult struct {
Agent string
Model string
Steps int
ToolCalls int
MemoryWrites int
EstimatedTokens int
TokensUsed int
TokenSource string
Duration time.Duration
Output string
LastEvent string
Events []string
StepEvents []AgentStepEvent
}
AgentExecutionResult captures task-time execution details for one agent.
func AgentJobResultToExecution ¶ added in v0.16.0
func AgentJobResultToExecution(r *resources.AgentJobResult, agentName string) AgentExecutionResult
AgentJobResultToExecution converts an AgentJobResult from a K8s Job back into an AgentExecutionResult for use by the controller/consumer.
type AgentJobStore ¶ added in v0.16.0
type AgentJobStore interface {
Get(ctx context.Context, name string) (resources.Task, bool, error)
SetAgentJobInput(ctx context.Context, name string, input map[string]string, agent, messageID string) error
SetAgentJobResult(ctx context.Context, name string, result *resources.AgentJobResult) error
GetAgentJobResult(ctx context.Context, name string) (*resources.AgentJobResult, error)
ClearAgentJobFields(ctx context.Context, name string) error
}
AgentJobStore is the minimal interface for orchestrator↔pod communication via Postgres. Implemented by store.TaskStore.
type AgentMessage ¶
type AgentMessage struct {
MessageID string `json:"message_id,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
TaskID string `json:"task_id,omitempty"`
Attempt int `json:"attempt,omitempty"`
System string `json:"system,omitempty"`
Namespace string `json:"namespace,omitempty"`
FromAgent string `json:"from_agent,omitempty"`
ToAgent string `json:"to_agent,omitempty"`
BranchID string `json:"branch_id,omitempty"`
ParentBranchID string `json:"parent_branch_id,omitempty"`
Type string `json:"type,omitempty"`
Payload string `json:"payload,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
TraceID string `json:"trace_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
DelegateOf string `json:"delegate_of,omitempty"`
}
AgentMessage is the runtime envelope exchanged between agents.
func AgentMessageFromResumeMessage ¶ added in v0.10.0
func AgentMessageFromResumeMessage(msg resources.TaskApprovalResumeMessage) AgentMessage
type AgentMessageBus ¶
type AgentMessageBus interface {
Publish(context.Context, AgentMessage) (AgentMessage, error)
Consume(context.Context, AgentMessageSubscription, AgentMessageHandler) error
Close() error
}
AgentMessageBus is the runtime data-plane contract for agent messaging.
type AgentMessageConsumerManager ¶
type AgentMessageConsumerManager struct {
// contains filtered or unexported fields
}
AgentMessageConsumerManager watches agents and consumes runtime inbox messages per agent.
func NewAgentMessageConsumerManager ¶
func NewAgentMessageConsumerManager( bus AgentMessageBus, agents AgentRegistry, systems AgentSystemRegistry, tasks TaskStateStore, logger *log.Logger, opts AgentMessageConsumerOptions, ) *AgentMessageConsumerManager
func (*AgentMessageConsumerManager) Start ¶
func (m *AgentMessageConsumerManager) Start(ctx context.Context)
type AgentMessageConsumerOptions ¶
type AgentMessageConsumerOptions struct {
WorkerID string
Namespace string
RefreshEvery time.Duration
DedupeWindow time.Duration
ConsumerDelay time.Duration
LeaseExtendDuration time.Duration
Executor *TaskExecutor
Tools ToolResourceLookup
Roles AgentRoleLookup
ToolPermissions ToolPermissionLookup
IsolatedToolRuntime ToolRuntime
WasmToolRuntime ToolRuntime
CliToolConfig CLIToolRuntimeConfig
SecretResolver SecretResolver
McpSessionManager *McpSessionManager
McpServerStore McpServerLookup
Extensions Extensions
Memories MemoryResourceLookup
MemoryBackends *PersistentMemoryBackendRegistry
ModelEndpoints resources.ModelEndpointLookup
ToolApprovals ToolApprovalUpserter
TaskApprovals TaskApprovalUpserter
Policies AgentPolicyLookup
ContextAdapters ContextAdapterGetter
KubernetesToolRT ToolRuntime
A2AToolRuntime ToolRuntime
AgentK8sRuntime *KubernetesAgentRuntime
OnStepEvent func(taskName, namespace string, evt AgentStepEvent)
DebugLogger *log.Logger
}
AgentMessageConsumerOptions configures inbox consumers in a worker.
type AgentMessageDelivery ¶
type AgentMessageDelivery interface {
Message() AgentMessage
Ack(context.Context) error
Nack(context.Context, bool) error
NackWithDelay(context.Context, time.Duration) error
ExtendLease(context.Context, time.Duration) error
}
AgentMessageDelivery represents one delivery instance with ack semantics.
type AgentMessageHandler ¶
type AgentMessageHandler func(context.Context, AgentMessageDelivery) error
AgentMessageHandler processes one message delivery.
type AgentMessageSubscription ¶
AgentMessageSubscription identifies a consumer input stream.
type AgentPolicyLookup ¶ added in v0.6.0
type AgentPolicyLookup interface {
List(ctx context.Context) ([]resources.AgentPolicy, error)
}
AgentPolicyLookup lists AgentPolicy resources for policy enforcement.
type AgentRegistry ¶
type AgentRegistry interface {
List(ctx context.Context) ([]resources.Agent, error)
Get(ctx context.Context, name string) (resources.Agent, bool, error)
}
AgentRegistry lists and resolves declared agents for message consumer subscriptions/execution.
type AgentRoleLookup ¶
type AgentStepEvent ¶
type AgentStepEvent struct {
Timestamp string
Type string
Step int
Tool string
Message string
ErrorCode string
ErrorReason string
Retryable *bool
ToolContractVersion string
ToolRequestID string
ToolAttempt int
LatencyMS int64
Tokens int
InputTokens int
OutputTokens int
UsageSource string
ToolAuthProfile string
ToolAuthSecretRef string
}
AgentStepEvent is one structured runtime event emitted during agent execution.
type AgentSystemRegistry ¶
type AgentSystemRegistry interface {
Get(ctx context.Context, name string) (resources.AgentSystem, bool, error)
}
AgentSystemRegistry resolves AgentSystem resources for next-hop routing.
type AgentToolAuthorizer ¶
type AgentToolAuthorizer struct {
// contains filtered or unexported fields
}
func NewAgentToolAuthorizer ¶
func NewAgentToolAuthorizer( ctx context.Context, namespace string, agent resources.Agent, roleLookup AgentRoleLookup, permissionLookup ToolPermissionLookup, ) *AgentToolAuthorizer
func (*AgentToolAuthorizer) Authorize ¶
func (a *AgentToolAuthorizer) Authorize(tool string, spec resources.ToolSpec) (*AuthorizeResult, error)
type AgentWorker ¶
type AgentWorker struct {
// contains filtered or unexported fields
}
AgentWorker runs the core execution loop for one agent.
func NewAgentWorker ¶
func NewAgentWorker(agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, onEvent func(string)) *AgentWorker
func NewAgentWorkerWithInterval ¶
func NewAgentWorkerWithInterval(agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, onEvent func(string), stepEvery time.Duration) *AgentWorker
func NewAgentWorkerWithIntervalAndGateway ¶
func NewAgentWorkerWithIntervalAndGateway( agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, modelGateway ModelGateway, onEvent func(string), stepEvery time.Duration, ) *AgentWorker
func NewAgentWorkerWithIntervalAndGatewayAndInput ¶
func NewAgentWorkerWithIntervalAndGatewayAndInput( agent resources.Agent, toolRuntime ToolRuntime, memory MemoryStore, modelGateway ModelGateway, input map[string]string, onEvent func(string), stepEvery time.Duration, ) *AgentWorker
func (*AgentWorker) Run ¶
func (w *AgentWorker) Run(ctx context.Context)
func (*AgentWorker) SetToolSchemas ¶
func (w *AgentWorker) SetToolSchemas(schemas map[string]ToolSchemaInfo)
SetToolSchemas attaches per-tool description and JSON Schema metadata. Model gateways use these to provide rich tool definitions to the LLM instead of the generic {input: string} fallback.
type AnthropicModelGateway ¶
type AnthropicModelGateway struct {
// contains filtered or unexported fields
}
AnthropicModelGateway calls the Anthropic Messages API.
func NewAnthropicModelGateway ¶
func NewAnthropicModelGateway(cfg AnthropicModelGatewayConfig) (*AnthropicModelGateway, error)
func (*AnthropicModelGateway) Complete ¶
func (g *AnthropicModelGateway) Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
type AnthropicModelGatewayConfig ¶
type AnthropicModelGatewayConfig struct {
APIKey string
BaseURL string
DefaultModel string
AnthropicVersion string
MaxTokens int
Timeout time.Duration
HTTPClient *http.Client
}
AnthropicModelGatewayConfig defines Anthropic Messages API settings.
func DefaultAnthropicModelGatewayConfig ¶
func DefaultAnthropicModelGatewayConfig() AnthropicModelGatewayConfig
DefaultAnthropicModelGatewayConfig returns Anthropic gateway defaults.
type AuditEvent ¶
type AuditEvent struct {
Timestamp string `json:"timestamp"`
Component string `json:"component,omitempty"`
Action string `json:"action"`
Outcome string `json:"outcome"`
Namespace string `json:"namespace,omitempty"`
ResourceKind string `json:"resource_kind,omitempty"`
ResourceName string `json:"resource_name,omitempty"`
Principal string `json:"principal,omitempty"`
Message string `json:"message,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
AuditEvent captures one normalized audit event for optional external audit sinks.
type AuditSink ¶
type AuditSink interface {
RecordAudit(ctx context.Context, event AuditEvent)
}
AuditSink receives audit events. Implementations should be non-blocking and resilient.
type AuthInjector ¶
type AuthInjector struct {
// contains filtered or unexported fields
}
AuthInjector centralizes auth resolution for all tool runtime backends. It resolves Tool.spec.auth into concrete headers/env based on the auth profile.
func NewAuthInjector ¶
func NewAuthInjector(secrets SecretResolver, tokenCache *OAuth2TokenCache) *AuthInjector
func (*AuthInjector) EvictOAuth2Token ¶
func (a *AuthInjector) EvictOAuth2Token(tokenURL, clientID string)
EvictOAuth2Token removes a cached OAuth2 token, used on 401 responses.
func (*AuthInjector) Resolve ¶
func (a *AuthInjector) Resolve(ctx context.Context, toolName string, auth resources.ToolAuth) (AuthResult, error)
Resolve produces an AuthResult for the given tool auth config. Returns an empty AuthResult (no error) when no auth is configured.
type AuthResult ¶
AuthResult holds resolved authentication artifacts for tool backends. Headers are used by HTTP-based backends; EnvVars are used by the container backend.
type AuthorizeResult ¶
type AzureOpenAIModelGateway ¶
type AzureOpenAIModelGateway struct {
// contains filtered or unexported fields
}
AzureOpenAIModelGateway calls Azure OpenAI chat completions API.
func NewAzureOpenAIModelGateway ¶
func NewAzureOpenAIModelGateway(cfg AzureOpenAIModelGatewayConfig) (*AzureOpenAIModelGateway, error)
func (*AzureOpenAIModelGateway) Complete ¶
func (g *AzureOpenAIModelGateway) Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
type AzureOpenAIModelGatewayConfig ¶
type AzureOpenAIModelGatewayConfig struct {
APIKey string
BaseURL string
DefaultDeployment string
APIVersion string
Timeout time.Duration
HTTPClient *http.Client
}
AzureOpenAIModelGatewayConfig defines Azure OpenAI chat completion settings.
func DefaultAzureOpenAIModelGatewayConfig ¶
func DefaultAzureOpenAIModelGatewayConfig() AzureOpenAIModelGatewayConfig
DefaultAzureOpenAIModelGatewayConfig returns Azure OpenAI gateway defaults.
type BedrockModelGateway ¶ added in v0.10.0
type BedrockModelGateway struct {
// contains filtered or unexported fields
}
BedrockModelGateway calls the AWS Bedrock Converse API.
func NewBedrockModelGateway ¶ added in v0.10.0
func NewBedrockModelGateway(cfg BedrockModelGatewayConfig) (*BedrockModelGateway, error)
NewBedrockModelGateway builds a Bedrock gateway from the given config.
func (*BedrockModelGateway) Complete ¶ added in v0.10.0
func (g *BedrockModelGateway) Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
type BedrockModelGatewayConfig ¶ added in v0.10.0
type BedrockModelGatewayConfig struct {
Region string
AccessKeyID string
SecretAccessKey string
SessionToken string
Profile string
BaseURL string
DefaultModel string
MaxTokens int
Timeout time.Duration
}
BedrockModelGatewayConfig defines AWS Bedrock Converse API settings.
func DefaultBedrockModelGatewayConfig ¶ added in v0.10.0
func DefaultBedrockModelGatewayConfig() BedrockModelGatewayConfig
DefaultBedrockModelGatewayConfig returns Bedrock gateway defaults.
type BoundedWriter ¶ added in v0.12.0
type BoundedWriter struct {
// contains filtered or unexported fields
}
BoundedWriter wraps a bytes.Buffer and stops accepting writes once the configured maximum is reached. It is safe for concurrent use.
func NewBoundedWriter ¶ added in v0.12.0
func NewBoundedWriter(max int) *BoundedWriter
NewBoundedWriter returns a writer that accepts at most max bytes.
func (*BoundedWriter) Exceeded ¶ added in v0.12.0
func (w *BoundedWriter) Exceeded() bool
Exceeded reports whether the cap was hit.
func (*BoundedWriter) String ¶ added in v0.12.0
func (w *BoundedWriter) String() string
String returns the captured output.
type CLICommandRunner ¶ added in v0.5.0
type CLICommandRunner interface {
Run(ctx context.Context, command string, args []string, stdin string, env []string, dir string) (stdout string, stderr string, exitCode int, err error)
}
CLICommandRunner abstracts process execution for testability.
type CLIToolRuntime ¶ added in v0.5.0
type CLIToolRuntime struct {
// contains filtered or unexported fields
}
CLIToolRuntime executes CLI tools directly on the worker host.
func NewCLIToolRuntime ¶ added in v0.5.0
func NewCLIToolRuntime(registry ToolCapabilityRegistry, secrets SecretResolver, runner CLICommandRunner, config CLIToolRuntimeConfig) *CLIToolRuntime
func (*CLIToolRuntime) WithNamespace ¶ added in v0.5.0
func (r *CLIToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*CLIToolRuntime) WithRegistry ¶ added in v0.5.0
func (r *CLIToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type CLIToolRuntimeConfig ¶ added in v0.5.0
CLIToolRuntimeConfig holds optional policy for direct CLI execution.
func DefaultCLIToolRuntimeConfig ¶ added in v0.5.0
func DefaultCLIToolRuntimeConfig() CLIToolRuntimeConfig
type Capability ¶
type Capability struct {
ID string `json:"id"`
Enabled bool `json:"enabled"`
Description string `json:"description,omitempty"`
Source string `json:"source,omitempty"`
}
Capability describes one discoverable feature exposed by the current runtime.
type CapabilityProvider ¶
type CapabilityProvider interface {
Capabilities(ctx context.Context) CapabilitySnapshot
}
CapabilityProvider returns deployment capabilities for API/UI/CLI feature discovery.
type CapabilitySnapshot ¶
type CapabilitySnapshot struct {
GeneratedAt string `json:"generated_at"`
Capabilities []Capability `json:"capabilities"`
}
CapabilitySnapshot returns the effective capability set for this deployment.
type ChainSecretResolver ¶
type ChainSecretResolver struct {
// contains filtered or unexported fields
}
func NewChainSecretResolver ¶
func NewChainSecretResolver(resolvers ...SecretResolver) *ChainSecretResolver
func (*ChainSecretResolver) WithNamespace ¶
func (r *ChainSecretResolver) WithNamespace(namespace string) SecretResolver
type ChatMessage ¶
type ChatMessage struct {
Role string // "system", "user", "assistant", "tool"
Content string
ToolCallID string // role="tool": the ID of the tool call this result answers
ToolCalls []ChatToolCall // role="assistant": tool calls the model made this turn
IsError bool // role="tool": true when this tool result represents a failure
}
ChatMessage represents one message in a multi-turn conversation.
type ChatToolCall ¶
ChatToolCall captures one tool invocation from an assistant message.
type Chunk ¶
Chunk represents one segment of a chunked document.
type ContainerCommandRunner ¶
type ContainerCommandRunner interface {
Run(ctx context.Context, binary string, args []string, stdin string, env map[string]string) (stdout string, stderr string, err error)
}
ContainerCommandRunner executes container runtime commands.
type ContainerToolRuntime ¶
type ContainerToolRuntime struct {
// contains filtered or unexported fields
}
ContainerToolRuntime executes tools inside a containerized sandbox.
func NewContainerToolRuntime ¶
func NewContainerToolRuntime(registry ToolCapabilityRegistry, config ContainerToolRuntimeConfig) *ContainerToolRuntime
func NewContainerToolRuntimeWithRunner ¶
func NewContainerToolRuntimeWithRunner( registry ToolCapabilityRegistry, config ContainerToolRuntimeConfig, runner ContainerCommandRunner, ) *ContainerToolRuntime
func NewContainerToolRuntimeWithRunnerAndSecrets ¶
func NewContainerToolRuntimeWithRunnerAndSecrets( registry ToolCapabilityRegistry, config ContainerToolRuntimeConfig, runner ContainerCommandRunner, secrets SecretResolver, ) *ContainerToolRuntime
func (*ContainerToolRuntime) WithNamespace ¶
func (r *ContainerToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*ContainerToolRuntime) WithRegistry ¶
func (r *ContainerToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type ContainerToolRuntimeConfig ¶
type ContainerToolRuntimeConfig struct {
RuntimeBinary string
Image string
Network string
Memory string
CPUs string
PidsLimit int
User string
Shell string
}
ContainerToolRuntimeConfig defines isolated tool execution in a locked-down container.
func DefaultContainerToolRuntimeConfig ¶
func DefaultContainerToolRuntimeConfig() ContainerToolRuntimeConfig
func SandboxedContainerDefaults ¶
func SandboxedContainerDefaults() ContainerToolRuntimeConfig
SandboxedContainerDefaults returns secure-by-default container settings for tools running in sandboxed isolation mode. These enforce:
- network=none (no network access)
- memory=128m (128 MB ceiling)
- cpus=0.50 (half a core)
- pids_limit=64 (process limit)
- user=65532:65532 (non-root nobody user)
These defaults match DefaultContainerToolRuntimeConfig but are preserved as an explicit contract so callers can distinguish between default and sandboxed modes.
type ContextAdapterDeps ¶ added in v0.12.0
type ContextAdapterDeps struct {
Tools ToolResourceLookup
Isolated ToolRuntime
Wasm ToolRuntime
SecretResolver SecretResolver
Cli CLIToolRuntimeConfig
McpMgr *McpSessionManager
McpStore McpServerLookup
}
ContextAdapterDeps supplies tool runtime machinery shared with TaskController and the message consumer.
type ContextAdapterGetter ¶ added in v0.12.0
type ContextAdapterGetter interface {
Get(ctx context.Context, key string) (resources.ContextAdapter, bool, error)
}
ContextAdapterGetter resolves ContextAdapter resources by store key (namespace-qualified).
type ContextAdapterHook ¶ added in v0.12.0
type ContextAdapterHook interface {
AdaptContext(ctx context.Context, input map[string]string) (map[string]string, error)
}
ContextAdapterHook transforms task input before any agent sees it. Implementations must be safe to call concurrently.
type EmbeddingProvider ¶
type EmbeddingProvider interface {
Embed(ctx context.Context, texts []string) ([][]float32, error)
Dimensions() int
}
EmbeddingProvider generates vector embeddings from text. Implementations are used by vector-database memory backends (e.g. pgvector) to embed values on write and queries on search.
type EnvSecretResolver ¶
type EnvSecretResolver struct {
Prefix string
}
EnvSecretResolver resolves secret refs from worker environment variables.
func NewEnvSecretResolver ¶
func NewEnvSecretResolver(prefix string) *EnvSecretResolver
func (*EnvSecretResolver) WithNamespace ¶
func (r *EnvSecretResolver) WithNamespace(_ string) SecretResolver
type EvalScoreResult ¶ added in v0.15.0
EvalScoreResult holds the outcome of scoring a single sample.
type EvalScorer ¶ added in v0.15.0
type EvalScorer struct {
Gateway ModelGateway
}
EvalScorer runs the scoring pipeline for eval samples.
func (*EvalScorer) Score ¶ added in v0.15.0
func (s *EvalScorer) Score(ctx context.Context, cfg resources.EvalScoringConfig, expected resources.EvalExpected, input map[string]string, output string) EvalScoreResult
Score evaluates a single sample's output using the given scoring configuration. The output string is the agent system's response from task.status.output.
type ExecutionEngine ¶
type ExecutionEngine interface {
Execute(ctx context.Context, agent resources.Agent, input map[string]string) (AgentExecutionResult, error)
}
ExecutionEngine orchestrates one agent execution loop.
type Extensions ¶
type Extensions struct {
Metering MeteringSink
Audit AuditSink
Capabilities CapabilityProvider
}
Extensions groups optional runtime hooks for add-on integrations.
func DefaultExtensions ¶
func DefaultExtensions() Extensions
DefaultExtensions returns OSS-safe defaults for all extension hooks.
func NormalizeExtensions ¶
func NormalizeExtensions(ext Extensions) Extensions
NormalizeExtensions applies safe defaults so callers can omit all optional hooks.
type ExternalToolRuntime ¶
type ExternalToolRuntime struct {
// contains filtered or unexported fields
}
ExternalToolRuntime delegates tool execution to an external HTTP service. Tools with spec.type=external have their ToolExecutionRequest forwarded to spec.endpoint and the ToolExecutionResponse parsed from the reply.
func NewExternalToolRuntime ¶
func NewExternalToolRuntime(registry ToolCapabilityRegistry, secrets SecretResolver, client HTTPDoer) *ExternalToolRuntime
func (*ExternalToolRuntime) SetAllowPrivateEndpoints ¶ added in v0.8.0
func (r *ExternalToolRuntime) SetAllowPrivateEndpoints(allow bool)
SetAllowPrivateEndpoints permits external tool delegation to private / internal IP ranges. Loopback, link-local, cloud metadata, and unspecified addresses remain blocked.
func (*ExternalToolRuntime) WithNamespace ¶
func (r *ExternalToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*ExternalToolRuntime) WithRegistry ¶
func (r *ExternalToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type GRPCDialer ¶
type GRPCDialer interface {
DialContext(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
}
GRPCDialer abstracts gRPC connection establishment for testing.
type GRPCToolRuntime ¶
type GRPCToolRuntime struct {
// contains filtered or unexported fields
}
GRPCToolRuntime executes tools via a unary gRPC call to an external service. The service must implement orloj.tool.v1.ToolService/Execute accepting ToolExecutionRequest and returning ToolExecutionResponse as JSON payloads.
func NewGRPCToolRuntime ¶
func NewGRPCToolRuntime(registry ToolCapabilityRegistry, secrets SecretResolver, dialer GRPCDialer) *GRPCToolRuntime
func (*GRPCToolRuntime) SetAllowInsecure ¶
func (r *GRPCToolRuntime) SetAllowInsecure(allow bool)
SetAllowInsecure enables plaintext gRPC connections. This should only be used in development or when the transport is otherwise secured (e.g. service mesh with mTLS). Callers must explicitly opt in.
func (*GRPCToolRuntime) WithNamespace ¶
func (r *GRPCToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*GRPCToolRuntime) WithRegistry ¶
func (r *GRPCToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type GovernedToolApprovalContext ¶
type GovernedToolApprovalContext struct {
Getter func(key string) (resources.ToolApproval, bool, error)
TaskKey string
MessageID string
}
GovernedToolApprovalContext optionally lets the governed tool runtime treat an existing Approved ToolApproval (same key as pauseTaskForToolApproval) as a grant to invoke the tool, so resuming a message after approval does not loop on approval_required for every fresh agent worker run.
type GovernedToolRuntime ¶
type GovernedToolRuntime struct {
// contains filtered or unexported fields
}
GovernedToolRuntime enforces per-tool policy (timeout/retry/isolation) using Tool CRD runtime metadata.
func NewGovernedToolRuntime ¶
func NewGovernedToolRuntime( baseRuntime ToolRuntime, isolatedRuntime ToolRuntime, registry ToolCapabilityRegistry, strict bool, ) *GovernedToolRuntime
func NewGovernedToolRuntimeWithAuthorizer ¶
func NewGovernedToolRuntimeWithAuthorizer( baseRuntime ToolRuntime, isolatedRuntime ToolRuntime, registry ToolCapabilityRegistry, authorizer ToolCallAuthorizer, strict bool, ) *GovernedToolRuntime
func (*GovernedToolRuntime) ResolveToolSchemas ¶
func (r *GovernedToolRuntime) ResolveToolSchemas(toolNames []string) map[string]ToolSchemaInfo
ResolveToolSchemas returns description and input schema metadata for the given tool names, sourced from the underlying ToolCapabilityRegistry.
func (*GovernedToolRuntime) SetMcpRuntime ¶
func (r *GovernedToolRuntime) SetMcpRuntime(mcpRuntime ToolRuntime)
SetMcpRuntime configures the MCP tool runtime used for type=mcp tools.
func (*GovernedToolRuntime) SetWasmRuntime ¶ added in v0.11.0
func (r *GovernedToolRuntime) SetWasmRuntime(wasmRuntime ToolRuntime)
SetWasmRuntime configures the embedded WASM tool runtime used for type=wasm tools.
type HTTPMemoryBackend ¶
type HTTPMemoryBackend struct {
// contains filtered or unexported fields
}
HTTPMemoryBackend implements PersistentMemoryBackend by delegating to an external HTTP service that speaks the Orloj memory provider contract. See docs/pages/concepts/memory.md for the contract specification.
func NewHTTPMemoryBackend ¶
func NewHTTPMemoryBackend(endpoint, authToken string) *HTTPMemoryBackend
func (*HTTPMemoryBackend) List ¶
func (b *HTTPMemoryBackend) List(ctx context.Context, prefix string) ([]MemorySearchResult, error)
func (*HTTPMemoryBackend) Put ¶
func (b *HTTPMemoryBackend) Put(ctx context.Context, key, value string) error
func (*HTTPMemoryBackend) Search ¶
func (b *HTTPMemoryBackend) Search(ctx context.Context, query string, topK int) ([]MemorySearchResult, error)
type HTTPToolClient ¶
type HTTPToolClient struct {
// contains filtered or unexported fields
}
HTTPToolClient executes tools via HTTP POST against Tool.spec.endpoint. It replaces MockToolClient as the base runtime for isolation_mode=none.
func NewHTTPToolClient ¶
func NewHTTPToolClient(registry ToolCapabilityRegistry, secrets SecretResolver, client HTTPDoer) *HTTPToolClient
func NewHTTPToolClientWithAuth ¶
func NewHTTPToolClientWithAuth(registry ToolCapabilityRegistry, injector *AuthInjector, client HTTPDoer) *HTTPToolClient
func (*HTTPToolClient) SetAllowPrivateEndpoints ¶
func (r *HTTPToolClient) SetAllowPrivateEndpoints(allow bool)
SetAllowPrivateEndpoints permits HTTP tool calls to private/internal IP ranges (RFC 1918). Loopback and cloud metadata addresses are always blocked. When the runtime is using its internally-built safe HTTP client, this swaps the client for one whose dial-time policy matches, so call-time validation and dial-time enforcement stay consistent.
func (*HTTPToolClient) WithNamespace ¶
func (r *HTTPToolClient) WithNamespace(namespace string) ToolRuntime
func (*HTTPToolClient) WithRegistry ¶
func (r *HTTPToolClient) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is a PersistentMemoryBackend backed by an in-process map. Useful for testing and single-instance deployments.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
func (*InMemoryBackend) List ¶
func (b *InMemoryBackend) List(_ context.Context, prefix string) ([]MemorySearchResult, error)
func (*InMemoryBackend) Put ¶
func (b *InMemoryBackend) Put(_ context.Context, key, value string) error
func (*InMemoryBackend) Search ¶
func (b *InMemoryBackend) Search(_ context.Context, query string, topK int) ([]MemorySearchResult, error)
type KubernetesAgentConfig ¶ added in v0.16.0
type KubernetesAgentConfig struct {
Namespace string
ServiceAccount string
Image string
JobTTLSeconds int32
DefaultMemory string
DefaultCPU string
EnvConfigMap string
EnvSecretName string
}
KubernetesAgentConfig holds operator-level defaults for agent K8s execution.
type KubernetesAgentRuntime ¶ added in v0.16.0
type KubernetesAgentRuntime struct {
// contains filtered or unexported fields
}
KubernetesAgentRuntime executes agents as ephemeral Kubernetes Jobs.
func NewKubernetesAgentRuntime ¶ added in v0.16.0
func NewKubernetesAgentRuntime( client KubernetesJobClient, config KubernetesAgentConfig, store AgentJobStore, logger *log.Logger, ) *KubernetesAgentRuntime
func (*KubernetesAgentRuntime) ExecuteAgent ¶ added in v0.16.0
func (r *KubernetesAgentRuntime) ExecuteAgent( ctx context.Context, task resources.Task, agent resources.Agent, input map[string]string, attempt int, messageID string, ) (*resources.AgentJobResult, error)
ExecuteAgent runs an agent as a K8s Job and returns the result.
type KubernetesJobClient ¶ added in v0.16.0
type KubernetesJobClient interface {
CreateJob(ctx context.Context, namespace string, job *batchv1.Job) (*batchv1.Job, error)
WatchJob(ctx context.Context, namespace, name string) (watch.Interface, error)
GetJob(ctx context.Context, namespace, name string) (*batchv1.Job, error)
GetPodLogs(ctx context.Context, namespace, podName string) (string, error)
ListPods(ctx context.Context, namespace, jobName string) ([]corev1.Pod, error)
DeleteJob(ctx context.Context, namespace, name string) error
}
KubernetesJobClient abstracts the Kubernetes API calls for testing.
func NewDefaultKubernetesJobClient ¶ added in v0.16.0
func NewDefaultKubernetesJobClient(clientset kubernetes.Interface) KubernetesJobClient
NewDefaultKubernetesJobClient wraps a kubernetes.Interface as a KubernetesJobClient.
type KubernetesSecretClient ¶ added in v0.16.0
type KubernetesSecretClient interface {
GetSecret(ctx context.Context, namespace, name string) (map[string][]byte, error)
}
KubernetesSecretClient abstracts Kubernetes Secret API calls for testing.
type KubernetesSecretResolver ¶ added in v0.16.0
type KubernetesSecretResolver struct {
// contains filtered or unexported fields
}
KubernetesSecretResolver resolves secretRef values from Kubernetes Secrets.
func NewKubernetesSecretResolver ¶ added in v0.16.0
func NewKubernetesSecretResolver(clientset kubernetes.Interface, defaultKey string) *KubernetesSecretResolver
func NewKubernetesSecretResolverWithClient ¶ added in v0.16.0
func NewKubernetesSecretResolverWithClient(client KubernetesSecretClient, defaultKey string) *KubernetesSecretResolver
func (*KubernetesSecretResolver) WithNamespace ¶ added in v0.16.0
func (r *KubernetesSecretResolver) WithNamespace(namespace string) SecretResolver
type KubernetesToolConfig ¶ added in v0.16.0
type KubernetesToolConfig struct {
Namespace string
ServiceAccount string
DefaultImage string
JobTTLSeconds int32
}
KubernetesToolConfig holds operator-level defaults for the K8s tool runtime.
type KubernetesToolRuntime ¶ added in v0.16.0
type KubernetesToolRuntime struct {
// contains filtered or unexported fields
}
KubernetesToolRuntime executes tools as ephemeral Kubernetes Jobs.
func NewKubernetesToolRuntime ¶ added in v0.16.0
func NewKubernetesToolRuntime( clientset kubernetes.Interface, config KubernetesToolConfig, secrets SecretResolver, ) *KubernetesToolRuntime
func NewKubernetesToolRuntimeWithClient ¶ added in v0.16.0
func NewKubernetesToolRuntimeWithClient( client KubernetesJobClient, config KubernetesToolConfig, secrets SecretResolver, ) *KubernetesToolRuntime
func (*KubernetesToolRuntime) WithNamespace ¶ added in v0.16.0
func (r *KubernetesToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*KubernetesToolRuntime) WithRegistry ¶ added in v0.16.0
func (r *KubernetesToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type MCPToolRuntime ¶
type MCPToolRuntime struct {
// contains filtered or unexported fields
}
MCPToolRuntime executes tool calls against MCP servers. It resolves the mcp_server_ref from the tool's ToolSpec, retrieves the session from the McpSessionManager, and delegates to tools/call.
func NewMCPToolRuntime ¶
func NewMCPToolRuntime( registry ToolCapabilityRegistry, sessionManager *McpSessionManager, mcpServerStore McpServerLookup, ) *MCPToolRuntime
func (*MCPToolRuntime) WithNamespace ¶
func (r *MCPToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*MCPToolRuntime) WithRegistry ¶
func (r *MCPToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager tracks and reconciles running workers.
func NewManager ¶
func (*Manager) EnsureRunning ¶
func (*Manager) RunningAgents ¶
type McpCapabilities ¶
type McpCapabilities struct {
Tools *McpToolCapability `json:"tools,omitempty"`
}
type McpContent ¶
McpContent is one content block in a tool result.
type McpInitResult ¶
type McpInitResult struct {
ProtocolVersion string `json:"protocolVersion"`
ServerInfo McpServerInfo `json:"serverInfo"`
Capabilities McpCapabilities `json:"capabilities"`
}
McpInitResult captures the server's response to the initialize handshake.
type McpServerInfo ¶
type McpServerLookup ¶
type McpServerLookup interface {
Get(ctx context.Context, name string) (resources.McpServer, bool, error)
}
McpServerLookup resolves McpServer resources by scoped name.
type McpSession ¶
type McpSession struct {
Transport McpTransport
InitResult *McpInitResult
ServerName string
// contains filtered or unexported fields
}
McpSession wraps one active connection to an MCP server.
type McpSessionManager ¶
type McpSessionManager struct {
// contains filtered or unexported fields
}
McpSessionManager maintains one session per McpServer, handling connection pooling, initialization, idle eviction, and graceful shutdown.
func NewMcpSessionManager ¶
func NewMcpSessionManager(secretResolver SecretResolver) *McpSessionManager
func (*McpSessionManager) Close ¶
func (m *McpSessionManager) Close()
Close shuts down all active sessions.
func (*McpSessionManager) GetOrCreate ¶
func (m *McpSessionManager) GetOrCreate(ctx context.Context, server resources.McpServer) (*McpSession, error)
GetOrCreate returns an existing session or creates a new one for the given McpServer spec. Sessions are keyed by namespace/name. If the server's generation has changed since the cached session was created, the old session is torn down and a fresh one is built.
func (*McpSessionManager) Remove ¶
func (m *McpSessionManager) Remove(server resources.McpServer)
Remove closes and removes the session for the given server.
func (*McpSessionManager) SetAllowedCommands ¶
func (m *McpSessionManager) SetAllowedCommands(cmds []string)
SetAllowedCommands restricts the binaries that stdio MCP transports may execute. An empty list means "no restriction" (backwards-compatible). When set, only the basename (or full path) of spec.command must appear in the list for the transport to start.
func (*McpSessionManager) SetContainerConfig ¶ added in v0.7.0
func (m *McpSessionManager) SetContainerConfig(cfg ContainerToolRuntimeConfig)
SetContainerConfig sets the container runtime configuration used when McpServer resources specify spec.image for containerised stdio transport.
func (*McpSessionManager) StartReaper ¶ added in v0.7.0
func (m *McpSessionManager) StartReaper(ctx context.Context, interval time.Duration)
StartReaper runs a background goroutine that periodically evicts sessions whose idle time exceeds their configured idle_timeout. Sessions with idleTimeout == 0 are never evicted. The goroutine exits when ctx is done.
type McpToolCapability ¶
type McpToolCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
type McpToolDefinition ¶
type McpToolDefinition struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema map[string]any `json:"inputSchema,omitempty"`
}
McpToolDefinition describes one tool exposed by an MCP server via tools/list.
type McpToolResult ¶
type McpToolResult struct {
Content []McpContent `json:"content"`
IsError bool `json:"isError,omitempty"`
}
McpToolResult captures the response from a tools/call invocation.
func (*McpToolResult) McpTextResult ¶
func (r *McpToolResult) McpTextResult() string
McpTextResult returns the concatenated text content of a tool result.
type McpTransport ¶
type McpTransport interface {
Initialize(ctx context.Context) (*McpInitResult, error)
ListTools(ctx context.Context) ([]McpToolDefinition, error)
CallTool(ctx context.Context, name string, arguments map[string]any) (*McpToolResult, error)
Close() error
}
McpTransport abstracts the MCP JSON-RPC 2.0 communication layer. Implementations handle stdio (child process) and Streamable HTTP transports.
type MemoryAgentMessageBus ¶
type MemoryAgentMessageBus struct {
// contains filtered or unexported fields
}
MemoryAgentMessageBus is an in-process runtime message bus for local dev/test.
func NewMemoryAgentMessageBus ¶
func NewMemoryAgentMessageBus(subjectPrefix string, historyMax int, dedupeWindow time.Duration) *MemoryAgentMessageBus
func (*MemoryAgentMessageBus) Close ¶
func (b *MemoryAgentMessageBus) Close() error
func (*MemoryAgentMessageBus) Consume ¶
func (b *MemoryAgentMessageBus) Consume(ctx context.Context, sub AgentMessageSubscription, handler AgentMessageHandler) error
func (*MemoryAgentMessageBus) Publish ¶
func (b *MemoryAgentMessageBus) Publish(_ context.Context, message AgentMessage) (AgentMessage, error)
type MemoryManager ¶
type MemoryManager struct {
// contains filtered or unexported fields
}
MemoryManager stores short-lived runtime memory for an agent worker.
func NewMemoryManager ¶
func NewMemoryManager() *MemoryManager
func (*MemoryManager) Put ¶
func (m *MemoryManager) Put(key, value string)
func (*MemoryManager) Snapshot ¶
func (m *MemoryManager) Snapshot() map[string]string
type MemoryProviderConfig ¶
type MemoryProviderConfig struct {
Type string
Provider string
EmbeddingModel string
Endpoint string
AuthToken string
Options map[string]string
Embedder EmbeddingProvider
}
MemoryProviderConfig holds the fields from a Memory CRD spec that a provider factory needs to construct a backend.
type MemoryProviderFactory ¶
type MemoryProviderFactory func(cfg MemoryProviderConfig) (PersistentMemoryBackend, error)
MemoryProviderFactory creates a PersistentMemoryBackend from CRD config. Implementations should validate their own config and return a descriptive error if required fields are missing.
type MemoryProviderRegistry ¶
type MemoryProviderRegistry struct {
// contains filtered or unexported fields
}
MemoryProviderRegistry is a global registry of provider factories keyed by provider name (e.g. "pgvector", "qdrant", "weaviate"). Thread-safe.
func DefaultMemoryProviderRegistry ¶
func DefaultMemoryProviderRegistry() *MemoryProviderRegistry
DefaultMemoryProviderRegistry returns the global provider registry. Use this to register custom vector database providers at startup.
func (*MemoryProviderRegistry) Create ¶
func (r *MemoryProviderRegistry) Create(cfg MemoryProviderConfig) (PersistentMemoryBackend, error)
Create looks up the factory for the given provider name and calls it. An empty provider name falls back to "in-memory".
func (*MemoryProviderRegistry) Providers ¶
func (r *MemoryProviderRegistry) Providers() []string
Providers returns the sorted list of registered provider names.
func (*MemoryProviderRegistry) Register ¶
func (r *MemoryProviderRegistry) Register(name string, factory MemoryProviderFactory)
Register adds a provider factory under the given name. Names are case-insensitive and trimmed. Registering the same name twice replaces the previous factory.
type MemoryResourceLookup ¶
type MemoryResourceLookup interface {
Get(ctx context.Context, name string) (resources.Memory, bool, error)
}
MemoryResourceLookup resolves Memory CRDs by name.
type MemorySearchResult ¶
type MemorySearchResult struct {
Key string `json:"key"`
Value string `json:"value"`
Score float64 `json:"score,omitempty"`
}
MemorySearchResult is one entry returned by search or list.
type MemoryStore ¶
type MemoryStore interface {
Put(key, value string)
Get(key string) (string, bool)
Snapshot() map[string]string
}
MemoryStore stores short-lived agent working memory.
type MemoryToolRuntime ¶
type MemoryToolRuntime struct {
// contains filtered or unexported fields
}
MemoryToolRuntime wraps a ToolRuntime and intercepts built-in memory tool calls. When a persistent backend is set, it takes priority over the ephemeral shared store.
func NewMemoryToolRuntime ¶
func NewMemoryToolRuntime(delegate ToolRuntime, memory *SharedMemoryStore) *MemoryToolRuntime
func (*MemoryToolRuntime) WithPersistentBackend ¶
func (r *MemoryToolRuntime) WithPersistentBackend(backend PersistentMemoryBackend) *MemoryToolRuntime
WithPersistentBackend returns a copy that delegates to the persistent backend.
type MeteringEvent ¶
type MeteringEvent struct {
Timestamp string `json:"timestamp"`
Component string `json:"component,omitempty"`
Type string `json:"type"`
Namespace string `json:"namespace,omitempty"`
Task string `json:"task,omitempty"`
System string `json:"system,omitempty"`
Agent string `json:"agent,omitempty"`
Worker string `json:"worker,omitempty"`
Attempt int `json:"attempt,omitempty"`
MessageID string `json:"message_id,omitempty"`
Status string `json:"status,omitempty"`
TokensUsed int `json:"tokens_used,omitempty"`
TokensEstimated int `json:"tokens_estimated,omitempty"`
ToolCalls int `json:"tool_calls,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
MeteringEvent captures one normalized usage event for optional billing/usage sinks.
type MeteringSink ¶
type MeteringSink interface {
RecordMetering(ctx context.Context, event MeteringEvent)
}
MeteringSink receives metering events. Implementations should be non-blocking and resilient.
type MockModelGateway ¶
type MockModelGateway struct{}
MockModelGateway is an in-process placeholder model adapter.
func (*MockModelGateway) Complete ¶
func (m *MockModelGateway) Complete(_ context.Context, req ModelRequest) (ModelResponse, error)
type MockToolClient ¶
type MockToolClient struct{}
MockToolClient is an in-process placeholder for external tool systems.
type ModelEndpointLookup ¶
type ModelEndpointLookup interface {
Get(ctx context.Context, name string) (resources.ModelEndpoint, bool, error)
}
ModelEndpointLookup resolves namespaced ModelEndpoint resources.
type ModelGateway ¶
type ModelGateway interface {
Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
}
ModelGateway abstracts model-provider calls for agent execution.
func NewModelGatewayFromConfig ¶
func NewModelGatewayFromConfig(cfg ModelGatewayConfig) (ModelGateway, error)
NewModelGatewayFromConfig returns a provider-backed model gateway.
type ModelGatewayConfig ¶
type ModelGatewayConfig struct {
Provider string
APIKey string
BaseURL string
DefaultModel string
Options map[string]string
Timeout time.Duration
HTTPClient *http.Client
// AllowPrivate permits outbound gateway requests to trusted local/private
// model endpoints, including loopback, RFC 1918 / ULA, and CGNAT
// addresses. Only honored when HTTPClient is nil (otherwise the caller is
// responsible for the supplied client's egress policy).
AllowPrivate bool
}
ModelGatewayConfig configures a runtime model gateway provider.
func DefaultModelGatewayConfig ¶
func DefaultModelGatewayConfig() ModelGatewayConfig
DefaultModelGatewayConfig returns conservative defaults that preserve existing behavior.
type ModelGatewayError ¶
ModelGatewayError is returned by model gateways when the upstream provider returns an HTTP error. Callers can inspect StatusCode to distinguish transient failures (5xx, 429) from permanent ones (4xx).
func IsModelGatewayError ¶
func IsModelGatewayError(err error) (gatewayErr *ModelGatewayError, retryable bool)
IsModelGatewayError returns the underlying *ModelGatewayError if err wraps one, along with a flag indicating whether the caller should retry.
func (*ModelGatewayError) Error ¶
func (e *ModelGatewayError) Error() string
type ModelProviderPlugin ¶
type ModelProviderPlugin interface {
Name() string
Aliases() []string
RequiresAPIKey() bool
BuildGateway(cfg ModelGatewayConfig) (ModelGateway, error)
}
ModelProviderPlugin builds model gateways for a provider family.
type ModelProviderRegistry ¶
type ModelProviderRegistry struct {
// contains filtered or unexported fields
}
ModelProviderRegistry stores model provider plugins by name and alias.
func DefaultModelProviderRegistry ¶
func DefaultModelProviderRegistry() *ModelProviderRegistry
func NewModelProviderRegistry ¶
func NewModelProviderRegistry() *ModelProviderRegistry
func (*ModelProviderRegistry) Lookup ¶
func (r *ModelProviderRegistry) Lookup(provider string) (ModelProviderPlugin, bool)
func (*ModelProviderRegistry) Register ¶
func (r *ModelProviderRegistry) Register(plugin ModelProviderPlugin) error
type ModelRequest ¶
type ModelRequest struct {
Model string
ModelRef string
FallbackModelRefs []string
Namespace string
Agent string
Prompt string
Step int
Tools []string
ToolSchemas map[string]ToolSchemaInfo
Context map[string]string
Messages []ChatMessage
OutputSchema map[string]any
}
ModelRequest defines one model inference request for an agent step.
type ModelResponse ¶
type ModelResponse struct {
Content string
Done bool
ToolCalls []ModelToolCall
Usage ModelUsage
}
ModelResponse captures model output used by the runtime loop.
type ModelRouter ¶
type ModelRouter struct {
// contains filtered or unexported fields
}
ModelRouter routes model requests to ModelEndpoint-backed gateways by ModelRequest.ModelRef.
func NewModelRouter ¶
func NewModelRouter(cfg ModelRouterConfig) *ModelRouter
func (*ModelRouter) Complete ¶
func (r *ModelRouter) Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
type ModelRouterConfig ¶
type ModelRouterConfig struct {
Endpoints ModelEndpointLookup
Secrets SecretResourceLookup
SecretEnvPrefix string
}
ModelRouterConfig configures model routing via ModelEndpoint resources.
type ModelToolCall ¶
ModelToolCall is one model-selected tool invocation request.
type ModelUsage ¶
ModelUsage captures provider-reported or estimated token usage for one model call.
type ModuleSource ¶ added in v0.11.0
type ModuleSource int
ModuleSource classifies a module reference string.
const ( ModuleSourceLocal ModuleSource = iota ModuleSourceHTTPS ModuleSourceOCI )
func ClassifyModuleRef ¶ added in v0.11.0
func ClassifyModuleRef(ref string) ModuleSource
ClassifyModuleRef determines the source type of a module reference.
type NATSJetStreamAgentMessageBus ¶
type NATSJetStreamAgentMessageBus struct {
// contains filtered or unexported fields
}
NATSJetStreamAgentMessageBus is a durable runtime message bus backed by JetStream.
func (*NATSJetStreamAgentMessageBus) Close ¶
func (b *NATSJetStreamAgentMessageBus) Close() error
func (*NATSJetStreamAgentMessageBus) Consume ¶
func (b *NATSJetStreamAgentMessageBus) Consume(ctx context.Context, sub AgentMessageSubscription, handler AgentMessageHandler) error
func (*NATSJetStreamAgentMessageBus) Publish ¶
func (b *NATSJetStreamAgentMessageBus) Publish(ctx context.Context, message AgentMessage) (AgentMessage, error)
type OAuth2TokenCache ¶
type OAuth2TokenCache struct {
// contains filtered or unexported fields
}
OAuth2TokenCache caches access tokens obtained via the client_credentials grant. Tokens are keyed by tokenURL+clientID and evicted on expiry or explicit eviction.
func NewOAuth2TokenCache ¶
func NewOAuth2TokenCache(client HTTPDoer) *OAuth2TokenCache
func (*OAuth2TokenCache) Evict ¶
func (c *OAuth2TokenCache) Evict(tokenURL, clientID string)
Evict removes a cached token, forcing a fresh exchange on next GetToken.
type OCIArtifactPuller ¶ added in v0.11.0
type OCIArtifactPuller interface {
Pull(ctx context.Context, ref string, destPath string, auth *OCIAuth) error
}
OCIArtifactPuller abstracts OCI artifact pulls so callers can inject a real oras-go implementation or a test double.
type OCIAuth ¶ added in v0.11.0
OCIAuth carries credentials for authenticating to a private OCI registry.
type OllamaModelGateway ¶
type OllamaModelGateway struct {
// contains filtered or unexported fields
}
OllamaModelGateway calls Ollama's /api/chat endpoint.
func NewOllamaModelGateway ¶
func NewOllamaModelGateway(cfg OllamaModelGatewayConfig) (*OllamaModelGateway, error)
func (*OllamaModelGateway) Complete ¶
func (g *OllamaModelGateway) Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
type OllamaModelGatewayConfig ¶
type OllamaModelGatewayConfig struct {
BaseURL string
DefaultModel string
Timeout time.Duration
HTTPClient *http.Client
}
OllamaModelGatewayConfig defines Ollama chat settings.
func DefaultOllamaModelGatewayConfig ¶
func DefaultOllamaModelGatewayConfig() OllamaModelGatewayConfig
DefaultOllamaModelGatewayConfig returns Ollama gateway defaults.
type OpenAIEmbeddingProvider ¶
type OpenAIEmbeddingProvider struct {
// contains filtered or unexported fields
}
OpenAIEmbeddingProvider calls an OpenAI-compatible /embeddings endpoint. Works with OpenAI, Azure OpenAI, Ollama, and any compatible API.
func NewOpenAIEmbeddingProvider ¶
func NewOpenAIEmbeddingProvider(baseURL, apiKey, model string) *OpenAIEmbeddingProvider
func (*OpenAIEmbeddingProvider) Dimensions ¶
func (p *OpenAIEmbeddingProvider) Dimensions() int
type OpenAIModelGateway ¶
type OpenAIModelGateway struct {
// contains filtered or unexported fields
}
OpenAIModelGateway calls an OpenAI-compatible Chat Completions endpoint.
func NewOpenAIModelGateway ¶
func NewOpenAIModelGateway(cfg OpenAIModelGatewayConfig) (*OpenAIModelGateway, error)
func (*OpenAIModelGateway) Complete ¶
func (g *OpenAIModelGateway) Complete(ctx context.Context, req ModelRequest) (ModelResponse, error)
type OpenAIModelGatewayConfig ¶
type OpenAIModelGatewayConfig struct {
APIKey string
RequireAPIKey bool
BaseURL string
DefaultModel string
Timeout time.Duration
HTTPClient *http.Client
}
OpenAIModelGatewayConfig defines OpenAI-compatible model gateway settings.
func DefaultOpenAIModelGatewayConfig ¶
func DefaultOpenAIModelGatewayConfig() OpenAIModelGatewayConfig
DefaultOpenAIModelGatewayConfig returns OpenAI gateway defaults.
type OrlojTaskStore ¶ added in v0.6.0
type OrlojTaskStore interface {
Get(ctx context.Context, name string) (resources.Task, bool, error)
Upsert(ctx context.Context, item resources.Task) (resources.Task, error)
ListPaged(ctx context.Context, limit, offset int, namespace string) ([]resources.Task, error)
}
OrlojTaskStore is the subset of store.TaskStore used by OrlojToolRuntime.
type OrlojToolConfig ¶ added in v0.6.0
type OrlojToolConfig struct {
ParentNamespace string
ParentTaskName string
CurrentDepth int
MaxDepth int
MaxChildren int
}
OrlojToolConfig holds policy-derived limits for the orloj tool runtime.
type OrlojToolRuntime ¶ added in v0.6.0
type OrlojToolRuntime struct {
// contains filtered or unexported fields
}
OrlojToolRuntime wraps a ToolRuntime and intercepts built-in orloj tool calls.
func NewOrlojToolRuntime ¶ added in v0.6.0
func NewOrlojToolRuntime(delegate ToolRuntime, taskStore OrlojTaskStore, config OrlojToolConfig) *OrlojToolRuntime
type PersistentMemoryBackend ¶
type PersistentMemoryBackend interface {
Put(ctx context.Context, key, value string) error
Get(ctx context.Context, key string) (string, bool, error)
Search(ctx context.Context, query string, topK int) ([]MemorySearchResult, error)
List(ctx context.Context, prefix string) ([]MemorySearchResult, error)
Ping(ctx context.Context) error
}
PersistentMemoryBackend defines the interface for durable memory stores that persist across task runs. Implementations are selected based on the Memory CRD's spec.type and spec.provider fields.
func NewPersistentMemoryBackendFromConfig ¶
func NewPersistentMemoryBackendFromConfig(memType, provider, embeddingModel string) (PersistentMemoryBackend, error)
NewPersistentMemoryBackendFromConfig creates a backend using the global provider registry. This is the primary entry point used by the controller.
type PersistentMemoryBackendRegistry ¶
type PersistentMemoryBackendRegistry struct {
// contains filtered or unexported fields
}
PersistentMemoryBackendRegistry manages named persistent backends keyed by Memory CRD name.
func NewPersistentMemoryBackendRegistry ¶
func NewPersistentMemoryBackendRegistry() *PersistentMemoryBackendRegistry
func (*PersistentMemoryBackendRegistry) Get ¶
func (r *PersistentMemoryBackendRegistry) Get(name string) (PersistentMemoryBackend, bool)
func (*PersistentMemoryBackendRegistry) Register ¶
func (r *PersistentMemoryBackendRegistry) Register(name string, backend PersistentMemoryBackend)
type PgvectorBackend ¶
type PgvectorBackend struct {
// contains filtered or unexported fields
}
PgvectorBackend implements PersistentMemoryBackend using PostgreSQL with the pgvector extension. Entries are stored with their vector embeddings, enabling cosine-similarity search.
func NewPgvectorBackend ¶
func NewPgvectorBackend(dsn string, embedder EmbeddingProvider, opts PgvectorOptions) (*PgvectorBackend, error)
NewPgvectorBackend connects to the database, detects the embedding dimension (if not overridden), installs the vector extension, and creates the table with an HNSW index.
func (*PgvectorBackend) List ¶
func (b *PgvectorBackend) List(ctx context.Context, prefix string) ([]MemorySearchResult, error)
func (*PgvectorBackend) Put ¶
func (b *PgvectorBackend) Put(ctx context.Context, key, value string) error
func (*PgvectorBackend) Search ¶
func (b *PgvectorBackend) Search(ctx context.Context, queryText string, topK int) ([]MemorySearchResult, error)
type PgvectorOptions ¶
type PgvectorOptions struct {
Table string // table name, default "orloj_memory"
Dimension int // vector dimension override; auto-detected when 0
}
PgvectorOptions configures optional behaviour of the pgvector backend.
type ReActExecutionEngine ¶
type ReActExecutionEngine struct {
OnStepEvent func(AgentStepEvent)
// contains filtered or unexported fields
}
ReActExecutionEngine is the default runtime engine: model call + optional tool actions in bounded steps.
func NewReActExecutionEngine ¶
func NewReActExecutionEngine( toolRuntime ToolRuntime, modelGateway ModelGateway, newMemoryStore func() MemoryStore, stepEvery time.Duration, ) *ReActExecutionEngine
type RegistryAuthResolver ¶ added in v0.10.2
type RegistryAuthResolver func(ctx context.Context, resolver SecretResolver, secretRef string) (*registryCredentials, error)
RegistryAuthResolver is an optional hook for resolving image pull secrets into temporary Docker config directories. When nil, the manager resolves secrets using its own secretResolver.
type RetryRequestError ¶
RetryRequestError instructs the message bus consumer to requeue after a delay.
func (*RetryRequestError) Error ¶
func (e *RetryRequestError) Error() string
func (*RetryRequestError) Unwrap ¶
func (e *RetryRequestError) Unwrap() error
type ReviewRequestPayload ¶ added in v0.10.0
type ReviewRequestPayload struct {
Content string `json:"content,omitempty"`
Feedback string `json:"feedback,omitempty"`
PreviousOutput string `json:"previous_output,omitempty"`
CheckpointID string `json:"checkpoint_id,omitempty"`
Cycle int `json:"cycle,omitempty"`
RequestedBy string `json:"requested_by,omitempty"`
Supersedes string `json:"supersedes,omitempty"`
}
func DecodeReviewRequestPayload ¶ added in v0.10.0
func DecodeReviewRequestPayload(raw string) (ReviewRequestPayload, bool)
type SecretResolver ¶
SecretResolver resolves tool auth secret references.
type SecretResourceLookup ¶
type SharedMemoryStore ¶
type SharedMemoryStore struct {
// contains filtered or unexported fields
}
SharedMemoryStore is a thread-safe key-value store shared across agents in a task.
func NewSharedMemoryStore ¶
func NewSharedMemoryStore() *SharedMemoryStore
func (*SharedMemoryStore) List ¶
func (s *SharedMemoryStore) List(prefix string) []memoryEntry
func (*SharedMemoryStore) Put ¶
func (s *SharedMemoryStore) Put(key, value string)
func (*SharedMemoryStore) Search ¶
func (s *SharedMemoryStore) Search(query string, topK int) []memoryEntry
func (*SharedMemoryStore) Snapshot ¶
func (s *SharedMemoryStore) Snapshot() map[string]string
type StaticToolCapabilityRegistry ¶
type StaticToolCapabilityRegistry struct {
// contains filtered or unexported fields
}
StaticToolCapabilityRegistry stores tool policies in-memory for runtime checks.
func NewStaticToolCapabilityRegistry ¶
func NewStaticToolCapabilityRegistry(specs map[string]resources.ToolSpec) *StaticToolCapabilityRegistry
func NewToolCapabilityRegistryFromTools ¶
func NewToolCapabilityRegistryFromTools(tools []resources.Tool) *StaticToolCapabilityRegistry
type StdioMcpTransport ¶
type StdioMcpTransport struct {
// contains filtered or unexported fields
}
StdioMcpTransport communicates with an MCP server via a child process's stdin/stdout using newline-delimited JSON-RPC 2.0 messages.
func NewStdioMcpTransport ¶
func NewStdioMcpTransport(cfg StdioMcpTransportConfig) *StdioMcpTransport
func (*StdioMcpTransport) CallTool ¶
func (t *StdioMcpTransport) CallTool(ctx context.Context, name string, arguments map[string]any) (*McpToolResult, error)
func (*StdioMcpTransport) Close ¶
func (t *StdioMcpTransport) Close() error
func (*StdioMcpTransport) Initialize ¶
func (t *StdioMcpTransport) Initialize(ctx context.Context) (*McpInitResult, error)
func (*StdioMcpTransport) ListTools ¶
func (t *StdioMcpTransport) ListTools(ctx context.Context) ([]McpToolDefinition, error)
type StdioMcpTransportConfig ¶
type StdioMcpTransportConfig struct {
Command string
Args []string
Env []string
OnClose func() // optional callback invoked after the process is killed
}
StdioMcpTransportConfig configures the child process to spawn.
type StoreSecretResolver ¶
type StoreSecretResolver struct {
// contains filtered or unexported fields
}
func NewStoreSecretResolver ¶
func NewStoreSecretResolver(lookup SecretResourceLookup, defaultKey string) *StoreSecretResolver
func (*StoreSecretResolver) WithNamespace ¶
func (r *StoreSecretResolver) WithNamespace(namespace string) SecretResolver
type StreamableHTTPMcpTransport ¶
type StreamableHTTPMcpTransport struct {
// contains filtered or unexported fields
}
StreamableHTTPMcpTransport communicates with an MCP server over HTTP using the Streamable HTTP transport (JSON-RPC 2.0 over POST).
func NewStreamableHTTPMcpTransport ¶
func NewStreamableHTTPMcpTransport(cfg StreamableHTTPMcpTransportConfig) *StreamableHTTPMcpTransport
func (*StreamableHTTPMcpTransport) CallTool ¶
func (t *StreamableHTTPMcpTransport) CallTool(ctx context.Context, name string, arguments map[string]any) (*McpToolResult, error)
func (*StreamableHTTPMcpTransport) Close ¶
func (t *StreamableHTTPMcpTransport) Close() error
func (*StreamableHTTPMcpTransport) Initialize ¶
func (t *StreamableHTTPMcpTransport) Initialize(ctx context.Context) (*McpInitResult, error)
func (*StreamableHTTPMcpTransport) ListTools ¶
func (t *StreamableHTTPMcpTransport) ListTools(ctx context.Context) ([]McpToolDefinition, error)
type StreamableHTTPMcpTransportConfig ¶
type StreamableHTTPMcpTransportConfig struct {
Endpoint string
Headers map[string]string
Client HTTPDoer
AllowPrivate bool // permit connections to private/internal IPs
}
StreamableHTTPMcpTransportConfig configures the HTTP transport.
type TaskApprovalUpserter ¶ added in v0.10.0
type TaskApprovalUpserter interface {
Upsert(ctx context.Context, item resources.TaskApproval) (resources.TaskApproval, error)
Get(ctx context.Context, key string) (resources.TaskApproval, bool, error)
}
type TaskExecutor ¶
type TaskExecutor struct {
OnStepEvent func(AgentStepEvent)
// contains filtered or unexported fields
}
TaskExecutor runs agents on-demand for Task execution.
func NewTaskExecutor ¶
func NewTaskExecutor(logger *log.Logger) *TaskExecutor
func NewTaskExecutorWithRuntime ¶
func NewTaskExecutorWithRuntime( logger *log.Logger, toolRuntime ToolRuntime, modelGateway ModelGateway, newMemoryStore func() MemoryStore, ) *TaskExecutor
func (*TaskExecutor) ExecuteAgent ¶
func (e *TaskExecutor) ExecuteAgent(ctx context.Context, agent resources.Agent, input map[string]string) (AgentExecutionResult, error)
func (*TaskExecutor) ExecuteAgentWithRuntime ¶
func (e *TaskExecutor) ExecuteAgentWithRuntime( ctx context.Context, agent resources.Agent, input map[string]string, override ToolRuntime, ) (AgentExecutionResult, error)
type TaskStateStore ¶
type TaskStateStore interface {
Get(ctx context.Context, name string) (resources.Task, bool, error)
Upsert(ctx context.Context, item resources.Task) (resources.Task, error)
AppendLog(ctx context.Context, name, message string) error
}
TaskStateStore stores task status updates produced by message consumers.
type ToolApprovalRequiredError ¶ added in v0.13.0
ToolApprovalRequiredError is a structured error carrying the tool name, input arguments, and policy reason when approval is required.
func (*ToolApprovalRequiredError) Error ¶ added in v0.13.0
func (e *ToolApprovalRequiredError) Error() string
func (*ToolApprovalRequiredError) Unwrap ¶ added in v0.13.0
func (e *ToolApprovalRequiredError) Unwrap() error
type ToolApprovalUpserter ¶
type ToolApprovalUpserter interface {
Upsert(ctx context.Context, item resources.ToolApproval) (resources.ToolApproval, error)
Get(ctx context.Context, key string) (resources.ToolApproval, bool, error)
}
ToolApprovalUpserter persists ToolApproval resources when a governed tool requires approval.
type ToolBackedContextAdapter ¶ added in v0.12.0
type ToolBackedContextAdapter struct {
// contains filtered or unexported fields
}
ToolBackedContextAdapter runs a sanitization Tool against raw task input.
func NewToolBackedContextAdapter ¶ added in v0.12.0
func NewToolBackedContextAdapter( spec resources.ContextAdapterSpec, toolRuntime ToolRuntime, ) *ToolBackedContextAdapter
NewToolBackedContextAdapter builds a hook backed by ToolRuntime.Call(spec.ToolRef, JSON payload).
func (*ToolBackedContextAdapter) AdaptContext ¶ added in v0.12.0
func (c *ToolBackedContextAdapter) AdaptContext(ctx context.Context, input map[string]string) (map[string]string, error)
AdaptContext JSON-encodes input, calls the tool, and decodes the JSON output.
type ToolCallAuthorizer ¶
type ToolCallAuthorizer interface {
Authorize(tool string, spec resources.ToolSpec) (*AuthorizeResult, error)
}
func NewAuthorizerWithApprovedToolGrant ¶
func NewAuthorizerWithApprovedToolGrant(inner ToolCallAuthorizer, getter func(key string) (resources.ToolApproval, bool, error), taskKey, messageID string) ToolCallAuthorizer
NewAuthorizerWithApprovedToolGrant wraps inner (typically AgentToolAuthorizer). When inner requires approval, it allows the call if the ToolApproval row for (taskKey, messageID) is Approved and its spec.tool matches the requested tool.
type ToolCapabilityRegistry ¶
ToolCapabilityRegistry resolves runtime policy/capability metadata for tools.
type ToolContractExecutor ¶
type ToolContractExecutor interface {
Execute(ctx context.Context, req ToolExecutionRequest) (ToolExecutionResponse, error)
}
ToolContractExecutor executes tools against the v1 tool request/response contract.
func NewToolContractExecutor ¶
func NewToolContractExecutor(runtime ToolRuntime) ToolContractExecutor
type ToolError ¶
type ToolError struct {
Status string
Code string
Reason string
Retryable bool
Message string
Details map[string]string
Cause error
}
ToolError is the canonical runtime tool error envelope. It is serialized into deterministic message text so controllers/UI can parse stable fields.
func AsToolError ¶
type ToolExecutionAuth ¶
type ToolExecutionFailure ¶
type ToolExecutionOutput ¶
type ToolExecutionOutput struct {
Result string `json:"result,omitempty"`
}
type ToolExecutionRequest ¶
type ToolExecutionRequest struct {
ToolContractVersion string `json:"tool_contract_version,omitempty"`
RequestID string `json:"request_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
Namespace string `json:"namespace,omitempty"`
Agent string `json:"agent,omitempty"`
Tool ToolExecutionRequestTool `json:"tool,omitempty"`
Input map[string]string `json:"input,omitempty"`
InputRaw string `json:"input_raw,omitempty"`
Runtime ToolExecutionRuntime `json:"runtime,omitempty"`
Auth ToolExecutionAuth `json:"auth,omitempty"`
Trace ToolExecutionTraceContext `json:"trace,omitempty"`
Attempt int `json:"attempt,omitempty"`
}
ToolExecutionRequest is the strict runtime contract envelope for one tool call.
func NormalizeToolExecutionRequest ¶
func NormalizeToolExecutionRequest(req ToolExecutionRequest) (ToolExecutionRequest, error)
func (ToolExecutionRequest) EncodedInput ¶
func (r ToolExecutionRequest) EncodedInput() (string, error)
type ToolExecutionResponse ¶
type ToolExecutionResponse struct {
ToolContractVersion string `json:"tool_contract_version,omitempty"`
RequestID string `json:"request_id,omitempty"`
Status string `json:"status,omitempty"`
Output ToolExecutionOutput `json:"output,omitempty"`
Usage ToolExecutionUsage `json:"usage,omitempty"`
Trace ToolExecutionTraceContext `json:"trace,omitempty"`
Error *ToolExecutionFailure `json:"error,omitempty"`
}
func ExecuteToolContract ¶
func ExecuteToolContract(ctx context.Context, runtime ToolRuntime, req ToolExecutionRequest) (ToolExecutionResponse, error)
func (ToolExecutionResponse) ToError ¶
func (r ToolExecutionResponse) ToError() error
type ToolExecutionRuntime ¶
type ToolExecutionUsage ¶
type ToolIsolationBackendFactory ¶
type ToolIsolationBackendFactory func(options ToolIsolationBackendOptions) (ToolRuntime, error)
type ToolIsolationBackendOptions ¶
type ToolIsolationBackendOptions struct {
Mode string
ContainerConfig ContainerToolRuntimeConfig
SecretResolver SecretResolver
WASMConfig WASMToolRuntimeConfig
WASMExecutorFactory WASMToolExecutorFactory
McpSessionManager *McpSessionManager
McpServerStore McpServerLookup
KubernetesConfig KubernetesToolConfig
}
type ToolIsolationBackendRegistry ¶
type ToolIsolationBackendRegistry struct {
// contains filtered or unexported fields
}
ToolIsolationBackendRegistry resolves isolated runtime backends by mode. New backends can be registered without editing core switch logic.
func DefaultToolIsolationBackendRegistry ¶
func DefaultToolIsolationBackendRegistry() *ToolIsolationBackendRegistry
func NewToolIsolationBackendRegistry ¶
func NewToolIsolationBackendRegistry() *ToolIsolationBackendRegistry
func (*ToolIsolationBackendRegistry) Build ¶
func (r *ToolIsolationBackendRegistry) Build(options ToolIsolationBackendOptions) (ToolRuntime, error)
func (*ToolIsolationBackendRegistry) Modes ¶
func (r *ToolIsolationBackendRegistry) Modes() []string
func (*ToolIsolationBackendRegistry) Register ¶
func (r *ToolIsolationBackendRegistry) Register(mode string, factory ToolIsolationBackendFactory) error
type ToolPermissionLookup ¶
type ToolPermissionLookup interface {
List(ctx context.Context) ([]resources.ToolPermission, error)
}
type ToolResourceLookup ¶
type ToolResourceLookup interface {
Get(ctx context.Context, name string) (resources.Tool, bool, error)
}
ToolResourceLookup resolves Tool CRDs by name (optionally namespace scoped).
type ToolRuntime ¶
ToolRuntime executes external tool calls for agents.
func BuildGovernedToolRuntimeForAgent ¶
func BuildGovernedToolRuntimeForAgent( ctx context.Context, baseRuntime ToolRuntime, isolatedRuntime ToolRuntime, lookup ToolResourceLookup, namespace string, toolNames []string, ) ToolRuntime
BuildGovernedToolRuntimeForAgent resolves tool policies for one agent in a namespace. Missing registry entries are treated as unsupported at call time when strict mode is enabled.
func BuildGovernedToolRuntimeForAgentWithGovernance ¶
func BuildGovernedToolRuntimeForAgentWithGovernance( ctx context.Context, baseRuntime ToolRuntime, isolatedRuntime ToolRuntime, toolLookup ToolResourceLookup, roleLookup AgentRoleLookup, permissionLookup ToolPermissionLookup, namespace string, agent resources.Agent, approvalCtx *GovernedToolApprovalContext, ) ToolRuntime
func BuildSanitizerToolRuntime ¶ added in v0.12.0
func BuildSanitizerToolRuntime( ctx context.Context, namespace string, toolRef string, tools ToolResourceLookup, isolated ToolRuntime, wasmRT ToolRuntime, secretResolver SecretResolver, cliConfig CLIToolRuntimeConfig, mcpMgr *McpSessionManager, mcpStore McpServerLookup, ) (ToolRuntime, error)
BuildSanitizerToolRuntime constructs a governed tool runtime wired like agent execution, scoped to exactly one Tool name (used for ContextAdapter sanitization tools).
func BuildToolIsolationRuntime ¶
func BuildToolIsolationRuntime(options ToolIsolationBackendOptions) (ToolRuntime, error)
type ToolSchemaInfo ¶
ToolSchemaInfo carries optional description and JSON Schema for a tool. When present, model gateways use these instead of the generic fallback.
type ToolSchemaResolver ¶
type ToolSchemaResolver interface {
ResolveToolSchemas(toolNames []string) map[string]ToolSchemaInfo
}
ToolSchemaResolver resolves rich tool schemas for model gateway formatting. Implementations that wrap tool registries (e.g. GovernedToolRuntime) can provide per-tool descriptions and JSON Schemas to the LLM.
type UnsupportedIsolatedToolRuntime ¶
type UnsupportedIsolatedToolRuntime struct{}
UnsupportedIsolatedToolRuntime fails closed when isolation is required but no sandbox executor is wired.
type WASMModuleResolver ¶ added in v0.11.0
type WASMModuleResolver struct {
// contains filtered or unexported fields
}
WASMModuleResolver resolves a module reference (local path, HTTPS URL, or OCI artifact reference) to a local filesystem path. Remote modules are cached on disk keyed by SHA-256 of the reference string.
func NewWASMModuleResolver ¶ added in v0.11.0
func NewWASMModuleResolver(cfg WASMModuleResolverConfig) (*WASMModuleResolver, error)
NewWASMModuleResolver creates a resolver that can fetch WASM modules from local paths, HTTPS URLs, or OCI registries.
func (*WASMModuleResolver) Resolve ¶ added in v0.11.0
func (r *WASMModuleResolver) Resolve(ctx context.Context, moduleRef string, imagePullSecret string) (string, error)
Resolve returns a local filesystem path for the given module reference. For local paths it returns as-is; for HTTPS URLs and OCI refs it fetches and caches the module on disk.
func (*WASMModuleResolver) SourceLabel ¶ added in v0.11.0
func (r *WASMModuleResolver) SourceLabel(moduleRef string) string
SourceLabel returns a label suitable for metrics/logging.
type WASMModuleResolverConfig ¶ added in v0.11.0
type WASMModuleResolverConfig struct {
CacheDir string
AllowPrivate bool
SecretResolver SecretResolver
OCIPuller OCIArtifactPuller
}
WASMModuleResolverConfig holds configuration for the module resolver.
type WASMToolExecuteRequest ¶
type WASMToolExecuteRequest struct {
Namespace string
Tool string
Input string
Capabilities []string
RiskLevel string
Runtime WASMToolRuntimeConfig
AuthProfile string
AuthHeaders map[string]string
ImagePullSecret string
}
WASMToolExecuteRequest is the portable execution envelope used by wasm executors.
type WASMToolExecuteResponse ¶
type WASMToolExecuteResponse struct {
Output string
}
type WASMToolExecutor ¶
type WASMToolExecutor interface {
Execute(ctx context.Context, req WASMToolExecuteRequest) (WASMToolExecuteResponse, error)
}
WASMToolExecutor is a pluggable wasm execution adapter.
type WASMToolExecutorFactory ¶
type WASMToolExecutorFactory interface {
Build(ctx context.Context, cfg WASMToolRuntimeConfig) (WASMToolExecutor, error)
}
WASMToolExecutorFactory creates wasm executors from runtime config.
type WASMToolModuleReqAuth ¶
type WASMToolModuleRequest ¶
type WASMToolModuleRequest struct {
ContractVersion string `json:"contract_version,omitempty"`
Namespace string `json:"namespace,omitempty"`
Tool string `json:"tool,omitempty"`
Input string `json:"input,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
RiskLevel string `json:"risk_level,omitempty"`
Runtime WASMToolModuleReqRuntime `json:"runtime,omitempty"`
Auth WASMToolModuleReqAuth `json:"auth,omitempty"`
}
func BuildWASMToolModuleRequest ¶
func BuildWASMToolModuleRequest(req WASMToolExecuteRequest) WASMToolModuleRequest
type WASMToolModuleResponse ¶
type WASMToolModuleResponse struct {
ContractVersion string `json:"contract_version,omitempty"`
Status string `json:"status,omitempty"`
Output string `json:"output,omitempty"`
Error *ToolExecutionFailure `json:"error,omitempty"`
}
func DecodeWASMToolModuleResponse ¶
func DecodeWASMToolModuleResponse(raw string) (WASMToolModuleResponse, error)
type WASMToolRuntime ¶
type WASMToolRuntime struct {
// contains filtered or unexported fields
}
WASMToolRuntime is a scaffold runtime for wasm-backed tool execution.
func NewWASMToolRuntime ¶
func NewWASMToolRuntime(registry ToolCapabilityRegistry, executor WASMToolExecutor) *WASMToolRuntime
func NewWASMToolRuntimeWithFactory ¶
func NewWASMToolRuntimeWithFactory( registry ToolCapabilityRegistry, factory WASMToolExecutorFactory, config WASMToolRuntimeConfig, ) *WASMToolRuntime
func (*WASMToolRuntime) WithConfig ¶
func (r *WASMToolRuntime) WithConfig(config WASMToolRuntimeConfig) *WASMToolRuntime
func (*WASMToolRuntime) WithNamespace ¶
func (r *WASMToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*WASMToolRuntime) WithRegistry ¶
func (r *WASMToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
type WASMToolRuntimeConfig ¶
type WASMToolRuntimeConfig struct {
ModulePath string
Entrypoint string
MaxMemoryBytes int64
Fuel uint64
EnableWASI bool
}
func DefaultWASMToolRuntimeConfig ¶
func DefaultWASMToolRuntimeConfig() WASMToolRuntimeConfig
type WazeroExecutor ¶ added in v0.11.0
type WazeroExecutor struct {
// contains filtered or unexported fields
}
WazeroExecutor runs WASM tool modules in-process using the wazero runtime. Compiled modules are cached by module reference to avoid redundant compilation.
func NewWazeroExecutor ¶ added in v0.11.0
func NewWazeroExecutor(engine wazero.Runtime) *WazeroExecutor
NewWazeroExecutor wraps an existing wazero.Runtime with a compilation cache.
func (*WazeroExecutor) Close ¶ added in v0.11.0
func (e *WazeroExecutor) Close(ctx context.Context) error
Close releases all cached compiled modules and the underlying engine.
func (*WazeroExecutor) Execute ¶ added in v0.11.0
func (e *WazeroExecutor) Execute(ctx context.Context, req WASMToolExecuteRequest) (WASMToolExecuteResponse, error)
Execute runs a WASM tool module and returns its output via the stdin/stdout JSON contract.
func (*WazeroExecutor) SetModuleResolver ¶ added in v0.11.0
func (e *WazeroExecutor) SetModuleResolver(resolver *WASMModuleResolver)
SetModuleResolver attaches a module resolver for remote (HTTPS/OCI) modules.
type WazeroExecutorFactory ¶ added in v0.11.0
type WazeroExecutorFactory struct {
// contains filtered or unexported fields
}
WazeroExecutorFactory builds WazeroExecutor instances backed by a shared wazero.Runtime engine.
func NewWazeroExecutorFactory ¶ added in v0.11.0
func NewWazeroExecutorFactory(engine wazero.Runtime) *WazeroExecutorFactory
NewWazeroExecutorFactory creates a factory that produces executors sharing a single wazero.Runtime.
func NewWazeroExecutorFactoryWithResolver ¶ added in v0.11.0
func NewWazeroExecutorFactoryWithResolver(engine wazero.Runtime, resolver *WASMModuleResolver) *WazeroExecutorFactory
NewWazeroExecutorFactoryWithResolver creates a factory with an attached module resolver for remote (HTTPS/OCI) WASM modules.
func (*WazeroExecutorFactory) Build ¶ added in v0.11.0
func (f *WazeroExecutorFactory) Build(_ context.Context, _ WASMToolRuntimeConfig) (WASMToolExecutor, error)
Build returns the shared WazeroExecutor (module path is per-request, not per-build).
type WebhookCallbackToolRuntime ¶
type WebhookCallbackToolRuntime struct {
// contains filtered or unexported fields
}
WebhookCallbackToolRuntime implements an async tool pattern: fire a ToolExecutionRequest to the tool endpoint, then poll a callback URL (or the same endpoint with the request ID) until a ToolExecutionResponse arrives or the context times out.
Flow:
- POST ToolExecutionRequest to Tool.spec.endpoint
- Receive 202 Accepted (or 200 with immediate result)
- If 202: poll GET {endpoint}/{request_id} until status != "pending"
func NewWebhookCallbackToolRuntime ¶
func NewWebhookCallbackToolRuntime(registry ToolCapabilityRegistry, secrets SecretResolver, client HTTPDoer, pollInterval time.Duration) *WebhookCallbackToolRuntime
func (*WebhookCallbackToolRuntime) DeliverCallback ¶
func (r *WebhookCallbackToolRuntime) DeliverCallback(requestID string, resp ToolExecutionResponse) bool
DeliverCallback allows external code to push an async response for a pending request.
func (*WebhookCallbackToolRuntime) SetAllowPrivateEndpoints ¶ added in v0.8.0
func (r *WebhookCallbackToolRuntime) SetAllowPrivateEndpoints(allow bool)
SetAllowPrivateEndpoints permits webhook callbacks and polling against private / internal IP ranges. Loopback, link-local, cloud metadata, and unspecified addresses remain blocked.
func (*WebhookCallbackToolRuntime) WithNamespace ¶
func (r *WebhookCallbackToolRuntime) WithNamespace(namespace string) ToolRuntime
func (*WebhookCallbackToolRuntime) WithRegistry ¶
func (r *WebhookCallbackToolRuntime) WithRegistry(registry ToolCapabilityRegistry) ToolRuntime
Source Files
¶
- agent_message_bus.go
- agent_message_bus_memory.go
- agent_message_bus_nats.go
- agent_message_consumer.go
- agent_runtime_kubernetes.go
- agent_worker.go
- bounded_writer.go
- builtin_tool_schemas.go
- builtin_tool_schemas_orloj.go
- builtin_tools_memory.go
- builtin_tools_orloj.go
- container_registry_auth.go
- context_adapter.go
- context_adapter_wire.go
- contracts.go
- embedding.go
- eval_scorer.go
- execution_engine.go
- extensions.go
- mcp_jsonrpc.go
- mcp_session.go
- mcp_transport.go
- mcp_transport_http.go
- mcp_transport_stdio.go
- memory_chunker.go
- memory_manager.go
- model_gateway.go
- model_gateway_anthropic.go
- model_gateway_azure_openai.go
- model_gateway_bedrock.go
- model_gateway_error.go
- model_gateway_factory.go
- model_gateway_ollama.go
- model_gateway_openai.go
- model_gateway_router.go
- model_gateway_tools.go
- model_provider_registry.go
- model_tool_calls.go
- persistent_memory.go
- persistent_memory_http.go
- persistent_memory_pgvector.go
- policy_enforcement.go
- redact.go
- safenet.go
- secret_resolver_kubernetes.go
- task_approval_resume.go
- task_executor.go
- tool_approval_grant_authorizer.go
- tool_approval_message_key.go
- tool_auth_injector.go
- tool_auth_oauth2.go
- tool_authorizer.go
- tool_cli_args.go
- tool_client.go
- tool_contract.go
- tool_error.go
- tool_isolation_backend_registry.go
- tool_runtime_cli.go
- tool_runtime_container.go
- tool_runtime_external.go
- tool_runtime_governed.go
- tool_runtime_grpc.go
- tool_runtime_http.go
- tool_runtime_kubernetes.go
- tool_runtime_mcp.go
- tool_runtime_wasm_contract.go
- tool_runtime_wasm_runtime.go
- tool_runtime_wasm_wazero.go
- tool_runtime_webhook_callback.go
- tool_secret_resolver.go
- wasm_module_resolver.go