Documentation
¶
Index ¶
- func BuildAPIKeyHandler(db *gorm.DB, logger *zap.Logger) *handlers.APIKeyHandler
- func BuildAgentCheckpointStore(cfg *config.Config, db *gorm.DB, logger *zap.Logger) (agent.CheckpointStore, error)
- func BuildAgentHandler(discoveryRegistry discovery.Registry, agentRegistry *agent.AgentRegistry, ...) *handlers.AgentHandler
- func BuildAgentRegistries(logger *zap.Logger) (*discovery.CapabilityRegistry, *agent.AgentRegistry)
- func BuildAuthMiddleware(serverCfg config.ServerConfig, skipPaths []string, logger *zap.Logger) (mw.Middleware, error)
- func BuildHTTPServerConfig(serverCfg config.ServerConfig) server.Config
- func BuildMetricsServerConfig(serverCfg config.ServerConfig) server.Config
- func BuildMongoClient(cfg config.MongoDBConfig, logger *zap.Logger) (*mongoclient.Client, error)
- func BuildMultimodalRedisReferenceStore(cfg *config.Config, keyPrefix string, ttl time.Duration, logger *zap.Logger) (*redis.Client, storage.ReferenceStore, error)
- func BuildToolApprovalHandler(manager *hitl.InterruptManager, workflowID string, config ToolApprovalConfig, ...) *handlers.ToolApprovalHandler
- func BuildToolProviderHandler(db *gorm.DB, runtime handlers.ToolRegistryRuntime, logger *zap.Logger) *handlers.ToolProviderHandler
- func BuildToolRegistryHandler(db *gorm.DB, runtime handlers.ToolRegistryRuntime, logger *zap.Logger) *handlers.ToolRegistryHandler
- func BuildWorkflowPostgreSQLCheckpointStore(ctx context.Context, db *gorm.DB) (workflow.CheckpointStore, error)
- func IsLoopbackHost(host string) bool
- func LoadAndValidateConfig(configPath string) (*config.Config, error)
- func NewLogger(cfg config.LogConfig) *zap.Logger
- func OpenDatabase(dbCfg config.DatabaseConfig, logger *zap.Logger) (*gorm.DB, error)
- func RegisterDefaultRuntimeAgentFactory(agentRegistry *agent.AgentRegistry, provider llm.Provider, ...)
- func RegisterHTTPRoutes(mux *http.ServeMux, handlers HTTPRouteHandlers, version string, ...)
- func RegisterHotReloadCallbacks(manager *config.HotReloadManager, logger *zap.Logger, ...)
- func ToolApprovalWorkflowID() string
- func ValidateMultimodalReferenceBackend(cfg *config.Config) (string, error)
- type AgentToolingOptions
- type AgentToolingRuntime
- type CapabilityAgentType
- type CapabilityCatalog
- type CapabilityMode
- type CapabilityTool
- type HTTPMiddlewares
- type HTTPRouteHandlers
- type HotReloadRuntime
- type LLMHandlerRuntime
- type MongoRuntimeWiring
- type MultimodalRuntime
- type ProtocolRuntime
- type RAGHandlerRuntime
- type ServeRuntime
- type ToolApprovalConfig
- type ToolApprovalGrant
- type ToolApprovalGrantStore
- func BuildToolApprovalGrantStore(cfg *config.Config, logger *zap.Logger) (*redis.Client, ToolApprovalGrantStore, error)
- func NewFileToolApprovalGrantStore(path string, logger *zap.Logger) ToolApprovalGrantStore
- func NewMemoryToolApprovalGrantStore() ToolApprovalGrantStore
- func NewRedisToolApprovalGrantStore(client *redis.Client, keyPrefix string, logger *zap.Logger) ToolApprovalGrantStore
- type ToolApprovalHistoryEntry
- type ToolApprovalHistoryStore
- func BuildToolApprovalHistoryStore(cfg *config.Config, redisClient *redis.Client) (ToolApprovalHistoryStore, error)
- func NewFileToolApprovalHistoryStore(path string, maxSize int) ToolApprovalHistoryStore
- func NewMemoryToolApprovalHistoryStore(maxSize int) ToolApprovalHistoryStore
- func NewRedisToolApprovalHistoryStore(client *redis.Client, keyPrefix string, maxSize int) ToolApprovalHistoryStore
- type WorkflowAgentResolver
- type WorkflowRuntime
- type WorkflowRuntimeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAPIKeyHandler ¶
BuildAPIKeyHandler creates API key handler when DB is available; otherwise returns nil.
func BuildAgentCheckpointStore ¶
func BuildAgentCheckpointStore(cfg *config.Config, db *gorm.DB, logger *zap.Logger) (agent.CheckpointStore, error)
BuildAgentCheckpointStore builds a single checkpoint store backend from config.
func BuildAgentHandler ¶
func BuildAgentHandler( discoveryRegistry discovery.Registry, agentRegistry *agent.AgentRegistry, logger *zap.Logger, resolver ...usecase.AgentResolver, ) *handlers.AgentHandler
BuildAgentHandler creates agent handler with optional resolver.
func BuildAgentRegistries ¶
func BuildAgentRegistries(logger *zap.Logger) (*discovery.CapabilityRegistry, *agent.AgentRegistry)
BuildAgentRegistries creates discovery and agent registries for runtime handlers.
func BuildAuthMiddleware ¶
func BuildAuthMiddleware(serverCfg config.ServerConfig, skipPaths []string, logger *zap.Logger) (mw.Middleware, error)
BuildAuthMiddleware selects and creates the HTTP auth middleware. Priority: JWT (if secret or public key configured) > API Key > fail-closed.
func BuildHTTPServerConfig ¶
func BuildHTTPServerConfig(serverCfg config.ServerConfig) server.Config
BuildHTTPServerConfig creates the HTTP server manager configuration.
func BuildMetricsServerConfig ¶
func BuildMetricsServerConfig(serverCfg config.ServerConfig) server.Config
BuildMetricsServerConfig creates the metrics server manager configuration.
func BuildMongoClient ¶
func BuildMongoClient(cfg config.MongoDBConfig, logger *zap.Logger) (*mongoclient.Client, error)
BuildMongoClient creates the MongoDB client used by runtime wiring.
func BuildMultimodalRedisReferenceStore ¶
func BuildMultimodalRedisReferenceStore( cfg *config.Config, keyPrefix string, ttl time.Duration, logger *zap.Logger, ) (*redis.Client, storage.ReferenceStore, error)
BuildMultimodalRedisReferenceStore creates the redis client and reference store for multimodal runtime.
func BuildToolApprovalHandler ¶ added in v1.9.0
func BuildToolApprovalHandler( manager *hitl.InterruptManager, workflowID string, config ToolApprovalConfig, logger *zap.Logger, ) *handlers.ToolApprovalHandler
BuildToolApprovalHandler creates the tool approval handler when runtime is available.
func BuildToolProviderHandler ¶ added in v1.5.0
func BuildToolProviderHandler( db *gorm.DB, runtime handlers.ToolRegistryRuntime, logger *zap.Logger, ) *handlers.ToolProviderHandler
BuildToolProviderHandler creates DB-backed tool provider config handler when runtime is available.
func BuildToolRegistryHandler ¶
func BuildToolRegistryHandler( db *gorm.DB, runtime handlers.ToolRegistryRuntime, logger *zap.Logger, ) *handlers.ToolRegistryHandler
BuildToolRegistryHandler creates DB-backed tool registration handler when runtime is available.
func BuildWorkflowPostgreSQLCheckpointStore ¶ added in v1.6.0
func IsLoopbackHost ¶
IsLoopbackHost reports whether host resolves to loopback host/ip form.
func LoadAndValidateConfig ¶
LoadAndValidateConfig loads application config from defaults, file, and env, then validates the final result.
func NewLogger ¶
NewLogger creates the application logger from config. It always returns a usable logger; on build failure it falls back to stderr JSON logger.
func OpenDatabase ¶
OpenDatabase opens database connection based on config.
func RegisterDefaultRuntimeAgentFactory ¶
func RegisterDefaultRuntimeAgentFactory( agentRegistry *agent.AgentRegistry, provider llm.Provider, toolProvider llm.Provider, checkpointManager *agent.CheckpointManager, ledger observability.Ledger, logger *zap.Logger, )
RegisterDefaultRuntimeAgentFactory wires the default runtime-backed agent factory.
func RegisterHTTPRoutes ¶
func RegisterHTTPRoutes( mux *http.ServeMux, handlers HTTPRouteHandlers, version string, buildTime string, gitCommit string, firstAPIKey string, logger *zap.Logger, )
RegisterHTTPRoutes wires all API routes into the provided mux and logs route summary.
func RegisterHotReloadCallbacks ¶
func RegisterHotReloadCallbacks( manager *config.HotReloadManager, logger *zap.Logger, onReload func(oldConfig, newConfig *config.Config), )
RegisterHotReloadCallbacks wires standard startup callbacks for hot-reload manager.
func ToolApprovalWorkflowID ¶ added in v1.9.0
func ToolApprovalWorkflowID() string
Types ¶
type AgentToolingOptions ¶
type AgentToolingOptions struct {
RetrievalStore rag.VectorStore
EmbeddingProvider rag.EmbeddingProvider
MCPServer mcpproto.MCPServer
EnableMCPTools bool
DB *gorm.DB
ToolApprovalManager *hitl.InterruptManager
ToolApprovalConfig ToolApprovalConfig
}
AgentToolingOptions carries optional dependencies for agent tool wiring.
type AgentToolingRuntime ¶
type AgentToolingRuntime struct {
Registry *hosted.ToolRegistry
ToolManager agent.ToolManager
ToolNames []string
Permissions llmtools.PermissionManager
// contains filtered or unexported fields
}
AgentToolingRuntime groups runtime-managed tools exposed to Agent execution.
func BuildAgentToolingRuntime ¶
func BuildAgentToolingRuntime(opts AgentToolingOptions, logger *zap.Logger) (*AgentToolingRuntime, error)
BuildAgentToolingRuntime creates a hosted tool registry and ToolManager bridge for agent runtime. It supports retrieval (RAG) and optional MCP tool bridging.
func (*AgentToolingRuntime) BaseToolNames ¶
func (r *AgentToolingRuntime) BaseToolNames() []string
BaseToolNames returns built-in runtime target names that registrations may alias.
func (*AgentToolingRuntime) RegisterHostedTool ¶
func (r *AgentToolingRuntime) RegisterHostedTool(tool hosted.HostedTool)
RegisterHostedTool allows application layer to inject custom hosted tools. Newly added tool names are appended into ToolNames for resolver whitelist wiring.
func (*AgentToolingRuntime) ReloadBindings ¶
func (r *AgentToolingRuntime) ReloadBindings(ctx context.Context) error
ReloadBindings reloads DB-managed tool registrations and applies them to the shared registry.
type CapabilityAgentType ¶ added in v1.9.0
type CapabilityAgentType struct {
Name string `json:"name"`
}
type CapabilityCatalog ¶ added in v1.9.0
type CapabilityCatalog struct {
GeneratedAt time.Time `json:"generated_at"`
AgentTypes []CapabilityAgentType `json:"agent_types"`
Tools []CapabilityTool `json:"tools"`
Modes []CapabilityMode `json:"modes"`
}
CapabilityCatalog is a read-only runtime view of the currently wired capabilities.
func BuildCapabilityCatalog ¶ added in v1.9.0
func BuildCapabilityCatalog( toolRegistry *hosted.ToolRegistry, agentRegistry *agent.AgentRegistry, modeRegistry *multiagent.ModeRegistry, ) *CapabilityCatalog
BuildCapabilityCatalog collects the runtime-exposed agent types, hosted tools, and execution modes.
type CapabilityMode ¶ added in v1.9.0
type CapabilityMode struct {
Name string `json:"name"`
}
type CapabilityTool ¶ added in v1.9.0
type HTTPMiddlewares ¶
type HTTPMiddlewares struct {
List []mw.Middleware
RateLimiterCancel context.CancelFunc
TenantRateLimiterCancel context.CancelFunc
}
HTTPMiddlewares bundles middleware list and lifecycle cancels.
func BuildHTTPMiddlewares ¶
func BuildHTTPMiddlewares( serverCfg config.ServerConfig, collector *metrics.Collector, logger *zap.Logger, ) (HTTPMiddlewares, error)
BuildHTTPMiddlewares creates the default HTTP middleware chain.
type HTTPRouteHandlers ¶
type HTTPRouteHandlers struct {
Health *handlers.HealthHandler
Chat *handlers.ChatHandler
Agent *handlers.AgentHandler
APIKey *handlers.APIKeyHandler
Tools *handlers.ToolRegistryHandler
ToolProviders *handlers.ToolProviderHandler
ToolApprovals *handlers.ToolApprovalHandler
Multimodal *handlers.MultimodalHandler
Protocol *handlers.ProtocolHandler
RAG *handlers.RAGHandler
Workflow *handlers.WorkflowHandler
ConfigAPI *config.ConfigAPIHandler
Cost *handlers.CostHandler
}
HTTPRouteHandlers groups handler dependencies used by HTTP route registration.
type HotReloadRuntime ¶
type HotReloadRuntime struct {
Manager *config.HotReloadManager
APIHandler *config.ConfigAPIHandler
}
HotReloadRuntime groups hot-reload manager and config API handler.
func BuildHotReloadRuntime ¶
func BuildHotReloadRuntime(cfg *config.Config, configPath string, logger *zap.Logger) *HotReloadRuntime
BuildHotReloadRuntime creates hot-reload manager and config API handler.
type LLMHandlerRuntime ¶
type LLMHandlerRuntime = llmcompose.Runtime
LLMHandlerRuntime groups LLM-related runtime dependencies used by API handlers.
func BuildLLMHandlerRuntime ¶
func BuildLLMHandlerRuntime(cfg *config.Config, db *gorm.DB, logger *zap.Logger) (*LLMHandlerRuntime, error)
BuildLLMHandlerRuntime creates the LLM runtime required by handler layer. The main provider entry is selected by cfg.LLM.MainProviderMode.
func BuildLLMHandlerRuntimeFromProvider ¶ added in v1.8.11
func BuildLLMHandlerRuntimeFromProvider(cfg *config.Config, mainProvider llm.Provider, logger *zap.Logger) (*LLMHandlerRuntime, error)
BuildLLMHandlerRuntimeFromProvider assembles the handler-facing runtime around an already constructed main chat provider.
type MongoRuntimeWiring ¶
type MongoRuntimeWiring struct {
AuditLogger *tools.DefaultAuditLogger
EnhancedMemory *memory.EnhancedMemorySystem
ABTester *evaluation.ABTester
}
MongoRuntimeWiring contains optional runtime capabilities wired from MongoDB stores.
func WireMongoRuntimeStores ¶
func WireMongoRuntimeStores( ctx context.Context, client *mongoclient.Client, resolver *agent.CachingResolver, discoveryRegistry *discovery.CapabilityRegistry, logger *zap.Logger, ) (*MongoRuntimeWiring, error)
WireMongoRuntimeStores wires resolver/discovery stores and returns optional runtime capabilities.
type MultimodalRuntime ¶
type MultimodalRuntime struct {
Handler *handlers.MultimodalHandler
ReferenceBackend string
ImageProviderCount int
VideoProviderCount int
}
MultimodalRuntime groups multimodal handler and key runtime metadata.
func BuildMultimodalRuntime ¶
func BuildMultimodalRuntime( cfg *config.Config, chatProvider llm.Provider, budgetManager *llmpolicy.TokenBudgetManager, ledger observability.Ledger, referenceStore storage.ReferenceStore, logger *zap.Logger, ) (*MultimodalRuntime, error)
BuildMultimodalRuntime builds multimodal handler runtime from config. If multimodal is disabled, it returns nil.
type ProtocolRuntime ¶
ProtocolRuntime groups protocol servers required by ProtocolHandler.
func BuildProtocolRuntime ¶
func BuildProtocolRuntime(logger *zap.Logger) *ProtocolRuntime
BuildProtocolRuntime creates MCP and A2A servers for HTTP protocol handler.
type RAGHandlerRuntime ¶
type RAGHandlerRuntime struct {
Store rag.VectorStore
EmbeddingProvider rag.EmbeddingProvider
}
RAGHandlerRuntime groups dependencies required by RAGHandler.
func BuildRAGHandlerRuntime ¶
BuildRAGHandlerRuntime creates dependencies for RAG handler. If no LLM API key is configured, it returns nil.
type ServeRuntime ¶
type ServeRuntime struct {
Config *config.Config
Logger *zap.Logger
Telemetry *telemetry.Providers
DB *gorm.DB
}
ServeRuntime holds dependencies required by cmd/agentflow serve runtime.
func InitializeServeRuntime ¶
func InitializeServeRuntime(configPath string) (*ServeRuntime, error)
InitializeServeRuntime centralizes startup bootstrapping for the serve command: config loading/validation, logger creation, telemetry init, and DB connection.
type ToolApprovalConfig ¶ added in v1.9.0
type ToolApprovalConfig struct {
Backend string
GrantTTL time.Duration
Scope string
PersistPath string
RedisPrefix string
HistoryMaxEntries int
GrantStore ToolApprovalGrantStore
HistoryStore ToolApprovalHistoryStore
}
type ToolApprovalGrant ¶ added in v1.9.0
type ToolApprovalGrantStore ¶ added in v1.9.0
type ToolApprovalGrantStore interface {
Get(ctx context.Context, key string) (*ToolApprovalGrant, error)
Put(ctx context.Context, grant *ToolApprovalGrant) error
Delete(ctx context.Context, key string) error
List(ctx context.Context) ([]*ToolApprovalGrant, error)
CleanupExpired(ctx context.Context, now time.Time) (int, error)
}
func BuildToolApprovalGrantStore ¶ added in v1.9.0
func NewFileToolApprovalGrantStore ¶ added in v1.9.0
func NewFileToolApprovalGrantStore(path string, logger *zap.Logger) ToolApprovalGrantStore
func NewMemoryToolApprovalGrantStore ¶ added in v1.9.0
func NewMemoryToolApprovalGrantStore() ToolApprovalGrantStore
func NewRedisToolApprovalGrantStore ¶ added in v1.9.0
type ToolApprovalHistoryEntry ¶ added in v1.9.0
type ToolApprovalHistoryEntry struct {
EventType string `json:"event_type"`
ApprovalID string `json:"approval_id,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
ToolName string `json:"tool_name,omitempty"`
AgentID string `json:"agent_id,omitempty"`
Status string `json:"status,omitempty"`
Scope string `json:"scope,omitempty"`
Comment string `json:"comment,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
type ToolApprovalHistoryStore ¶ added in v1.9.0
type ToolApprovalHistoryStore interface {
Append(ctx context.Context, entry *ToolApprovalHistoryEntry) error
List(ctx context.Context, limit int) ([]*ToolApprovalHistoryEntry, error)
}
func BuildToolApprovalHistoryStore ¶ added in v1.9.0
func NewFileToolApprovalHistoryStore ¶ added in v1.9.0
func NewFileToolApprovalHistoryStore(path string, maxSize int) ToolApprovalHistoryStore
func NewMemoryToolApprovalHistoryStore ¶ added in v1.9.0
func NewMemoryToolApprovalHistoryStore(maxSize int) ToolApprovalHistoryStore
func NewRedisToolApprovalHistoryStore ¶ added in v1.9.0
func NewRedisToolApprovalHistoryStore(client *redis.Client, keyPrefix string, maxSize int) ToolApprovalHistoryStore
type WorkflowAgentResolver ¶
WorkflowAgentResolver resolves an agent instance by ID for workflow agent steps.
type WorkflowRuntime ¶
WorkflowRuntime groups parser and executor required by WorkflowHandler.
func BuildWorkflowRuntime ¶
func BuildWorkflowRuntime(logger *zap.Logger, opts ...WorkflowRuntimeOptions) *WorkflowRuntime
BuildWorkflowRuntime creates workflow parser and DAG executor.
type WorkflowRuntimeOptions ¶
type WorkflowRuntimeOptions struct {
LLMProvider llm.Provider
DefaultModel string
AgentResolver WorkflowAgentResolver
RetrievalStore rag.VectorStore
EmbeddingProvider rag.EmbeddingProvider
CheckpointStore agent.CheckpointStore
WorkflowCheckpointStore workflow.CheckpointStore
HITLManager *hitl.InterruptManager
}
WorkflowRuntimeOptions carries optional runtime integrations for workflow steps.
Source Files
¶
- agent_checkpoint_store_builder.go
- agent_runtime_factory_builder.go
- agent_tool_approval_builder.go
- agent_tool_policy_builder.go
- agent_tooling_runtime_builder.go
- bootstrap.go
- capability_catalog_builder.go
- domain_runtime_builders.go
- handler_adapters_builder.go
- handler_runtime_builder.go
- hotreload_runtime_builder.go
- http_auth_builder.go
- http_middleware_builder.go
- http_server_builder.go
- mongo_client_builder.go
- mongo_wiring_builder.go
- multimodal_reference_store_builder.go
- multimodal_runtime_builder.go
- string_utils.go
- workflow_checkpoint_store_builder.go
- workflow_step_dependencies_builder.go