Documentation
¶
Overview ¶
Package agentflow provides a small public facade for embedding the scenario-driven agent runtime in other Go projects.
Applications that need low-level extension points can import pkg/core, pkg/llm, pkg/memory, and pkg/runstate directly. Applications that only need to load a YAML scenario and run it should use this package.
Index ¶
- Constants
- Variables
- func LoadSkillManifest(data []byte) (core.Skill, error)
- func LoadSkillManifestFile(path string) (core.Skill, error)
- func LoadToolManifest(data []byte) (core.Tool, error)
- func LoadToolManifestFile(path string) (core.Tool, error)
- func NewAPIKeyMiddleware(config APIKeyMiddlewareConfig) (func(http.Handler) http.Handler, error)
- func NewAnthropicGateway(profiles []llm.Profile, client *http.Client) llm.Gateway
- func NewAsyncRunHTTPHandler(config AsyncRunHTTPHandlerConfig) (http.Handler, error)
- func NewAuthorizationMiddleware(config AuthorizationMiddlewareConfig) (func(http.Handler) http.Handler, error)
- func NewBlobTierColdStore(config BlobTierColdStoreConfig) (tier.Store, error)
- func NewCheckpointHTTPHandler(config CheckpointHTTPHandlerConfig) (http.Handler, error)
- func NewCognitiveTierMemory(manager tier.Manager, weights tier.RecallWeights) memory.CognitiveMemory
- func NewCompositeTierStore(config CompositeTierStoreConfig) tier.Store
- func NewEventFanoutSink(sinks ...core.EventSink) core.EventSink
- func NewEventHub() *observability.EventHub
- func NewEventStoreSink(store observability.EventStore, publishers ...observability.EventPublisher) core.EventSink
- func NewFileAuditSink(path string) (audit.Sink, error)
- func NewFileBlobStore(dir string) (runstate.BlobStore, error)
- func NewFileKnowledgeLoader(config FileKnowledgeLoaderConfig) (knowledge.Loader, error)
- func NewFileMemoryRepository(dir string) (memory.Repository, error)
- func NewFileRunStateRepository(dir string) (runstate.Repository, error)
- func NewFileTierColdStore(dir string) (tier.Store, error)
- func NewFilesystemToolExecutor(config FilesystemToolConfig) (core.ToolExecutor, error)
- func NewFrameworkJobHandler(config FrameworkRunJobHandlerConfig) (asyncpkg.Handler, error)
- func NewGitToolExecutor(config GitToolConfig) (core.ToolExecutor, error)
- func NewHTTPKnowledgeLoader(config HTTPKnowledgeLoaderConfig) (knowledge.Loader, error)
- func NewHTTPToolExecutor(config HTTPToolConfig) (core.ToolExecutor, error)
- func NewHumanHTTPHandler(config HumanHTTPHandlerConfig) http.Handler
- func NewInMemoryAuditSink(limit int) audit.Sink
- func NewInMemoryBlobStore() runstate.BlobStore
- func NewInMemoryCheckpointHistory() runstate.CheckpointHistory
- func NewInMemoryEventStore() observability.EventStore
- func NewInMemoryJobQueue() asyncpkg.Queue
- func NewInMemoryRunStateRepository() runstate.Repository
- func NewInMemoryTierHotStore() tier.Store
- func NewJWTAuthenticator(config JWTAuthenticatorConfig) (security.BearerAuthenticator, error)
- func NewJWTMiddleware(config JWTMiddlewareConfig) (func(http.Handler) http.Handler, error)
- func NewKnowledgeIndexer(config KnowledgeIndexerConfig) (*knowledge.Indexer, error)
- func NewLLMReranker(gateway llm.Gateway, profile string) knowledge.Reranker
- func NewLLMRouter(routes map[string]llm.Gateway) llm.Gateway
- func NewLLMTierSummarizer(gateway llm.Chatter, profile string) tier.ContentSummarizer
- func NewLocalGateway(profiles []llm.Profile, client *http.Client) llm.Gateway
- func NewMCPHTTPClient(endpoint string, client *http.Client) (mcp.Client, error)
- func NewMCPToolExecutor(client mcp.Client, tool string) (core.ToolExecutor, error)
- func NewMockLLMGateway(scenario core.Scenario) llm.Gateway
- func NewNoopAuditSink() audit.Sink
- func NewOIDCJWTAuthenticator(config OIDCJWTAuthenticatorConfig) (security.BearerAuthenticator, error)
- func NewObservabilityEventSink(recorder observability.Recorder, tracer observability.Tracer, ...) core.EventSink
- func NewObservabilityHTTPHandler(config ObservabilityHTTPHandlerConfig) (http.Handler, error)
- func NewOpenAICompatibleEmbedder(profiles []llm.Profile, client *http.Client) llm.Embedder
- func NewOpenAICompatibleGateway(profiles []llm.Profile, client *http.Client) llm.Gateway
- func NewOpenTelemetryStdoutTracerProvider(ctx context.Context, config OpenTelemetryTracerProviderConfig) (*sdktrace.TracerProvider, error)
- func NewOpenTelemetryTracer(tracer oteltrace.Tracer) observability.Tracer
- func NewPostgresCheckpointHistory(db *sql.DB, tableName ...string) (runstate.CheckpointHistory, error)
- func NewPostgresEventStore(ctx context.Context, config PostgresEventStoreConfig) (observability.EventStore, error)
- func NewPostgresJobQueue(db *sql.DB, tableName ...string) (asyncpkg.Queue, error)
- func NewPostgresRunStateRepository(db *sql.DB, tableName ...string) (runstate.Repository, error)
- func NewPostgresTierWarmStore(config PostgresTierWarmStoreConfig) (tier.Store, error)
- func NewPostgresVectorStore(config PostgresVectorStoreConfig) (knowledge.VectorStore, error)
- func NewProductionHTTPHandler(config ProductionHTTPHandlerConfig) (http.Handler, error)
- func NewRedisLocker(config RedisLockerConfig) (coordination.Locker, error)
- func NewRedisRunStateRepository(config RedisRunStateRepositoryConfig) (runstate.Repository, error)
- func NewRetentionHTTPHandler(config RetentionHTTPHandlerConfig) (http.Handler, error)
- func NewRetrieverTool(config RetrieverToolConfig) (core.ToolExecutor, error)
- func NewS3BlobStore(config S3BlobStoreConfig) (runstate.BlobStore, error)
- func NewSQLToolExecutor(config SQLToolConfig) (core.ToolExecutor, error)
- func NewScoreReranker() knowledge.Reranker
- func NewSlogAuditSink(logger *stdslog.Logger) audit.Sink
- func NewSlogEventSink(logger *stdslog.Logger) core.EventSink
- func NewStaticAPIKeyAuthenticator(keys map[string]identity.Principal) (security.APIKeyAuthenticator, error)
- func NewStudioHTTPHandler(config StudioHTTPHandlerConfig) (http.Handler, error)
- func NewTicketToolExecutor(config TicketToolConfig) (core.ToolExecutor, error)
- func NewTierColdSummaryIndexer(config TierColdSummaryIndexerConfig) (tier.ColdSummaryIndexer, error)
- func NewVerboseSlogEventSink(logger *stdslog.Logger) core.EventSink
- func NewWebhookHTTPHandler(config WebhookHTTPHandlerConfig) (http.Handler, error)
- func OpenTelemetryTracerFromProvider(provider *sdktrace.TracerProvider, instrumentationName string) observability.Tracer
- func PrometheusMetricsHandler(recorder *PrometheusRecorder) http.Handler
- func ScenarioJSONSchema() []byte
- func ValidateScenario(scenario core.Scenario) error
- func ValidateSkillManifest(skill core.Skill) error
- func ValidateToolManifest(tool core.Tool) error
- func ValidateWiring(scenario core.Scenario, opts ...Option) error
- func ValidateWiringWithOptions(scenario core.Scenario, wiring WiringOptions, opts ...Option) error
- type APIKeyMiddlewareConfig
- type AsyncRunHTTPHandlerConfig
- type AuthorizationMiddlewareConfig
- type BlobTierColdStoreConfig
- type CheckpointHTTPHandlerConfig
- type CodegenResult
- type CompositeTierStoreConfig
- type EventRouter
- type FileKnowledgeLoaderConfig
- type FilesystemToolConfig
- type ForkRunResult
- type Framework
- func (f *Framework) BlobStore() runstate.BlobStore
- func (f *Framework) Catalog() catalog.Catalog
- func (f *Framework) Close(ctx context.Context) error
- func (f *Framework) CompareRuns(ctx context.Context, runA, runB string) (studio.RunCompareResult, error)
- func (f *Framework) ExportScenarioGraph() ScenarioGraph
- func (f *Framework) ForkRun(ctx context.Context, parentRunID string, version int64) (ForkRunResult, error)
- func (f *Framework) GenerateStudioBuilderCode(_ context.Context, edited graph.ScenarioGraph) (CodegenResult, error)
- func (f *Framework) GenerateStudioScenarioYAML(_ context.Context, edited graph.ScenarioGraph) (CodegenResult, error)
- func (f *Framework) GetRunCheckpoint(ctx context.Context, runID string, version int64) (runstate.RunSnapshot, error)
- func (f *Framework) HandleEvent(ctx context.Context, event IncomingEvent) (RunResult, error)
- func (f *Framework) ImportStudioScenarioYAML(_ context.Context, yamlData []byte, layout graph.ScenarioGraph) (ImportStudioResult, error)
- func (f *Framework) ListRunCheckpoints(ctx context.Context, runID string, limit int) (ListRunCheckpointsResult, error)
- func (f *Framework) ListRunSteps(ctx context.Context, runID string) (ListRunStepsResult, error)
- func (f *Framework) ListRunThread(ctx context.Context, runID string) ([]ThreadRunSummary, error)
- func (f *Framework) PurgeExpired(ctx context.Context, maxAge time.Duration) (int, error)
- func (f *Framework) PurgeOrphanBlobs(ctx context.Context) (int, error)
- func (f *Framework) PurgeRuns(ctx context.Context, filter runstate.ListFilter) (int, error)
- func (f *Framework) PurgeWithPolicy(ctx context.Context, policy RetentionPolicy) (int, error)
- func (f *Framework) ResolveEvent(event IncomingEvent) (RunRequest, error)
- func (f *Framework) Resume(ctx context.Context, token string, decision core.Decision, ...) error
- func (f *Framework) ResumeAndContinue(ctx context.Context, token string, decision core.Decision, ...) (RunResult, error)
- func (f *Framework) ResumeFromCheckpoint(ctx context.Context, runID string, version int64) (RunResult, error)
- func (f *Framework) ResumeFromStep(ctx context.Context, runID, nodeID string) (RunResult, error)
- func (f *Framework) ResumeRunByID(ctx context.Context, runID string, decision core.Decision, ...) (RunResult, error)
- func (f *Framework) Run(ctx context.Context, req RunRequest) (RunResult, error)
- func (f *Framework) RunStateRepository() runstate.Repository
- func (f *Framework) RunStructured(ctx context.Context, req RunRequest) (RunResult, error)
- func (f *Framework) RunStudioGraph(ctx context.Context, edited graph.ScenarioGraph, req RunRequest) (RunResult, error)
- func (f *Framework) SaveStudioGraph(ctx context.Context, edited graph.ScenarioGraph, path string) (SaveStudioResult, error)
- func (f *Framework) Scenario() core.Scenario
- func (f *Framework) Stream(ctx context.Context, req RunRequest) (<-chan llm.ChatChunk, error)
- func (f *Framework) ValidateStudioGraph(_ context.Context, edited graph.ScenarioGraph) (ValidateStudioResult, error)
- type FrameworkRunJobHandlerConfig
- type GitToolConfig
- type GraphEdge
- type GraphNode
- type GraphView
- type HTTPKnowledgeLoaderConfig
- type HTTPToolConfig
- type HumanHTTPHandlerConfig
- type ImportStudioResult
- type IncomingEvent
- type JWTAlgorithm
- type JWTAuthenticatorConfig
- type JWTKey
- type JWTMiddlewareConfig
- type KnowledgeIndexerConfig
- type KnowledgeRegistry
- type LLMProviderRouter
- type ListRunCheckpointsResult
- type ListRunStepsResult
- type MCPRegistry
- type MCPStdioClient
- type MCPStdioClientConfig
- type MapBranch
- type OIDCJWTAuthenticatorConfig
- type ObservabilityHTTPHandlerConfig
- type OpenAICompatibleProvider
- type OpenTelemetryTracer
- type OpenTelemetryTracerProviderConfig
- type Option
- func KnowledgeWiringOptions(scenario core.Scenario, registry KnowledgeRegistry) ([]Option, error)
- func MCPWiringOptions(ctx context.Context, scenario core.Scenario, registry MCPRegistry) ([]Option, error)
- func WireMCPTools(ctx context.Context, scenario core.Scenario, registry MCPRegistry) ([]Option, error)
- func WithAuditSink(sink audit.Sink) Option
- func WithBlobStore(store runstate.BlobStore) Option
- func WithCheckpointHistory(history runstate.CheckpointHistory) Option
- func WithCloser(fn func(context.Context) error) Option
- func WithCognitiveMemory(name string, repo memory.CognitiveMemory) Option
- func WithDatabase(db *sql.DB) Option
- func WithEventSink(sink core.EventSink) Option
- func WithHITLTokenSecret(secret []byte, tokenWriter io.Writer) Option
- func WithHITLTokenTTL(ttl time.Duration) Option
- func WithHumanGate(gate core.HumanGate) Option
- func WithJobQueue(queue async.Queue) Option
- func WithLLMGateway(gateway llm.Gateway) Option
- func WithLogger(logger log.Logger) Option
- func WithMemoryRepository(name string, repo memory.Repository) Option
- func WithOutputRedactor(redactor governance.OutputRedactor) Option
- func WithRecorder(recorder observability.Recorder) Option
- func WithRequireLLM() Option
- func WithRunStateRepository(repo runstate.Repository) Option
- func WithSecurityPolicy(policy security.Policy) Option
- func WithTierColdSummarizer(name string, summarizer tier.ContentSummarizer) Option
- func WithTierColdSummaryIndexer(name string, indexer tier.ColdSummaryIndexer) Option
- func WithTierMemory(name string, manager tier.Manager) Option
- func WithTierStore(name string, store tier.Store, policy tier.Policy) Option
- func WithToolExecutor(name string, executor core.ToolExecutor) Option
- func WithToolGovernancePolicy(policy governance.ToolPolicy) Option
- func WithToolResolver(resolver core.ToolResolver) Option
- func WithTracer(tracer observability.Tracer) Option
- type PendingHITLInfo
- type Plan
- type PostgresEventStoreConfig
- type PostgresTierWarmStoreConfig
- type PostgresVectorStoreConfig
- type ProductionHTTPHandlerConfig
- type PrometheusRecorder
- type RedisLockerConfig
- type RedisRunStateRepositoryConfig
- type RetentionHTTPHandlerConfig
- type RetentionPolicy
- type RetrieverToolConfig
- type RunRequest
- type RunResult
- type RunStep
- type S3BlobStoreConfig
- type SQLToolConfig
- type SaveStudioResult
- type ScenarioBuilder
- type ScenarioGraph
- type StudioHTTPHandlerConfig
- type ThreadRunSummary
- type Ticket
- type TicketStore
- type TicketToolConfig
- type TierColdSummaryIndexerConfig
- type ToolResolver
- type ToolResolverFunc
- type ValidateStudioResult
- type WebhookHTTPHandlerConfig
- type WiringOptions
- type WorkflowBuilder
Examples ¶
Constants ¶
const SchemaVersion = "2020-12"
SchemaVersion is the JSON Schema draft used by ScenarioJSONSchema.
const Version = "0.2.2"
Version is the library release version exposed to embedders.
Variables ¶
var AdaptiveRAG = scenariobuilder.AdaptiveRAG
AdaptiveRAG builds the adaptive-rag workflow example stack.
var AdaptiveRAGWorkflow = scenariobuilder.AdaptiveRAGWorkflow
AdaptiveRAGWorkflow builds the adaptive RAG workflow graph.
var CodeReviewPipeline = scenariobuilder.CodeReviewPipeline
CodeReviewPipeline builds the code review workflow example stack.
var CodeReviewPipelineWorkflow = scenariobuilder.CodeReviewPipelineWorkflow
CodeReviewPipelineWorkflow builds the code review workflow graph.
var ContextGovernance = scenariobuilder.ContextGovernance
ContextGovernance builds the context governance example stack.
var CorrectiveRAG = scenariobuilder.CorrectiveRAG
CorrectiveRAG builds the corrective-rag workflow example stack.
var CorrectiveRAGWorkflow = scenariobuilder.CorrectiveRAGWorkflow
CorrectiveRAGWorkflow builds the corrective RAG workflow graph.
var DeclarativeInterruptWorkflow = scenariobuilder.DeclarativeInterruptWorkflow
DeclarativeInterruptWorkflow builds the prepare → interrupt → continue graph.
var FixedWorkflowReviewWorkflow = scenariobuilder.FixedWorkflowReviewWorkflow
FixedWorkflowReviewWorkflow builds the inspect → review workflow graph.
var HybridResearch = scenariobuilder.HybridResearch
HybridResearch builds the hybrid research example stack.
var HybridResearchWorkflow = scenariobuilder.HybridResearchWorkflow
HybridResearchWorkflow builds the hybrid research workflow graph.
var MapItemField = scenariobuilder.MapItemField
MapItemField sets the per-item field name for map branches.
var MapNodeInput = scenariobuilder.MapNodeInput
MapNodeInput builds map node input JSON from a list field and branches.
var MapOnError = scenariobuilder.MapOnError
MapOnError sets the map node error policy branch.
var MinimalAutonomous = scenariobuilder.MinimalAutonomous
MinimalAutonomous builds the common mock/session/tool autonomous stack.
var MinimalDeclarativeInterrupt = scenariobuilder.MinimalDeclarativeInterrupt
MinimalDeclarativeInterrupt builds the declarative interrupt demo stack.
var MinimalFilesystemTool = scenariobuilder.MinimalFilesystemTool
MinimalFilesystemTool builds the filesystem tool example stack.
var MinimalFixedWorkflowReview = scenariobuilder.MinimalFixedWorkflowReview
MinimalFixedWorkflowReview builds the fixed workflow review example stack.
var MinimalHTTPTool = scenariobuilder.MinimalHTTPTool
MinimalHTTPTool builds the http tool example stack.
var MinimalHumanInLoop = scenariobuilder.MinimalHumanInLoop
MinimalHumanInLoop builds the human-in-loop demo stack.
var MinimalMCPTool = scenariobuilder.MinimalMCPTool
MinimalMCPTool builds the MCP tool example stack.
var MinimalRAG = scenariobuilder.MinimalRAG
MinimalRAG builds the rag-knowledge example stack.
var MinimalSQLTool = scenariobuilder.MinimalSQLTool
MinimalSQLTool builds the sql tool example stack.
var MinimalTicketHandling = scenariobuilder.MinimalTicketHandling
MinimalTicketHandling builds the ticket-handling example stack.
var MultiExpertResearch = scenariobuilder.MultiExpertResearch
MultiExpertResearch builds the multi-expert hybrid example stack.
var MultiExpertResearchWorkflow = scenariobuilder.MultiExpertResearchWorkflow
MultiExpertResearchWorkflow builds the parallel expert workflow graph.
var NewMinimal = scenariobuilder.NewMinimal
NewMinimal starts a scenario with the standard mock/session stack. Register tools, then call MinimalAgent or configure agents manually.
var NewScenarioBuilder = scenariobuilder.New
NewScenarioBuilder creates a scenario builder. Prefer pkg/builder when importing only the builder package without the root facade.
var NewWorkflowBuilder = scenariobuilder.NewWorkflow
NewWorkflowBuilder creates a workflow builder.
var SelfRAG = scenariobuilder.SelfRAG
SelfRAG builds the self-rag workflow example stack.
var SelfRAGWorkflow = scenariobuilder.SelfRAGWorkflow
SelfRAGWorkflow builds the self RAG workflow graph.
var TierMemoryAutonomous = scenariobuilder.TierMemoryAutonomous
TierMemoryAutonomous builds the tier-memory example stack.
var WorkflowEnhancements = scenariobuilder.WorkflowEnhancements
WorkflowEnhancements builds the workflow enhancements example stack.
var WorkflowEnhancementsWorkflow = scenariobuilder.WorkflowEnhancementsWorkflow
WorkflowEnhancementsWorkflow builds the workflow enhancements graph.
Functions ¶
func LoadSkillManifest ¶ added in v0.1.8
LoadSkillManifest loads and validates a standalone skill catalog manifest document.
func LoadSkillManifestFile ¶ added in v0.1.8
LoadSkillManifestFile loads and validates a standalone skill catalog manifest.
func LoadToolManifest ¶ added in v0.1.8
LoadToolManifest loads and validates a standalone tool catalog manifest document.
func LoadToolManifestFile ¶ added in v0.1.8
LoadToolManifestFile loads and validates a standalone tool catalog manifest.
func NewAPIKeyMiddleware ¶
func NewAnthropicGateway ¶
NewAnthropicGateway creates a gateway for Anthropic Messages APIs.
func NewAsyncRunHTTPHandler ¶
func NewAsyncRunHTTPHandler(config AsyncRunHTTPHandlerConfig) (http.Handler, error)
func NewBlobTierColdStore ¶ added in v0.2.0
func NewBlobTierColdStore(config BlobTierColdStoreConfig) (tier.Store, error)
NewBlobTierColdStore stores gzip JSON cold-tier records in a BlobAdmin backend.
func NewCheckpointHTTPHandler ¶ added in v0.2.0
func NewCheckpointHTTPHandler(config CheckpointHTTPHandlerConfig) (http.Handler, error)
NewCheckpointHTTPHandler serves production checkpoint routes:
- GET /v1/runs/{run_id}/steps
- POST /v1/runs/{run_id}/resume-from-step
- GET /v1/runs/{run_id}/checkpoints
- GET /v1/runs/{run_id}/checkpoints/{version}
- POST /v1/runs/{run_id}/resume-from-checkpoint
func NewCognitiveTierMemory ¶ added in v0.1.9
func NewCognitiveTierMemory(manager tier.Manager, weights tier.RecallWeights) memory.CognitiveMemory
NewCognitiveTierMemory exposes a tier Manager through the CognitiveMemory port.
func NewCompositeTierStore ¶ added in v0.1.9
func NewCompositeTierStore(config CompositeTierStoreConfig) tier.Store
NewCompositeTierStore routes records across tier backends.
func NewEventHub ¶
func NewEventHub() *observability.EventHub
func NewEventStoreSink ¶
func NewEventStoreSink(store observability.EventStore, publishers ...observability.EventPublisher) core.EventSink
func NewFileBlobStore ¶
NewFileBlobStore creates a file-backed blob store.
func NewFileKnowledgeLoader ¶
func NewFileKnowledgeLoader(config FileKnowledgeLoaderConfig) (knowledge.Loader, error)
NewFileKnowledgeLoader creates a filesystem document loader for knowledge ingestion.
func NewFileMemoryRepository ¶
func NewFileMemoryRepository(dir string) (memory.Repository, error)
NewFileMemoryRepository creates a JSON-file-backed memory repository.
func NewFileRunStateRepository ¶
func NewFileRunStateRepository(dir string) (runstate.Repository, error)
NewFileRunStateRepository creates a JSON-file-backed run-state repository.
func NewFileTierColdStore ¶ added in v0.1.9
NewFileTierColdStore creates a gzip JSON cold-tier store on the local filesystem.
func NewFilesystemToolExecutor ¶
func NewFilesystemToolExecutor(config FilesystemToolConfig) (core.ToolExecutor, error)
NewFilesystemToolExecutor creates a governed filesystem read tool executor.
func NewFrameworkJobHandler ¶ added in v0.1.2
func NewFrameworkJobHandler(config FrameworkRunJobHandlerConfig) (asyncpkg.Handler, error)
NewFrameworkJobHandler executes framework run, event, resume.continue, and memory.reconcile jobs.
func NewGitToolExecutor ¶ added in v0.1.2
func NewGitToolExecutor(config GitToolConfig) (core.ToolExecutor, error)
NewGitToolExecutor creates a read-only git tool executor.
func NewHTTPKnowledgeLoader ¶
func NewHTTPKnowledgeLoader(config HTTPKnowledgeLoaderConfig) (knowledge.Loader, error)
NewHTTPKnowledgeLoader creates an HTTP document loader for knowledge ingestion.
func NewHTTPToolExecutor ¶
func NewHTTPToolExecutor(config HTTPToolConfig) (core.ToolExecutor, error)
NewHTTPToolExecutor creates a governed HTTP client tool executor.
func NewHumanHTTPHandler ¶ added in v0.1.2
func NewHumanHTTPHandler(config HumanHTTPHandlerConfig) http.Handler
NewHumanHTTPHandler serves human gate resume requests. When the request sets continue=true, the handler calls ResumeAndContinue instead of Resume.
func NewInMemoryAuditSink ¶
func NewInMemoryBlobStore ¶
NewInMemoryBlobStore creates the default in-memory blob store used by New.
func NewInMemoryCheckpointHistory ¶ added in v0.2.0
func NewInMemoryCheckpointHistory() runstate.CheckpointHistory
NewInMemoryCheckpointHistory creates an append-only in-memory checkpoint history store.
func NewInMemoryEventStore ¶
func NewInMemoryEventStore() observability.EventStore
func NewInMemoryJobQueue ¶
func NewInMemoryRunStateRepository ¶
func NewInMemoryRunStateRepository() runstate.Repository
NewInMemoryRunStateRepository creates the default in-memory run-state repository used by New.
func NewInMemoryTierHotStore ¶ added in v0.1.9
NewInMemoryTierHotStore creates an in-process hot-tier store.
func NewJWTAuthenticator ¶
func NewJWTAuthenticator(config JWTAuthenticatorConfig) (security.BearerAuthenticator, error)
func NewJWTMiddleware ¶
func NewKnowledgeIndexer ¶
func NewKnowledgeIndexer(config KnowledgeIndexerConfig) (*knowledge.Indexer, error)
NewKnowledgeIndexer creates a document chunking, embedding, and vector upsert pipeline.
func NewLLMReranker ¶ added in v0.1.5
NewLLMReranker creates an LLM reranker for retrieval tools.
func NewLLMRouter ¶
NewLLMRouter routes profile names to provider-specific gateways.
func NewLLMTierSummarizer ¶ added in v0.2.0
func NewLLMTierSummarizer(gateway llm.Chatter, profile string) tier.ContentSummarizer
NewLLMTierSummarizer creates an LLM-backed cold-tier content summarizer.
func NewLocalGateway ¶
NewLocalGateway creates a gateway for local OpenAI-compatible model servers.
func NewMCPHTTPClient ¶
NewMCPHTTPClient creates an MCP JSON-RPC client over HTTP.
func NewMCPToolExecutor ¶
NewMCPToolExecutor adapts one MCP server tool into an AgentFlow tool executor.
func NewMockLLMGateway ¶ added in v0.1.4
NewMockLLMGateway creates a fallback mock gateway for tests and examples.
func NewNoopAuditSink ¶
func NewOIDCJWTAuthenticator ¶
func NewOIDCJWTAuthenticator(config OIDCJWTAuthenticatorConfig) (security.BearerAuthenticator, error)
NewOIDCJWTAuthenticator creates a bearer authenticator that discovers and refreshes RSA verification keys from OIDC Discovery/JWKS endpoints.
func NewObservabilityEventSink ¶
func NewObservabilityEventSink(recorder observability.Recorder, tracer observability.Tracer, next core.EventSink) core.EventSink
func NewObservabilityHTTPHandler ¶
func NewObservabilityHTTPHandler(config ObservabilityHTTPHandlerConfig) (http.Handler, error)
func NewOpenAICompatibleEmbedder ¶
NewOpenAICompatibleEmbedder creates an embedder for OpenAI-compatible embedding APIs.
func NewOpenAICompatibleGateway ¶
NewOpenAICompatibleGateway creates a gateway for OpenAI-compatible chat APIs.
func NewOpenTelemetryStdoutTracerProvider ¶ added in v0.1.8
func NewOpenTelemetryStdoutTracerProvider(ctx context.Context, config OpenTelemetryTracerProviderConfig) (*sdktrace.TracerProvider, error)
NewOpenTelemetryStdoutTracerProvider creates a TracerProvider that exports spans to stdout.
func NewOpenTelemetryTracer ¶ added in v0.1.8
func NewOpenTelemetryTracer(tracer oteltrace.Tracer) observability.Tracer
NewOpenTelemetryTracer wraps a host-configured OpenTelemetry tracer.
func NewPostgresCheckpointHistory ¶ added in v0.2.0
func NewPostgresCheckpointHistory(db *sql.DB, tableName ...string) (runstate.CheckpointHistory, error)
NewPostgresCheckpointHistory creates a PostgreSQL append-only checkpoint history store.
func NewPostgresEventStore ¶
func NewPostgresEventStore(ctx context.Context, config PostgresEventStoreConfig) (observability.EventStore, error)
func NewPostgresJobQueue ¶
func NewPostgresRunStateRepository ¶
NewPostgresRunStateRepository creates a PostgreSQL-compatible run-state repository using a caller-provided *sql.DB. Applications must import and register their preferred PostgreSQL database/sql driver.
func NewPostgresTierWarmStore ¶ added in v0.1.9
func NewPostgresTierWarmStore(config PostgresTierWarmStoreConfig) (tier.Store, error)
NewPostgresTierWarmStore creates a warm-tier store backed by Postgres JSONB rows.
func NewPostgresVectorStore ¶
func NewPostgresVectorStore(config PostgresVectorStoreConfig) (knowledge.VectorStore, error)
NewPostgresVectorStore creates a pgvector-compatible knowledge vector store.
func NewProductionHTTPHandler ¶
func NewProductionHTTPHandler(config ProductionHTTPHandlerConfig) (http.Handler, error)
func NewRedisLocker ¶
func NewRedisLocker(config RedisLockerConfig) (coordination.Locker, error)
NewRedisLocker creates a Redis-backed lease manager for distributed worker and workflow coordination.
func NewRedisRunStateRepository ¶
func NewRedisRunStateRepository(config RedisRunStateRepositoryConfig) (runstate.Repository, error)
NewRedisRunStateRepository creates a Redis-backed run-state repository with compare-and-swap version checks for distributed workers.
func NewRetentionHTTPHandler ¶ added in v0.2.0
func NewRetentionHTTPHandler(config RetentionHTTPHandlerConfig) (http.Handler, error)
NewRetentionHTTPHandler serves admin retention routes:
- POST /v1/admin/retention/purge-runs
- POST /v1/admin/retention/purge-expired
- POST /v1/admin/retention/purge-policy
- POST /v1/admin/retention/purge-blobs
func NewRetrieverTool ¶
func NewRetrieverTool(config RetrieverToolConfig) (core.ToolExecutor, error)
NewRetrieverTool creates a semantic retrieval tool backed by an embedder and vector store.
func NewS3BlobStore ¶
func NewS3BlobStore(config S3BlobStoreConfig) (runstate.BlobStore, error)
NewS3BlobStore creates an S3-compatible blob store for large runtime and workflow outputs. It uses path-style object URLs, AWS Signature Version 4, and supports providers whose S3-compatible PUT/GET behavior has been tested.
func NewSQLToolExecutor ¶
func NewSQLToolExecutor(config SQLToolConfig) (core.ToolExecutor, error)
NewSQLToolExecutor creates a governed read-only SQL query tool executor.
func NewScoreReranker ¶ added in v0.1.5
NewScoreReranker creates a lexical score reranker for retrieval tools.
func NewStudioHTTPHandler ¶ added in v0.2.0
func NewStudioHTTPHandler(config StudioHTTPHandlerConfig) (http.Handler, error)
NewStudioHTTPHandler serves production Studio routes:
- POST /v1/studio/validate
- POST /v1/studio/codegen
- POST /v1/studio/yaml
- POST /v1/studio/import-yaml
- POST /v1/studio/run
- POST /v1/studio/save (when StudioSavePath is set)
func NewTicketToolExecutor ¶ added in v0.1.2
func NewTicketToolExecutor(config TicketToolConfig) (core.ToolExecutor, error)
NewTicketToolExecutor creates a ticket store backed tool executor.
func NewTierColdSummaryIndexer ¶ added in v0.2.0
func NewTierColdSummaryIndexer(config TierColdSummaryIndexerConfig) (tier.ColdSummaryIndexer, error)
NewTierColdSummaryIndexer indexes cold-tier summaries for semantic recall.
func NewVerboseSlogEventSink ¶ added in v0.1.6
NewVerboseSlogEventSink logs runtime events with redacted-safe payload details to stderr-friendly sinks.
func NewWebhookHTTPHandler ¶ added in v0.1.2
func NewWebhookHTTPHandler(config WebhookHTTPHandlerConfig) (http.Handler, error)
NewWebhookHTTPHandler serves POST / requests that accept IncomingEvent JSON payloads.
func OpenTelemetryTracerFromProvider ¶ added in v0.1.8
func OpenTelemetryTracerFromProvider(provider *sdktrace.TracerProvider, instrumentationName string) observability.Tracer
OpenTelemetryTracerFromProvider returns a tracer backed by a TracerProvider.
func PrometheusMetricsHandler ¶ added in v0.1.4
func PrometheusMetricsHandler(recorder *PrometheusRecorder) http.Handler
PrometheusMetricsHandler returns an http.Handler that serves recorder metrics.
func ScenarioJSONSchema ¶ added in v0.1.4
func ScenarioJSONSchema() []byte
ScenarioJSONSchema returns a copy of the AgentFlow scenario JSON Schema.
func ValidateScenario ¶
ValidateScenario validates a scenario built programmatically.
func ValidateSkillManifest ¶ added in v0.1.8
ValidateSkillManifest validates a skill manifest for catalog registration.
func ValidateToolManifest ¶ added in v0.1.8
ValidateToolManifest validates a tool manifest for catalog registration.
func ValidateWiring ¶ added in v0.1.4
ValidateWiring checks that a scenario's declared dependencies are covered by the provided options before constructing a Framework.
func ValidateWiringWithOptions ¶ added in v0.1.4
func ValidateWiringWithOptions(scenario core.Scenario, wiring WiringOptions, opts ...Option) error
ValidateWiringWithOptions validates wiring using explicit wiring rules.
Types ¶
type APIKeyMiddlewareConfig ¶
type APIKeyMiddlewareConfig struct {
Authenticator security.APIKeyAuthenticator
HeaderName string
}
type BlobTierColdStoreConfig ¶ added in v0.2.0
BlobTierColdStoreConfig configures a blob-backed cold tier with a local index directory.
type CheckpointHTTPHandlerConfig ¶ added in v0.2.0
type CodegenResult ¶ added in v0.2.0
CodegenResult contains generated builder code for a Studio graph.
type CompositeTierStoreConfig ¶ added in v0.1.9
CompositeTierStoreConfig wires hot, warm, and cold tier backends.
type EventRouter ¶ added in v0.1.2
type EventRouter = eventrouter.Router
EventRouter maps external events to run requests for a scenario.
func NewEventRouter ¶ added in v0.1.2
func NewEventRouter(scenario core.Scenario) *EventRouter
NewEventRouter creates a router from scenario trigger definitions.
type FilesystemToolConfig ¶
type ForkRunResult ¶ added in v0.2.0
type Framework ¶
type Framework struct {
// contains filtered or unexported fields
}
Framework is an embeddable runtime wrapper for one scenario.
func New ¶
New creates a Framework for a validated scenario. By default it wires in-memory run-state and blob stores and a no-op event sink. Production applications should provide persistent repositories through options.
Example ¶
package main
import (
"context"
"encoding/json"
agentflow "github.com/aijustin/agentflow-go"
"github.com/aijustin/agentflow-go/pkg/builder"
"github.com/aijustin/agentflow-go/pkg/core"
)
func testAutonomousScenario() core.Scenario {
return builder.MinimalAutonomous("assistant", builder.MinimalScenarioName("autonomous-echo"))
}
type noopTool struct{}
func (noopTool) Execute(context.Context, core.ToolCall) (core.ToolResult, error) {
return core.ToolResult{}, nil
}
func main() {
fw, err := agentflow.New(testAutonomousScenario(), agentflow.WithToolExecutor("echo", noopTool{}))
if err != nil {
panic(err)
}
result, err := fw.Run(context.Background(), agentflow.RunRequest{
RunID: "example-run",
Prompt: "hello",
})
if err != nil {
panic(err)
}
out, _ := json.Marshal(result.Status)
println(string(out))
}
Output:
func (*Framework) Close ¶ added in v0.1.4
Close releases resources registered through WithCloser or WithDatabase.
func (*Framework) CompareRuns ¶ added in v0.2.0
func (f *Framework) CompareRuns(ctx context.Context, runA, runB string) (studio.RunCompareResult, error)
CompareRuns diffs step outputs between two persisted runs.
func (*Framework) ExportScenarioGraph ¶ added in v0.2.0
func (f *Framework) ExportScenarioGraph() ScenarioGraph
ExportScenarioGraph exports the framework scenario as a nested graph.
func (*Framework) ForkRun ¶ added in v0.2.0
func (f *Framework) ForkRun(ctx context.Context, parentRunID string, version int64) (ForkRunResult, error)
ForkRun copies a run snapshot into a new run ID without modifying the parent run.
func (*Framework) GenerateStudioBuilderCode ¶ added in v0.2.0
func (f *Framework) GenerateStudioBuilderCode(_ context.Context, edited graph.ScenarioGraph) (CodegenResult, error)
GenerateStudioBuilderCode renders builder Go code for an edited Studio graph.
func (*Framework) GenerateStudioScenarioYAML ¶ added in v0.2.0
func (f *Framework) GenerateStudioScenarioYAML(_ context.Context, edited graph.ScenarioGraph) (CodegenResult, error)
GenerateStudioScenarioYAML renders legacy scenario YAML for an edited Studio graph.
func (*Framework) GetRunCheckpoint ¶ added in v0.2.0
func (f *Framework) GetRunCheckpoint(ctx context.Context, runID string, version int64) (runstate.RunSnapshot, error)
GetRunCheckpoint loads one historical snapshot revision for a run.
func (*Framework) HandleEvent ¶ added in v0.1.2
HandleEvent resolves an incoming event and executes the scenario.
func (*Framework) ImportStudioScenarioYAML ¶ added in v0.2.0
func (f *Framework) ImportStudioScenarioYAML(_ context.Context, yamlData []byte, layout graph.ScenarioGraph) (ImportStudioResult, error)
ImportStudioScenarioYAML parses legacy scenario YAML and returns an editable graph. When layout is non-empty, node positions from layout are merged onto the imported graph.
func (*Framework) ListRunCheckpoints ¶ added in v0.2.0
func (f *Framework) ListRunCheckpoints(ctx context.Context, runID string, limit int) (ListRunCheckpointsResult, error)
ListRunCheckpoints returns append-only snapshot revisions recorded for a run.
func (*Framework) ListRunSteps ¶ added in v0.2.0
ListRunSteps returns persisted step outputs and the current snapshot version.
func (*Framework) ListRunThread ¶ added in v0.2.0
ListRunThread returns runs in the same fork/thread group as the given run.
func (*Framework) PurgeExpired ¶ added in v0.1.4
PurgeExpired deletes terminal run snapshots whose UpdatedAt is before now-maxAge. Snapshots without UpdatedAt are skipped.
func (*Framework) PurgeOrphanBlobs ¶ added in v0.1.4
PurgeOrphanBlobs deletes blob objects that are no longer referenced by any run snapshot for the current scenario (and tenant, when a principal is present).
func (*Framework) PurgeWithPolicy ¶ added in v0.1.4
PurgeWithPolicy deletes run snapshots using a retention policy.
func (*Framework) ResolveEvent ¶ added in v0.1.2
func (f *Framework) ResolveEvent(event IncomingEvent) (RunRequest, error)
ResolveEvent resolves an incoming event without executing it.
func (*Framework) Resume ¶
func (f *Framework) Resume(ctx context.Context, token string, decision core.Decision, amendment json.RawMessage) error
Resume resumes a paused run through the configured human gate.
func (*Framework) ResumeAndContinue ¶ added in v0.1.2
func (f *Framework) ResumeAndContinue(ctx context.Context, token string, decision core.Decision, amendment json.RawMessage) (RunResult, error)
ResumeAndContinue resumes a paused run and continues execution until the next pause point or completion.
func (*Framework) ResumeFromCheckpoint ¶ added in v0.2.0
func (f *Framework) ResumeFromCheckpoint(ctx context.Context, runID string, version int64) (RunResult, error)
ResumeFromCheckpoint restores a historical snapshot revision and reruns the workflow forward from that restored state.
func (*Framework) ResumeFromStep ¶ added in v0.2.0
ResumeFromStep rewinds a workflow run to the given node, truncating that node and all downstream step outputs, then reruns from that point forward.
func (*Framework) ResumeRunByID ¶ added in v0.2.0
func (f *Framework) ResumeRunByID(ctx context.Context, runID string, decision core.Decision, amendment json.RawMessage, continueExecution bool) (RunResult, error)
ResumeRunByID resumes a paused run by signing a HITL token from the current snapshot. When continueExecution is true, execution continues until completion or the next pause.
func (*Framework) RunStateRepository ¶
func (f *Framework) RunStateRepository() runstate.Repository
RunStateRepository returns the repository backing run-state snapshots.
func (*Framework) RunStructured ¶
RunStructured executes an agent using its configured output_schema and a gateway that implements llm.StructuredOutputter.
func (*Framework) RunStudioGraph ¶ added in v0.2.0
func (f *Framework) RunStudioGraph(ctx context.Context, edited graph.ScenarioGraph, req RunRequest) (RunResult, error)
RunStudioGraph validates an edited graph and executes it as a new run.
func (*Framework) SaveStudioGraph ¶ added in v0.2.0
func (f *Framework) SaveStudioGraph(ctx context.Context, edited graph.ScenarioGraph, path string) (SaveStudioResult, error)
SaveStudioGraph validates an edited graph, writes legacy YAML to path, and updates the framework scenario.
func (*Framework) ValidateStudioGraph ¶ added in v0.2.0
func (f *Framework) ValidateStudioGraph(_ context.Context, edited graph.ScenarioGraph) (ValidateStudioResult, error)
ValidateStudioGraph validates an edited Studio graph against the framework scenario.
type FrameworkRunJobHandlerConfig ¶
type FrameworkRunJobHandlerConfig struct {
Framework *Framework
}
type GitToolConfig ¶ added in v0.1.2
type GitToolConfig struct {
AllowedRoots []string
}
type HTTPToolConfig ¶
type HumanHTTPHandlerConfig ¶ added in v0.1.2
type ImportStudioResult ¶ added in v0.2.0
type ImportStudioResult struct {
ScenarioName string `json:"scenario_name"`
Graph graph.ScenarioGraph `json:"graph"`
}
ImportStudioResult describes a YAML import into an editable Studio graph.
type IncomingEvent ¶ added in v0.1.2
type IncomingEvent = eventrouter.Event
IncomingEvent is an external trigger delivered through webhooks or CLI.
type JWTAlgorithm ¶
type JWTAlgorithm string
const ( JWTAlgorithmHS256 JWTAlgorithm = "HS256" JWTAlgorithmRS256 JWTAlgorithm = "RS256" )
type JWTAuthenticatorConfig ¶
type JWTKey ¶
type JWTKey struct {
ID string
Algorithm JWTAlgorithm
HMACSecret []byte
RSAPublicKeyPEM []byte
}
type JWTMiddlewareConfig ¶
type JWTMiddlewareConfig struct {
Authenticator security.BearerAuthenticator
}
type KnowledgeIndexerConfig ¶
type KnowledgeRegistry ¶ added in v0.1.5
type KnowledgeRegistry struct {
Embedder llm.Embedder
Store knowledge.VectorStore
Reranker knowledge.Reranker
}
KnowledgeRegistry wires scenario knowledge collections to retriever executors.
type LLMProviderRouter ¶
func NewLLMProviderRouter ¶
func NewLLMProviderRouter(routes map[string]llm.Gateway) LLMProviderRouter
NewLLMProviderRouter routes chat/tool/structured/streaming and embedding calls by profile name when the selected route supports the requested capability.
type ListRunCheckpointsResult ¶ added in v0.2.0
type ListRunCheckpointsResult struct {
RunID string `json:"run_id"`
Checkpoints []runstate.CheckpointSummary `json:"checkpoints"`
}
ListRunCheckpointsResult summarizes append-only snapshot revisions for a run.
type ListRunStepsResult ¶ added in v0.2.0
type ListRunStepsResult struct {
RunID string `json:"run_id"`
Version int64 `json:"version"`
Status runstate.RunStatus `json:"status"`
CurrentNodeID string `json:"current_node_id,omitempty"`
PendingHITL *PendingHITLInfo `json:"pending_hitl,omitempty"`
Steps []RunStep `json:"steps"`
}
ListRunStepsResult summarizes checkpointed workflow steps for a run.
type MCPRegistry ¶ added in v0.1.5
MCPRegistry supplies MCP clients for scenario server declarations.
type MCPStdioClient ¶
func NewMCPStdioClient ¶
func NewMCPStdioClient(ctx context.Context, config MCPStdioClientConfig) (MCPStdioClient, error)
NewMCPStdioClient creates an MCP JSON-RPC client over a child process stdio transport.
type MCPStdioClientConfig ¶
type MapBranch ¶ added in v0.2.0
type MapBranch = scenariobuilder.MapBranch
MapBranch configures a map node fan-out branch.
type OIDCJWTAuthenticatorConfig ¶
type OIDCJWTAuthenticatorConfig struct {
Issuer string
Audience string
DiscoveryURL string
JWKSURL string
HTTPClient *http.Client
RefreshInterval time.Duration
Now func() time.Time
Leeway time.Duration
PrincipalType identity.PrincipalType
TenantClaim string
WorkspaceClaim string
ProjectClaim string
RolesClaim string
}
type ObservabilityHTTPHandlerConfig ¶
type ObservabilityHTTPHandlerConfig struct {
Store observability.EventStore
Hub *observability.EventHub
AuthMiddleware func(http.Handler) http.Handler
// Framework enables Studio graph export, step listing, and resume-from-step.
Framework *Framework
// StudioSavePath enables POST /observability/api/studio/save for the configured scenario file.
StudioSavePath string
// TraceExploreURL is an optional trace UI link template, e.g. https://jaeger.example.com/trace/{trace_id}.
TraceExploreURL string
}
type OpenAICompatibleProvider ¶
func NewOpenAICompatibleProvider ¶
func NewOpenAICompatibleProvider(profiles []llm.Profile, client *http.Client) OpenAICompatibleProvider
NewOpenAICompatibleProvider creates a gateway/embedder for OpenAI-compatible APIs.
type OpenTelemetryTracer ¶ added in v0.1.8
type OpenTelemetryTracer = oteladapter.Tracer
OpenTelemetryTracer adapts go.opentelemetry.io/otel/trace.Tracer to observability.Tracer.
type OpenTelemetryTracerProviderConfig ¶ added in v0.1.8
type OpenTelemetryTracerProviderConfig = oteladapter.TracerProviderConfig
OpenTelemetryTracerProviderConfig configures a stdout-exporting TracerProvider for local development.
type Option ¶
type Option func(*options) error
Option customizes Framework construction.
func KnowledgeWiringOptions ¶ added in v0.1.5
func KnowledgeWiringOptions(scenario core.Scenario, registry KnowledgeRegistry) ([]Option, error)
KnowledgeWiringOptions returns Framework options that bind scenario knowledge collections.
func MCPWiringOptions ¶ added in v0.1.5
func MCPWiringOptions(ctx context.Context, scenario core.Scenario, registry MCPRegistry) ([]Option, error)
MCPWiringOptions returns Framework options that wire mcp.tool declarations to MCP servers.
func WireMCPTools ¶ added in v0.1.5
func WireMCPTools(ctx context.Context, scenario core.Scenario, registry MCPRegistry) ([]Option, error)
WireMCPTools binds scenario MCP servers to mcp.tool executors.
func WithAuditSink ¶
WithAuditSink wires an audit sink used for compliance-oriented events.
func WithBlobStore ¶
WithBlobStore wires storage for large step outputs.
func WithCheckpointHistory ¶ added in v0.2.0
func WithCheckpointHistory(history runstate.CheckpointHistory) Option
WithCheckpointHistory wires append-only run snapshot history for time-travel.
func WithCloser ¶ added in v0.1.4
WithCloser registers a function invoked by Framework.Close in LIFO order.
func WithCognitiveMemory ¶ added in v0.1.9
func WithCognitiveMemory(name string, repo memory.CognitiveMemory) Option
WithCognitiveMemory wires a cognitive memory backend by scenario memory name.
func WithDatabase ¶ added in v0.1.4
WithDatabase registers a database handle for automatic close on Framework.Close.
func WithEventSink ¶
WithEventSink wires observability event output.
func WithHITLTokenSecret ¶
WithHITLTokenSecret wires the built-in HMAC-token human gate using the same RunStateRepository as the framework. tokenWriter can be nil.
func WithHITLTokenTTL ¶
WithHITLTokenTTL sets the lifetime for tokens emitted by WithHITLTokenSecret.
func WithHumanGate ¶
WithHumanGate wires a custom human-in-the-loop gate.
func WithJobQueue ¶ added in v0.1.9
WithJobQueue wires an async queue used to enqueue memory.reconcile jobs after tier writes.
func WithLLMGateway ¶
WithLLMGateway wires a provider-neutral LLM gateway.
func WithLogger ¶ added in v0.1.1
WithLogger wires a structured logger that receives warning and error messages from the runtime. If not provided, messages are silently discarded.
func WithMemoryRepository ¶
func WithMemoryRepository(name string, repo memory.Repository) Option
WithMemoryRepository wires a memory backend by scenario memory name.
func WithOutputRedactor ¶
func WithOutputRedactor(redactor governance.OutputRedactor) Option
WithOutputRedactor wires an output redactor that scrubs sensitive fields from step outputs before they are persisted or returned to callers.
func WithRecorder ¶ added in v0.1.1
func WithRecorder(recorder observability.Recorder) Option
WithRecorder wires a metrics recorder. If not provided, metrics are discarded via observability.NoopRecorder.
func WithRequireLLM ¶ added in v0.1.4
func WithRequireLLM() Option
WithRequireLLM makes New fail when no LLM gateway is wired.
func WithRunStateRepository ¶
func WithRunStateRepository(repo runstate.Repository) Option
WithRunStateRepository wires run-state persistence used for pause/resume.
func WithSecurityPolicy ¶
WithSecurityPolicy wires an authorization policy used by runtime execution.
func WithTierColdSummarizer ¶ added in v0.2.0
func WithTierColdSummarizer(name string, summarizer tier.ContentSummarizer) Option
WithTierColdSummarizer wires an LLM summarizer for cold-tier archive on a memory name.
func WithTierColdSummaryIndexer ¶ added in v0.2.0
func WithTierColdSummaryIndexer(name string, indexer tier.ColdSummaryIndexer) Option
WithTierColdSummaryIndexer wires a vector indexer for cold-tier summary recall on a memory name.
func WithTierMemory ¶ added in v0.1.9
WithTierMemory wires a tier manager by scenario memory name.
func WithTierStore ¶ added in v0.1.9
WithTierStore wires a tier store and builds a default manager from policy.
func WithToolExecutor ¶
func WithToolExecutor(name string, executor core.ToolExecutor) Option
WithToolExecutor registers an executable tool implementation by scenario tool name. Agent tool policies still come from the scenario YAML.
func WithToolGovernancePolicy ¶
func WithToolGovernancePolicy(policy governance.ToolPolicy) Option
WithToolGovernancePolicy wires a per-invocation tool governance policy. The policy is evaluated before every tool execution and can deny calls based on side-effect level, call budget, or custom logic.
func WithToolResolver ¶
func WithToolResolver(resolver core.ToolResolver) Option
WithToolResolver wires a resolver that creates or retrieves tool executors only when a declared tool is invoked. Explicit WithToolExecutor registrations take precedence over the resolver.
func WithTracer ¶ added in v0.1.1
func WithTracer(tracer observability.Tracer) Option
WithTracer wires a distributed-tracing provider. If not provided, tracing is a no-op via observability.NoopTracer.
type PendingHITLInfo ¶ added in v0.2.0
type PendingHITLInfo struct {
NodeID string `json:"node_id,omitempty"`
Interrupt bool `json:"interrupt,omitempty"`
}
PendingHITLInfo describes a paused run awaiting HITL approval.
type Plan ¶
type Plan struct {
Scenario core.Scenario
LLMs map[string]llm.Profile
Memory map[string]memory.Namespace
}
Plan is a resolved scenario plan that library users can inspect before creating a Framework.
type PostgresTierWarmStoreConfig ¶ added in v0.1.9
PostgresTierWarmStoreConfig configures a Postgres-backed warm tier store.
type ProductionHTTPHandlerConfig ¶
type ProductionHTTPHandlerConfig struct {
Queue asyncpkg.Queue
Policy security.Policy
Audit audit.Sink
AuthMiddleware func(http.Handler) http.Handler
MetricsHandler http.Handler
IDGenerator func() string
Now func() time.Time
MaxBodyBytes int64
Version string
// Framework enables sync /v1/events and /v1/hitl/resume when set.
Framework *Framework
// StudioSavePath enables POST /v1/studio/save for the configured scenario file.
StudioSavePath string
}
type PrometheusRecorder ¶ added in v0.1.4
type PrometheusRecorder = promrecorder.Recorder
PrometheusRecorder exposes in-process Prometheus text metrics for agentflow runtime signals.
func NewPrometheusRecorder ¶ added in v0.1.4
func NewPrometheusRecorder() *PrometheusRecorder
NewPrometheusRecorder creates a Prometheus-compatible observability recorder.
type RedisLockerConfig ¶
type RetentionHTTPHandlerConfig ¶ added in v0.2.0
type RetentionPolicy ¶ added in v0.1.4
type RetentionPolicy struct {
MaxAge time.Duration
Status runstate.RunStatus
ScenarioName string
Limit int
}
RetentionPolicy controls run-state cleanup.
type RetrieverToolConfig ¶
type RunRequest ¶
type RunRequest = appexec.RunRequest
RunRequest is the input passed to Framework.Run.
type RunStep ¶ added in v0.2.0
type RunStep struct {
NodeID string `json:"node_id"`
Output runstate.StepOutputRef `json:"output"`
}
RunStep describes one persisted workflow step output.
type S3BlobStoreConfig ¶
type SQLToolConfig ¶
type SaveStudioResult ¶ added in v0.2.0
type SaveStudioResult struct {
Path string `json:"path"`
ScenarioName string `json:"scenario_name"`
Graph graph.ScenarioGraph `json:"graph,omitempty"`
}
SaveStudioResult describes a persisted Studio graph write.
type ScenarioBuilder ¶ added in v0.1.10
type ScenarioBuilder = scenariobuilder.ScenarioBuilder
ScenarioBuilder constructs scenarios with a fluent Go API. See pkg/builder for the full surface.
type ScenarioGraph ¶ added in v0.2.0
type ScenarioGraph = graph.ScenarioGraph
ScenarioGraph is a Studio-friendly orchestration topology view.
type StudioHTTPHandlerConfig ¶ added in v0.2.0
type ThreadRunSummary ¶ added in v0.2.0
type ThreadRunSummary struct {
RunID string `json:"run_id"`
ParentRunID string `json:"parent_run_id,omitempty"`
ForkFromVersion int64 `json:"fork_from_version,omitempty"`
ThreadID string `json:"thread_id"`
Status runstate.RunStatus `json:"status"`
ScenarioName string `json:"scenario_name,omitempty"`
}
ThreadRunSummary describes one run in a fork/thread group.
type Ticket ¶ added in v0.1.2
type Ticket = toolticket.Ticket
Ticket is a support ticket record manipulated by the ticket tool.
type TicketStore ¶ added in v0.1.2
type TicketStore = toolticket.Store
TicketStore persists ticket records for the ticket tool executor.
func NewMemoryTicketStore ¶ added in v0.1.2
func NewMemoryTicketStore(seed map[string]Ticket) TicketStore
NewMemoryTicketStore creates an in-memory ticket store for tests and demos.
type TicketToolConfig ¶ added in v0.1.2
type TicketToolConfig struct {
Store toolticket.Store
}
type TierColdSummaryIndexerConfig ¶ added in v0.2.0
type TierColdSummaryIndexerConfig struct {
Embedder llm.Embedder
Store knowledge.VectorStore
Profile string
MemoryName string
}
TierColdSummaryIndexerConfig configures vector indexing for cold-tier summaries.
type ToolResolver ¶
type ToolResolver = core.ToolResolver
type ToolResolverFunc ¶
type ToolResolverFunc = core.ToolResolverFunc
type ValidateStudioResult ¶ added in v0.2.0
type ValidateStudioResult struct {
Valid bool `json:"valid"`
Error string `json:"error,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
Scenario string `json:"scenario_name"`
}
ValidateStudioResult reports graph/scenario validation output for Studio.
type WebhookHTTPHandlerConfig ¶ added in v0.1.2
type WiringOptions ¶ added in v0.1.4
WiringOptions controls ValidateWiring and optional New-time checks.
type WorkflowBuilder ¶ added in v0.1.10
type WorkflowBuilder = scenariobuilder.WorkflowBuilder
WorkflowBuilder constructs workflow graphs with a fluent Go API.
Source Files
¶
- api.go
- async.go
- audit.go
- blob_gc.go
- builder.go
- catalog.go
- checkpoint.go
- coordination.go
- eventrouter.go
- framework.go
- framework_checkpoint.go
- framework_continue.go
- framework_event.go
- framework_graph.go
- framework_hydrate.go
- framework_studio.go
- knowledge.go
- knowledge_wiring.go
- lifecycle.go
- mcp.go
- mcp_wiring.go
- mock_gateway.go
- observability.go
- observability_studio.go
- providers.go
- retention.go
- retention_http.go
- schema.go
- security.go
- storage.go
- studio.go
- tier_memory.go
- tools.go
- version.go
- wiring.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
go/builder
command
|
|
|
go/event-trigger
command
|
|
|
go/hitl-resume
command
|
|
|
go/http-worker
command
|
|
|
go/minimal
command
|
|
|
go/postgres
command
|
|
|
go/scenario
Package scenario provides builder stacks shared by examples/go programs.
|
Package scenario provides builder stacks shared by examples/go programs. |
|
go/tier-memory
command
|
|
|
go/tier-worker
command
tier-worker runs the tier-memory builder stack with Postgres warm tier, file or blob cold tier, and async memory.reconcile jobs via a shared job queue.
|
tier-worker runs the tier-memory builder stack with Postgres warm tier, file or blob cold tier, and async memory.reconcile jobs via a shared job queue. |
|
go/validate
command
|
|
|
internal
|
|
|
pkg
|
|
|
builder
Package builder is the **primary** way to construct core.Scenario values for agentflow-go.
|
Package builder is the **primary** way to construct core.Scenario values for agentflow-go. |
|
testutil
Package testutil provides helpers for testing applications built on agentflow.
|
Package testutil provides helpers for testing applications built on agentflow. |
|
Package schemas embeds machine-readable configuration schemas for AgentFlow.
|
Package schemas embeds machine-readable configuration schemas for AgentFlow. |