builder

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package builder is the **primary** way to construct core.Scenario values for agentflow-go. Built scenarios should be validated with agentflow.ValidateScenario before creating a Framework.

For the common mock/session/echo autonomous stack:

scenario := builder.MinimalAutonomous("assistant")

Example stacks aligned with ExampleCatalog() IDs:

scenario := builder.MinimalTicketHandling("support")
scenario := builder.MinimalRAG("assistant")
scenario := builder.TierMemoryAutonomous("assistant")
scenario := builder.AdaptiveRAG("assistant")
scenario := builder.CorrectiveRAG("assistant")
scenario := builder.SelfRAG("assistant")
scenario := builder.HybridResearch("analyst")
scenario := builder.MinimalHumanInLoop("assistant")
scenario := builder.MinimalDeclarativeInterrupt()
scenario := builder.MultiExpertResearch()
scenario := builder.CodeReviewPipeline()
scenario := builder.WorkflowEnhancements()
scenario := builder.ContextGovernance("assistant")
scenario := builder.MinimalFixedWorkflowReview("reviewer")
scenario := builder.MinimalHTTPTool("assistant")
scenario := builder.MinimalSQLTool("assistant")
scenario := builder.MinimalFilesystemTool("assistant")
scenario := builder.MinimalMCPTool("assistant")

Validate all stacks: go run ./examples/go/validate -kind builder all

Full reference: docs/builder-reference.md

For explicit control with named constants instead of string literals:

scenario := builder.New("my-app").
    DefaultMockLLM().
    SessionMemory().
    EchoTool().
    Agent("assistant").DefaultLLM().EchoTool().Autonomous().
    Scenario()

Index

Constants

View Source
const (
	NameDefaultLLM              = "default"
	NamePrimaryLLM              = "primary"
	NameChatLLM                 = "chat"
	NameEmbedLLM                = "embed"
	NameSessionMemory           = "session"
	NameEchoTool                = "echo"
	NameRepoSearch              = "repo_search"
	NameGitTool                 = "git"
	NameTicketTool              = "ticket"
	NameSQLTool                 = "sql"
	NameFilesystemTool          = "filesystem"
	NameHTTPTool                = "http"
	NameHTTPToolStatus          = "http.status"
	NameSQLQueryTool            = "sql.query"
	NameFilesystemReadTool      = "fs.read"
	NameMCPSearchTool           = "docs.search"
	NameMCPServerDocs           = "docs"
	NameKnowledgeRetrieveTool   = "knowledge.retrieve"
	NameKnowledgeCollectionDocs = "docs"
	NameExpertMacro             = "macro"
	NameExpertIndustry          = "industry"
	NameExpertFinance           = "finance"
	NameLeadAuthor              = "lead_author"
	NameReviewerLLM             = "reviewer"
	NameReviewerSecurity        = "security"
	NameReviewerStyle           = "style"
	NamePlannerLLM              = "planner"
	NameStatusTool              = "status"
	NameWorkflowReviewer        = "reviewer"
)

Conventional scenario resource names used across examples and tests.

View Source
const (
	MemoryTypeInMemory = "in_memory"
	MemoryTypeFile     = "file"
	MemoryTypeCustom   = "custom"
)

Memory backend types accepted by scenario YAML.

View Source
const (
	MemoryScopeConversation = string(memory.ScopeConversation)
	MemoryScopeSession      = string(memory.ScopeSession)
	MemoryScopeLongTerm     = string(memory.ScopeLongTerm)
	MemoryScopeAudit        = string(memory.ScopeAudit)
)

Memory scopes accepted by scenario YAML.

View Source
const (
	LLMProviderMock         = "mock"
	LLMProviderOpenAICompat = "openai-compatible"
	LLMProviderAnthropic    = "anthropic"
	LLMProviderOpenAI       = "openai"
	LLMModelMockTest        = "test"
)

LLM provider names commonly used in scenarios.

View Source
const (
	ToolTypeEcho               = "builtin.echo"
	ToolTypeRepoSearch         = "builtin.repo_search"
	ToolTypeGit                = "builtin.git"
	ToolTypeTicket             = "builtin.ticket"
	ToolTypeFilesystem         = "builtin.filesystem"
	ToolTypeHTTP               = "builtin.http"
	ToolTypeHTTPClient         = "http.client"
	ToolTypeSQL                = "builtin.sql"
	ToolTypeKnowledgeRetriever = "knowledge.retriever"
	ToolTypeMCPTool            = "mcp.tool"
)

Builtin and declared tool types accepted by scenario YAML.

View Source
const (
	MCPTransportHTTP        = "http"
	MCPTransportStdio       = "stdio"
	MCPServerURLDocsDefault = "http://127.0.0.1:3333/mcp"
	MCPToolPrefixDocs       = "docs"
	MCPMetadataServer       = "mcp_server"
	MCPMetadataTool         = "mcp_tool"
	MCPToolSearch           = "search"
)

MCP transport and metadata keys used in examples.

View Source
const (
	RateCapHTTPToolDefault       = 5
	RateCapSQLToolDefault        = 5
	RateCapFilesystemToolDefault = 10
)

Default tool rate caps from examples.

View Source
const (
	LLMCapChat             = "chat"
	LLMCapToolCall         = "tool_call"
	LLMCapStructuredOutput = "structured_output"
	LLMCapStream           = "stream"
	LLMCapEmbed            = "embed"
)

LLM capability strings accepted by scenario YAML.

View Source
const (
	KnowledgeSearchModeVector = "vector"
	KnowledgeSearchModeHybrid = "hybrid"
)

Knowledge search modes accepted by scenario YAML.

View Source
const (
	TriggerPathTicketSummary = "body.summary"
	TriggerPathTicketBody    = "body"
	TriggerPathTicketID      = "body.ticket_id"
)

Common JSONPath fields for trigger payload mapping.

View Source
const (
	ContextStrategySlidingWindowWithSummary = string(contextwindow.StrategySlidingWindowWithSummary)
	ContextSummaryModeLLM                   = "llm"
)

Context governance strategy strings accepted by scenario YAML.

View Source
const (
	ConditionRouteToRAG       = `eq(steps.route.output.route, "rag")`
	ConditionGradeNotRelevant = `eq(steps.grade.output.relevant, false)`
	RAGRetrieveLimitDefault   = 5
	RAGGradeMinScoreDefault   = 0.35
)

Common RAG workflow conditions.

View Source
const (
	ParallelOnErrorCollectErrors = "collect_errors"
	ParallelOnErrorFailFast      = "fail_fast"
)

Parallel group on_error strategies accepted by scenario YAML.

View Source
const (
	RuntimeSecretAPIKey         = "api_key"
	RuntimeSecretAPIKeyDevValue = "dev-secret-value"
)

Runtime secret keys used in examples.

View Source
const (
	LLMEnvRealModelAPIKey        = "AGENT_REALMODEL_API_KEY"
	LLMModelQwen35B              = "qwen/qwen3.6-35b-a3b"
	LLMEndpointLocalOpenAICompat = "http://127.0.0.1:1234/v1"
)

Context governance LLM defaults for catalog ID context-governance.

View Source
const (
	ApprovalNever  = core.ApprovalNever
	ApprovalRisky  = core.ApprovalRisky
	ApprovalAlways = core.ApprovalAlways
	ApprovalPause  = core.ApprovalPause

	SideEffectNone      = core.SideEffectNone
	SideEffectRead      = core.SideEffectRead
	SideEffectWrite     = core.SideEffectWrite
	SideEffectExternal  = core.SideEffectExternal
	SideEffectDangerous = core.SideEffectDangerous

	ModeAutonomous    = core.OrchestrationAutonomous
	ModeFixedWorkflow = core.OrchestrationFixedWorkflow
	ModeHybrid        = core.OrchestrationHybrid

	NodeAgent         = core.NodeAgent
	NodeTool          = core.NodeTool
	NodeSkill         = core.NodeSkill
	NodeHumanGate     = core.NodeHumanGate
	NodeTransform     = core.NodeTransform
	NodeParallelGroup = core.NodeParallelGroup
	NodeLoop          = core.NodeLoop
	NodeQueryRouter   = core.NodeQueryRouter
	NodeRAGGrade      = core.NodeRAGGrade
	NodeSupervisor    = core.NodeSupervisor
	NodeSubgraph      = core.NodeSubgraph
	NodeMap           = core.NodeMap
)

Re-export typed enums from core so builder callers avoid importing two packages for the same approval, side-effect, and orchestration constants.

View Source
const (
	CheckpointBeforeFinalAnswer = "before_final_answer"
)

Human-in-the-loop checkpoint names used by runtime.

View Source
const (
	ConditionStatusReady = `eq(steps.status.output.message, "ready")`
)

Common workflow edge conditions.

View Source
const (
	EventTicketCreated = "ticket.created"
)

Common trigger event types from examples.

Variables

This section is empty.

Functions

func AdaptiveRAG

func AdaptiveRAG(agentName string, opts ...MinimalOption) core.Scenario

AdaptiveRAG builds the adaptive RAG workflow for catalog ID adaptive-rag.

func AdaptiveRAGWorkflow

func AdaptiveRAGWorkflow(namespace, agentName string) core.Workflow

AdaptiveRAGWorkflow builds the query_router → retrieve → answer graph from catalog ID adaptive-rag.

func CodeReviewPipeline

func CodeReviewPipeline(opts ...MinimalOption) core.Scenario

CodeReviewPipeline builds the code review workflow for catalog ID code-review-pipeline.

func CodeReviewPipelineWorkflow

func CodeReviewPipelineWorkflow(gitTool string, reviewerAgents ...string) core.Workflow

CodeReviewPipelineWorkflow builds the diff → reviews → merge → approve graph for catalog ID code-review-pipeline.

func ConditionEq added in v0.2.1

func ConditionEq(path string, value any) string

ConditionEq returns eq(path, value) for workflow edge/node conditions.

func ConditionExists added in v0.2.1

func ConditionExists(path string) string

ConditionExists returns exists(path) when a step field must be present.

func ConditionMissing added in v0.2.1

func ConditionMissing(path string) string

ConditionMissing returns missing(path) when a step field must be absent.

func ConditionNe added in v0.2.1

func ConditionNe(path string, value any) string

ConditionNe returns ne(path, value) for workflow edge/node conditions.

func ContextGovernance

func ContextGovernance(agentName string, opts ...MinimalOption) core.Scenario

ContextGovernance builds the context governance demo for catalog ID context-governance.

func CorrectiveRAG

func CorrectiveRAG(agentName string, opts ...MinimalOption) core.Scenario

CorrectiveRAG builds the corrective-rag workflow for catalog ID corrective-rag.

func CorrectiveRAGWorkflow

func CorrectiveRAGWorkflow(namespace, agentName string) core.Workflow

CorrectiveRAGWorkflow builds the route → retrieve → grade → rewrite → answer graph for catalog ID corrective-rag.

func DeclarativeInterruptWorkflow added in v0.2.0

func DeclarativeInterruptWorkflow() core.Workflow

DeclarativeInterruptWorkflow builds prepare → interrupt → continue for catalog ID declarative-interrupt.

func FixedWorkflowReviewWorkflow

func FixedWorkflowReviewWorkflow(toolRef, agentRef string) core.Workflow

FixedWorkflowReviewWorkflow builds the inspect → review graph from catalog ID fixed-workflow-review.

func HybridResearch

func HybridResearch(agentName string, opts ...MinimalOption) core.Scenario

HybridResearch builds the hybrid research stack for catalog ID hybrid-research.

func HybridResearchWorkflow

func HybridResearchWorkflow(toolRef string) core.Workflow

HybridResearchWorkflow builds the initial_search tool phase for catalog ID hybrid-research.

func InterruptNode added in v0.2.0

func InterruptNode(node core.WorkflowNode) core.WorkflowNode

InterruptNode returns node with Interrupt enabled.

func MapNodeInput added in v0.2.0

func MapNodeInput(itemsPath string, branch MapBranch, opts ...MapNodeOption) json.RawMessage

MapNodeInput builds JSON input for a map workflow node.

func MinimalAutonomous

func MinimalAutonomous(agentName string, opts ...MinimalOption) core.Scenario

MinimalAutonomous builds the common mock LLM + session memory + one tool + single-agent autonomous stack used across examples.

func MinimalDeclarativeInterrupt added in v0.2.0

func MinimalDeclarativeInterrupt(opts ...MinimalOption) core.Scenario

MinimalDeclarativeInterrupt builds the declarative interrupt demo for catalog ID declarative-interrupt.

func MinimalFilesystemTool

func MinimalFilesystemTool(agentName string, opts ...MinimalOption) core.Scenario

MinimalFilesystemTool builds the filesystem tool example for catalog ID filesystem-tool.

func MinimalFixedWorkflowReview

func MinimalFixedWorkflowReview(agentName string, opts ...MinimalOption) core.Scenario

MinimalFixedWorkflowReview builds the fixed workflow review stack for catalog ID fixed-workflow-review.

func MinimalHTTPTool

func MinimalHTTPTool(agentName string, opts ...MinimalOption) core.Scenario

MinimalHTTPTool builds the http tool example for catalog ID http-tool.

func MinimalHumanInLoop

func MinimalHumanInLoop(agentName string, opts ...MinimalOption) core.Scenario

MinimalHumanInLoop builds the human-in-loop demo for catalog ID human-in-loop.

func MinimalMCPTool

func MinimalMCPTool(agentName string, opts ...MinimalOption) core.Scenario

MinimalMCPTool builds the MCP tool example for catalog ID mcp-tool.

func MinimalRAG

func MinimalRAG(agentName string, opts ...MinimalOption) core.Scenario

MinimalRAG builds the rag-knowledge stack for catalog ID rag-knowledge.

func MinimalSQLTool

func MinimalSQLTool(agentName string, opts ...MinimalOption) core.Scenario

MinimalSQLTool builds the sql tool example for catalog ID sql-tool.

func MinimalTicketHandling

func MinimalTicketHandling(agentName string, opts ...MinimalOption) core.Scenario

MinimalTicketHandling builds the ticket-handling stack for catalog ID ticket-handling.

func MultiExpertResearch

func MultiExpertResearch(opts ...MinimalOption) core.Scenario

MultiExpertResearch builds the multi-expert hybrid stack for catalog ID multi-expert-research.

func MultiExpertResearchWorkflow

func MultiExpertResearchWorkflow(expertAgents ...string) core.Workflow

MultiExpertResearchWorkflow builds the parallel expert phase from catalog ID multi-expert-research.

func SelfRAG

func SelfRAG(agentName string, opts ...MinimalOption) core.Scenario

SelfRAG builds the self-rag workflow for catalog ID self-rag.

func SelfRAGWorkflow

func SelfRAGWorkflow(namespace, agentName string) core.Workflow

SelfRAGWorkflow builds the retrieve → grade → answer graph for catalog ID self-rag.

func StepPath added in v0.2.1

func StepPath(nodeID string, fields ...string) string

StepPath builds a workflow expression path: steps.<nodeID>.<fields...>.

func TierMemoryAutonomous

func TierMemoryAutonomous(agentName string, opts ...MinimalOption) core.Scenario

TierMemoryAutonomous builds the tier-memory demo for catalog ID tier-memory.

func ValidateCatalogEntry

func ValidateCatalogEntry(entry CatalogEntry) error

ValidateCatalogEntry validates a catalog stack with the scenario validator.

func WorkflowEnhancements

func WorkflowEnhancements(opts ...MinimalOption) core.Scenario

WorkflowEnhancements builds the workflow enhancements demo for catalog ID workflow-enhancements.

func WorkflowEnhancementsWorkflow

func WorkflowEnhancementsWorkflow() core.Workflow

WorkflowEnhancementsWorkflow builds the status → ready_branch → experts graph for catalog ID workflow-enhancements.

Types

type AgentBuilder

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

AgentBuilder configures a single agent.

func (*AgentBuilder) Autonomous

func (ab *AgentBuilder) Autonomous() *ScenarioBuilder

Autonomous commits the agent and sets autonomous orchestration mode.

func (*AgentBuilder) BeforeFinalAnswerCheckpoint

func (ab *AgentBuilder) BeforeFinalAnswerCheckpoint() *AgentBuilder

BeforeFinalAnswerCheckpoint appends the before_final_answer checkpoint.

func (*AgentBuilder) BuiltinHTTPTool

func (ab *AgentBuilder) BuiltinHTTPTool() *AgentBuilder

BuiltinHTTPTool appends NameHTTPTool to the agent tool list.

func (*AgentBuilder) ChatLLM

func (ab *AgentBuilder) ChatLLM() *AgentBuilder

ChatLLM wires the agent to NameChatLLM.

func (*AgentBuilder) DefaultLLM

func (ab *AgentBuilder) DefaultLLM() *AgentBuilder

DefaultLLM wires the agent to NameDefaultLLM.

func (*AgentBuilder) Description

func (ab *AgentBuilder) Description(desc string) *AgentBuilder

Description sets the agent description.

func (*AgentBuilder) Done

func (ab *AgentBuilder) Done() *ScenarioBuilder

Done commits the agent and returns the parent scenario builder.

func (*AgentBuilder) EchoTool

func (ab *AgentBuilder) EchoTool() *AgentBuilder

EchoTool appends NameEchoTool to the agent tool list.

func (*AgentBuilder) FilesystemReadTool

func (ab *AgentBuilder) FilesystemReadTool() *AgentBuilder

FilesystemReadTool wires fs.read on the agent.

func (*AgentBuilder) FilesystemTool

func (ab *AgentBuilder) FilesystemTool() *AgentBuilder

FilesystemTool appends NameFilesystemTool to the agent tool list.

func (*AgentBuilder) FixedWorkflow

func (ab *AgentBuilder) FixedWorkflow(wf core.Workflow) *ScenarioBuilder

FixedWorkflow commits the agent and sets fixed_workflow mode.

func (*AgentBuilder) GitTool

func (ab *AgentBuilder) GitTool() *AgentBuilder

GitTool appends NameGitTool to the agent tool list.

func (*AgentBuilder) HTTPToolStatus

func (ab *AgentBuilder) HTTPToolStatus() *AgentBuilder

HTTPToolStatus wires http.status on the agent.

func (*AgentBuilder) HumanCheckpoint

func (ab *AgentBuilder) HumanCheckpoint(name string) *AgentBuilder

HumanCheckpoint appends a human checkpoint name.

func (*AgentBuilder) Hybrid

func (ab *AgentBuilder) Hybrid(wf core.Workflow) *ScenarioBuilder

Hybrid commits the agent and sets hybrid mode.

func (*AgentBuilder) Instructions

func (ab *AgentBuilder) Instructions(text string) *AgentBuilder

Instructions sets agent instructions.

func (*AgentBuilder) KnowledgeRetrieveTool

func (ab *AgentBuilder) KnowledgeRetrieveTool() *AgentBuilder

KnowledgeRetrieveTool appends the knowledge retriever tool reference.

func (*AgentBuilder) LLM

func (ab *AgentBuilder) LLM(ref string) *AgentBuilder

LLM sets the LLM profile reference.

func (*AgentBuilder) MCPSearchTool

func (ab *AgentBuilder) MCPSearchTool() *AgentBuilder

MCPSearchTool wires docs.search on the agent.

func (*AgentBuilder) MaxSteps

func (ab *AgentBuilder) MaxSteps(n int) *AgentBuilder

MaxSteps sets the agent max_steps policy.

func (*AgentBuilder) Memory

func (ab *AgentBuilder) Memory(ref string) *AgentBuilder

Memory sets the memory reference.

func (*AgentBuilder) Metadata

func (ab *AgentBuilder) Metadata(key, value string) *AgentBuilder

Metadata sets agent metadata.

func (*AgentBuilder) Orchestration

func (ab *AgentBuilder) Orchestration(opts ...OrchestrationOption) *ScenarioBuilder

Orchestration commits the agent and applies orchestration options.

func (*AgentBuilder) OutputSchema

func (ab *AgentBuilder) OutputSchema(schema json.RawMessage) *AgentBuilder

OutputSchema sets the agent output JSON schema.

func (*AgentBuilder) PlannerLLM

func (ab *AgentBuilder) PlannerLLM() *AgentBuilder

PlannerLLM wires the agent to NamePlannerLLM.

func (*AgentBuilder) PrimaryLLM

func (ab *AgentBuilder) PrimaryLLM() *AgentBuilder

PrimaryLLM wires the agent to NamePrimaryLLM.

func (*AgentBuilder) RepoSearchTool

func (ab *AgentBuilder) RepoSearchTool() *AgentBuilder

RepoSearchTool appends NameRepoSearch to the agent tool list.

func (*AgentBuilder) RetryLimit

func (ab *AgentBuilder) RetryLimit(n int) *AgentBuilder

RetryLimit sets the agent retry_limit policy.

func (*AgentBuilder) ReviewerLLM

func (ab *AgentBuilder) ReviewerLLM() *AgentBuilder

ReviewerLLM wires the agent to NameReviewerLLM.

func (*AgentBuilder) Role

func (ab *AgentBuilder) Role(role string) *AgentBuilder

Role sets the agent role.

func (*AgentBuilder) SQLQueryTool

func (ab *AgentBuilder) SQLQueryTool() *AgentBuilder

SQLQueryTool wires sql.query on the agent.

func (*AgentBuilder) SQLTool

func (ab *AgentBuilder) SQLTool() *AgentBuilder

SQLTool appends NameSQLTool to the agent tool list.

func (*AgentBuilder) Scenario

func (ab *AgentBuilder) Scenario() core.Scenario

Scenario commits the agent and returns the built scenario.

func (*AgentBuilder) SessionMemory

func (ab *AgentBuilder) SessionMemory() *AgentBuilder

SessionMemory wires the agent to NameSessionMemory.

func (*AgentBuilder) Skill

func (ab *AgentBuilder) Skill(name string) *AgentBuilder

Skill appends a skill reference.

func (*AgentBuilder) Skills

func (ab *AgentBuilder) Skills(names ...string) *AgentBuilder

Skills replaces the skill list.

func (*AgentBuilder) StandardAgent

func (ab *AgentBuilder) StandardAgent() *AgentBuilder

StandardAgent wires DefaultLLM and SessionMemory on the agent.

func (*AgentBuilder) SubAgent

func (ab *AgentBuilder) SubAgent(name string) *AgentBuilder

SubAgent appends a sub-agent reference.

func (*AgentBuilder) TicketTool

func (ab *AgentBuilder) TicketTool() *AgentBuilder

TicketTool appends NameTicketTool to the agent tool list.

func (*AgentBuilder) Timeout

func (ab *AgentBuilder) Timeout(d time.Duration) *AgentBuilder

Timeout sets the agent timeout policy.

func (*AgentBuilder) Tool

func (ab *AgentBuilder) Tool(name string) *AgentBuilder

Tool appends a tool reference.

func (*AgentBuilder) Tools

func (ab *AgentBuilder) Tools(names ...string) *AgentBuilder

Tools replaces the tool list.

type CatalogEntry

type CatalogEntry struct {
	ID    string
	Build func() core.Scenario
}

CatalogEntry describes a builder stack in ExampleCatalog.

func ExampleCatalog

func ExampleCatalog() []CatalogEntry

ExampleCatalog returns the standard builder stacks used in docs and examples.

func FindCatalogEntry

func FindCatalogEntry(entries []CatalogEntry, target string) (CatalogEntry, bool)

FindCatalogEntry resolves a catalog id.

type KnowledgeCollectionOption

type KnowledgeCollectionOption func(*core.KnowledgeCollection)

KnowledgeCollectionOption configures a knowledge collection.

func CollectionAgents

func CollectionAgents(agents ...string) KnowledgeCollectionOption

CollectionAgents restricts bound agents.

func CollectionEmbedProfile

func CollectionEmbedProfile(profile string) KnowledgeCollectionOption

CollectionEmbedProfile sets the embed LLM profile reference.

func CollectionName

func CollectionName(name string) KnowledgeCollectionOption

CollectionName sets the collection name.

func CollectionNamespace

func CollectionNamespace(namespace string) KnowledgeCollectionOption

CollectionNamespace sets the vector namespace.

func CollectionSearchMode

func CollectionSearchMode(mode string) KnowledgeCollectionOption

CollectionSearchMode sets vector or hybrid search.

func CollectionTenantScoped

func CollectionTenantScoped(enabled bool) KnowledgeCollectionOption

CollectionTenantScoped marks the collection tenant scoped.

func CollectionTool

func CollectionTool(tool string) KnowledgeCollectionOption

CollectionTool sets the bound retriever tool name.

func DocsKnowledgeCollectionPreset

func DocsKnowledgeCollectionPreset() KnowledgeCollectionOption

DocsKnowledgeCollectionPreset configures the conventional docs collection.

type LLMOption

type LLMOption func(*core.LLMProfileRef)

LLMOption configures an LLM profile reference.

func ChatCapabilities

func ChatCapabilities() LLMOption

ChatCapabilities sets chat and tool_call capabilities.

func ContextGovernanceLLM

func ContextGovernanceLLM() LLMOption

ContextGovernanceLLM configures the openai-compatible profile from catalog ID context-governance.

func EmbedCapabilities

func EmbedCapabilities() LLMOption

EmbedCapabilities sets embed capability.

func LLMAPIKeyEnv

func LLMAPIKeyEnv(name string) LLMOption

LLMAPIKeyEnv sets the environment variable name for the API key.

func LLMCapabilities

func LLMCapabilities(caps ...string) LLMOption

LLMCapabilities sets declared LLM capabilities.

func LLMContext

func LLMContext(policy contextwindow.Policy) LLMOption

LLMContext sets context window governance on an LLM profile.

func LLMEndpoint

func LLMEndpoint(url string) LLMOption

LLMEndpoint sets a custom endpoint URL.

func LLMModel

func LLMModel(model string) LLMOption

LLMModel sets the model name.

func LLMProvider

func LLMProvider(name string) LLMOption

LLMProvider sets the LLM provider name.

func LLMTemperature

func LLMTemperature(v float32) LLMOption

LLMTemperature sets sampling temperature.

func MockChatLLM

func MockChatLLM(model string) LLMOption

MockChatLLM configures a mock chat LLM profile.

func MockEmbedLLM

func MockEmbedLLM(model string) LLMOption

MockEmbedLLM configures a mock embed LLM profile.

func MockLLM

func MockLLM() LLMOption

MockLLM configures a mock provider profile for local runs and tests.

func MockToolLLM

func MockToolLLM() LLMOption

MockToolLLM configures mock LLM with chat and tool_call capabilities.

func Provider

func Provider(provider, model string) LLMOption

Provider sets provider and model in one call.

func SelfRAGChatContext

func SelfRAGChatContext() LLMOption

SelfRAGChatContext configures sliding_window_with_summary governance for SelfRAG stacks.

func SelfRAGChatMockLLM

func SelfRAGChatMockLLM(model string) LLMOption

SelfRAGChatMockLLM configures the self_rag chat profile with context governance.

type MCPServerOption

type MCPServerOption func(*core.MCPServer)

MCPServerOption configures an MCP server declaration.

func DocsMCPServerPreset

func DocsMCPServerPreset() []MCPServerOption

DocsMCPServerPreset configures the docs MCP server for catalog ID mcp-tool.

func MCPServerName

func MCPServerName(name string) MCPServerOption

MCPServerName sets the MCP server name.

func MCPServerToolPrefix

func MCPServerToolPrefix(prefix string) MCPServerOption

MCPServerToolPrefix sets the MCP tool prefix.

func MCPServerTransport

func MCPServerTransport(transport string) MCPServerOption

MCPServerTransport sets the MCP transport.

func MCPServerURL

func MCPServerURL(url string) MCPServerOption

MCPServerURL sets the MCP HTTP URL.

type MapBranch added in v0.2.0

type MapBranch struct {
	Kind  core.WorkflowNodeKind `json:"kind"`
	Ref   string                `json:"ref,omitempty"`
	Input json.RawMessage       `json:"input,omitempty"`
}

MapBranch describes the per-item branch executed by a map node.

func MapAgentBranch added in v0.2.1

func MapAgentBranch(agentRef string) MapBranch

MapAgentBranch configures a map fan-out branch that runs an agent node ref.

func MapSubgraphBranch added in v0.2.1

func MapSubgraphBranch(subgraphRef string) MapBranch

MapSubgraphBranch configures a map fan-out branch that runs a named subgraph.

func MapToolBranch added in v0.2.1

func MapToolBranch(toolRef string) MapBranch

MapToolBranch configures a map fan-out branch that runs a tool node ref.

func MapTransformBranch added in v0.2.1

func MapTransformBranch(input []byte) MapBranch

MapTransformBranch configures a map fan-out branch with a transform input payload.

type MapNodeOption added in v0.2.0

type MapNodeOption func(*mapNodeSpec)

MapNodeOption configures optional map node input fields.

func MapItemField added in v0.2.0

func MapItemField(field string) MapNodeOption

MapItemField overrides the injected item field name (default item).

func MapOnError added in v0.2.0

func MapOnError(mode string) MapNodeOption

MapOnError sets map node on_error (for example collect_errors).

type MemoryOption

type MemoryOption func(*core.MemoryRef)

MemoryOption configures a memory reference.

func CustomMemory

func CustomMemory(scope string) MemoryOption

CustomMemory configures a custom memory backend reference.

func InMemoryMemory

func InMemoryMemory(scope string) MemoryOption

InMemoryMemory configures an in_memory memory with the given scope.

func MemoryNamespace

func MemoryNamespace(ns string) MemoryOption

MemoryNamespace sets the memory namespace.

func SessionInMemory

func SessionInMemory() MemoryOption

SessionInMemory configures in_memory memory scoped to session.

func TierSessionMemory

func TierSessionMemory(namespace string, opts ...TierMemoryOption) MemoryOption

TierSessionMemory configures custom tiered session memory.

type MinimalOption

type MinimalOption func(*minimalConfig)

MinimalOption configures MinimalAutonomous.

func MinimalEcho

func MinimalEcho() MinimalOption

MinimalEcho keeps echo as the only tool. This is the default.

func MinimalInstructions

func MinimalInstructions(text string) MinimalOption

MinimalInstructions sets agent instructions.

func MinimalRepoSearch

func MinimalRepoSearch() MinimalOption

MinimalRepoSearch uses repo_search instead of echo.

func MinimalScenarioName

func MinimalScenarioName(name string) MinimalOption

MinimalScenarioName sets the scenario name.

type OrchestrationOption

type OrchestrationOption func(*core.Orchestration)

OrchestrationOption configures orchestration policy.

func HumanInLoop

func HumanInLoop(enabled bool, checkpoints ...string) OrchestrationOption

HumanInLoop enables or disables human-in-the-loop orchestration.

func MaxParallel

func MaxParallel(n int) OrchestrationOption

MaxParallel sets orchestration max_parallel.

func Mode

Mode sets orchestration mode explicitly.

func Planning

func Planning(enabled bool, opts ...PlanningOption) OrchestrationOption

Planning enables planning with optional configuration.

func Workflow

func Workflow(wf core.Workflow) OrchestrationOption

Workflow sets the orchestration workflow graph.

type PlanningOption

type PlanningOption func(*core.PlanningPolicy)

PlanningOption configures planning policy fields.

func PlanningAgent

func PlanningAgent(agent string) PlanningOption

PlanningAgent sets the dedicated planning agent.

func PlanningExecute

func PlanningExecute(enabled bool) PlanningOption

PlanningExecute enables plan step tracking during the tool loop.

func PlanningMaxSteps

func PlanningMaxSteps(n int) PlanningOption

PlanningMaxSteps sets planning max_steps.

type RuntimeOption

type RuntimeOption func(*core.RuntimePolicy)

RuntimeOption configures runtime policy.

func RuntimeMaxRetries

func RuntimeMaxRetries(n int) RuntimeOption

RuntimeMaxRetries sets the global max_retries.

func RuntimeMaxSteps

func RuntimeMaxSteps(n int) RuntimeOption

RuntimeMaxSteps sets the global max_steps.

func RuntimeSecret

func RuntimeSecret(key, value string) RuntimeOption

RuntimeSecret sets a runtime secret value.

func RuntimeTimeout

func RuntimeTimeout(d time.Duration) RuntimeOption

RuntimeTimeout sets the global runtime timeout.

type ScenarioBuilder

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

ScenarioBuilder constructs a core.Scenario with a fluent API. Call Scenario() to obtain the result, then validate with agentflow.ValidateScenario.

func New

func New(name string) *ScenarioBuilder

New creates a scenario builder with the given name.

func NewMinimal

func NewMinimal(scenarioName string) *ScenarioBuilder

NewMinimal starts a scenario with the standard mock/session stack. Register tools, then call MinimalAgent or configure agents manually.

func (*ScenarioBuilder) Agent

func (b *ScenarioBuilder) Agent(name string) *AgentBuilder

Agent starts configuring an agent. Chain agent options, then call another ScenarioBuilder method or Scenario() to register it.

func (*ScenarioBuilder) Autonomous

func (b *ScenarioBuilder) Autonomous() *ScenarioBuilder

Autonomous sets orchestration mode to autonomous.

func (*ScenarioBuilder) BeforeFinalAnswerHITL

func (b *ScenarioBuilder) BeforeFinalAnswerHITL() *ScenarioBuilder

BeforeFinalAnswerHITL enables before_final_answer human approval.

func (*ScenarioBuilder) BuiltinHTTPTool

func (b *ScenarioBuilder) BuiltinHTTPTool() *ToolBuilder

BuiltinHTTPTool registers the conventional builtin http tool declaration.

func (*ScenarioBuilder) ChatMockLLM

func (b *ScenarioBuilder) ChatMockLLM(model string) *ScenarioBuilder

ChatMockLLM registers the conventional chat LLM profile.

func (*ScenarioBuilder) ContextGovernanceLLM

func (b *ScenarioBuilder) ContextGovernanceLLM() *ScenarioBuilder

ContextGovernanceLLM registers the context governance demo LLM profile.

func (*ScenarioBuilder) DefaultMockLLM

func (b *ScenarioBuilder) DefaultMockLLM() *ScenarioBuilder

DefaultMockLLM registers the conventional default mock LLM profile.

func (*ScenarioBuilder) DefaultMockToolLLM

func (b *ScenarioBuilder) DefaultMockToolLLM() *ScenarioBuilder

DefaultMockToolLLM registers mock LLM with chat and tool_call capabilities.

func (*ScenarioBuilder) Description

func (b *ScenarioBuilder) Description(desc string) *ScenarioBuilder

Description sets the scenario description.

func (*ScenarioBuilder) DocsKnowledgeCollection

func (b *ScenarioBuilder) DocsKnowledgeCollection(opts ...KnowledgeCollectionOption) *ScenarioBuilder

DocsKnowledgeCollection registers the docs knowledge collection.

func (*ScenarioBuilder) DocsMCPServer

func (b *ScenarioBuilder) DocsMCPServer() *ScenarioBuilder

DocsMCPServer registers the conventional docs MCP server.

func (*ScenarioBuilder) EchoTool

func (b *ScenarioBuilder) EchoTool() *ToolBuilder

EchoTool registers the conventional echo tool declaration.

func (*ScenarioBuilder) EmbedMockLLM

func (b *ScenarioBuilder) EmbedMockLLM(model string) *ScenarioBuilder

EmbedMockLLM registers the conventional embed LLM profile.

func (*ScenarioBuilder) ExpertAgent

func (b *ScenarioBuilder) ExpertAgent(name, instructions string) *ScenarioBuilder

ExpertAgent registers a primary-LLM expert with instructions.

func (*ScenarioBuilder) FilesystemReadTool

func (b *ScenarioBuilder) FilesystemReadTool() *ToolBuilder

FilesystemReadTool registers the fs.read tool declaration.

func (*ScenarioBuilder) FilesystemTool

func (b *ScenarioBuilder) FilesystemTool() *ToolBuilder

FilesystemTool registers the conventional filesystem tool declaration.

func (*ScenarioBuilder) FixedWorkflow

func (b *ScenarioBuilder) FixedWorkflow(wf core.Workflow) *ScenarioBuilder

FixedWorkflow sets fixed_workflow mode with the given workflow.

func (*ScenarioBuilder) GitTool

func (b *ScenarioBuilder) GitTool() *ToolBuilder

GitTool registers the conventional git tool declaration.

func (*ScenarioBuilder) HTTPToolStatus

func (b *ScenarioBuilder) HTTPToolStatus() *ToolBuilder

HTTPToolStatus registers the http.status tool declaration.

func (*ScenarioBuilder) Hybrid

Hybrid sets hybrid mode with an optional workflow phase.

func (*ScenarioBuilder) KnowledgeCollection

func (b *ScenarioBuilder) KnowledgeCollection(opts ...KnowledgeCollectionOption) *ScenarioBuilder

KnowledgeCollection appends a knowledge collection binding.

func (*ScenarioBuilder) KnowledgeRetrieveTool

func (b *ScenarioBuilder) KnowledgeRetrieveTool() *ToolBuilder

KnowledgeRetrieveTool registers the knowledge retriever tool.

func (*ScenarioBuilder) LLM

func (b *ScenarioBuilder) LLM(name string, opts ...LLMOption) *ScenarioBuilder

LLM registers an LLM profile reference.

func (*ScenarioBuilder) MCPSearchTool

func (b *ScenarioBuilder) MCPSearchTool() *ToolBuilder

MCPSearchTool registers the docs.search MCP tool declaration.

func (*ScenarioBuilder) MCPServer

func (b *ScenarioBuilder) MCPServer(opts ...MCPServerOption) *ScenarioBuilder

MCPServer appends an MCP server declaration.

func (*ScenarioBuilder) Memory

func (b *ScenarioBuilder) Memory(name string, opts ...MemoryOption) *ScenarioBuilder

Memory registers a memory reference.

func (*ScenarioBuilder) MinimalAgent

func (b *ScenarioBuilder) MinimalAgent(name, instructions string, tools ...string) *ScenarioBuilder

MinimalAgent wires the standard agent stack plus the given tool names.

func (*ScenarioBuilder) MustScenario

func (b *ScenarioBuilder) MustScenario() core.Scenario

MustScenario returns the scenario or panics if basic invariants fail.

func (*ScenarioBuilder) NamedWorkflow added in v0.2.0

func (b *ScenarioBuilder) NamedWorkflow(name string, wf core.Workflow) *ScenarioBuilder

NamedWorkflow registers a reusable workflow graph under orchestration.workflows.

func (*ScenarioBuilder) NamedWorkflowBuilder added in v0.2.0

func (b *ScenarioBuilder) NamedWorkflowBuilder(name string, wf *WorkflowBuilder) *ScenarioBuilder

NamedWorkflowBuilder registers a workflow built from WorkflowBuilder.

func (*ScenarioBuilder) Orchestration

func (b *ScenarioBuilder) Orchestration(opts ...OrchestrationOption) *ScenarioBuilder

Orchestration sets orchestration policy.

func (*ScenarioBuilder) PlannerMockLLM

func (b *ScenarioBuilder) PlannerMockLLM() *ScenarioBuilder

PlannerMockLLM registers the workflow planner LLM profile.

func (*ScenarioBuilder) PrimaryMockLLM

func (b *ScenarioBuilder) PrimaryMockLLM() *ScenarioBuilder

PrimaryMockLLM registers the conventional primary LLM profile.

func (*ScenarioBuilder) RAGStack

func (b *ScenarioBuilder) RAGStack() *ScenarioBuilder

RAGStack registers chat/embed LLMs, retriever tool, and docs collection.

func (*ScenarioBuilder) RepoSearchTool

func (b *ScenarioBuilder) RepoSearchTool() *ToolBuilder

RepoSearchTool registers the conventional repo_search tool declaration.

func (*ScenarioBuilder) ResearchStack

func (b *ScenarioBuilder) ResearchStack() *ScenarioBuilder

ResearchStack registers primary LLM, session memory, and repo_search tool.

func (*ScenarioBuilder) ReviewerMockLLM

func (b *ScenarioBuilder) ReviewerMockLLM() *ScenarioBuilder

ReviewerMockLLM registers the code-review reviewer LLM profile.

func (*ScenarioBuilder) Runtime

func (b *ScenarioBuilder) Runtime(opts ...RuntimeOption) *ScenarioBuilder

Runtime sets runtime policy.

func (*ScenarioBuilder) SQLQueryTool

func (b *ScenarioBuilder) SQLQueryTool() *ToolBuilder

SQLQueryTool registers the sql.query tool declaration.

func (*ScenarioBuilder) SQLTool

func (b *ScenarioBuilder) SQLTool() *ToolBuilder

SQLTool registers the conventional sql tool declaration.

func (*ScenarioBuilder) Scenario

func (b *ScenarioBuilder) Scenario() core.Scenario

Scenario returns the constructed scenario after committing any pending agent.

func (*ScenarioBuilder) SelfRAGChatMockLLM

func (b *ScenarioBuilder) SelfRAGChatMockLLM(model string) *ScenarioBuilder

SelfRAGChatMockLLM registers the self_rag chat profile with context governance.

func (*ScenarioBuilder) SessionMemory

func (b *ScenarioBuilder) SessionMemory() *ScenarioBuilder

SessionMemory registers the conventional session-scoped in_memory profile.

func (*ScenarioBuilder) Skill

func (b *ScenarioBuilder) Skill(name string, opts ...SkillOption) *ScenarioBuilder

Skill registers a skill declaration.

func (*ScenarioBuilder) StandardStack

func (b *ScenarioBuilder) StandardStack() *ScenarioBuilder

StandardStack registers DefaultMockLLM and SessionMemory.

func (*ScenarioBuilder) StandardTicketStack

func (b *ScenarioBuilder) StandardTicketStack() *ScenarioBuilder

StandardTicketStack registers primary LLM, session memory, and ticket tool.

func (*ScenarioBuilder) StatusTool

func (b *ScenarioBuilder) StatusTool() *ToolBuilder

StatusTool registers a second builtin.echo tool used as a status probe.

func (*ScenarioBuilder) TicketCreatedTrigger

func (b *ScenarioBuilder) TicketCreatedTrigger(agentName string) *ScenarioBuilder

TicketCreatedTrigger registers the ticket.created trigger for an agent.

func (*ScenarioBuilder) TicketTool

func (b *ScenarioBuilder) TicketTool() *ToolBuilder

TicketTool registers the conventional ticket tool declaration.

func (*ScenarioBuilder) TierSessionMemory

func (b *ScenarioBuilder) TierSessionMemory(namespace string, opts ...TierMemoryOption) *ScenarioBuilder

TierSessionMemory registers tiered custom session memory.

func (*ScenarioBuilder) Tool

func (b *ScenarioBuilder) Tool(name string, opts ...ToolOption) *ToolBuilder

Tool registers a tool declaration and returns a builder for further configuration.

func (*ScenarioBuilder) ToolAssistantStack

func (b *ScenarioBuilder) ToolAssistantStack() *ScenarioBuilder

ToolAssistantStack registers DefaultMockToolLLM for tool-enabled autonomous agents.

func (*ScenarioBuilder) Trigger

func (b *ScenarioBuilder) Trigger(opts ...TriggerOption) *ScenarioBuilder

Trigger appends an event trigger.

type SkillOption

type SkillOption func(*core.Skill)

SkillOption configures a skill declaration.

func SkillCompatibleAgents

func SkillCompatibleAgents(agents ...string) SkillOption

SkillCompatibleAgents restricts compatible agents.

func SkillDescription

func SkillDescription(desc string) SkillOption

SkillDescription sets the skill description.

func SkillWorkflow

func SkillWorkflow(wf core.Workflow) SkillOption

SkillWorkflow attaches a workflow to the skill.

type TierMemoryOption

type TierMemoryOption func(*core.MemoryTierSettings)

TierMemoryOption configures tier memory settings.

func TierColdCapacity

func TierColdCapacity(n int) TierMemoryOption

TierColdCapacity sets cold tier capacity.

func TierHotCapacity

func TierHotCapacity(n int) TierMemoryOption

TierHotCapacity sets hot tier capacity.

func TierPromoteAccess

func TierPromoteAccess(n int) TierMemoryOption

TierPromoteAccess sets promote_access threshold.

func TierRecallBudget

func TierRecallBudget(total, hot, warm, cold int) TierMemoryOption

TierRecallBudget sets recall budget totals.

func TierWarmCapacity

func TierWarmCapacity(n int) TierMemoryOption

TierWarmCapacity sets warm tier capacity.

type ToolBuilder

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

ToolBuilder configures a single tool declaration.

func (*ToolBuilder) Agent

func (tb *ToolBuilder) Agent(name string) *AgentBuilder

Agent commits the tool and starts configuring an agent.

func (*ToolBuilder) Approval

func (tb *ToolBuilder) Approval(policy core.ApprovalPolicy) *ToolBuilder

Approval sets the approval policy.

func (*ToolBuilder) Description

func (tb *ToolBuilder) Description(desc string) *ToolBuilder

Description sets the tool description.

func (*ToolBuilder) Done

func (tb *ToolBuilder) Done() *ScenarioBuilder

Done commits the tool and returns the parent scenario builder.

func (*ToolBuilder) InputSchema

func (tb *ToolBuilder) InputSchema(schema json.RawMessage) *ToolBuilder

InputSchema sets the tool input JSON schema.

func (*ToolBuilder) LLM

func (tb *ToolBuilder) LLM(ref string) *ToolBuilder

LLM sets an optional LLM profile for tool-backed generation.

func (*ToolBuilder) Metadata

func (tb *ToolBuilder) Metadata(key, value string) *ToolBuilder

Metadata sets tool metadata.

func (*ToolBuilder) OutputSchema

func (tb *ToolBuilder) OutputSchema(schema json.RawMessage) *ToolBuilder

OutputSchema sets the tool output JSON schema.

func (*ToolBuilder) RateCap

func (tb *ToolBuilder) RateCap(n int) *ToolBuilder

RateCap sets the per-run rate cap.

func (*ToolBuilder) SideEffect

func (tb *ToolBuilder) SideEffect(level core.SideEffectLevel) *ToolBuilder

SideEffect sets the side effect level.

func (*ToolBuilder) StatusTool

func (tb *ToolBuilder) StatusTool() *ToolBuilder

StatusTool commits the current tool and registers the status probe tool.

func (*ToolBuilder) Type

func (tb *ToolBuilder) Type(typ string) *ToolBuilder

Type sets the tool type (for example builtin.echo or http.client).

type ToolOption

type ToolOption func(*core.Tool)

ToolOption configures a tool declaration.

func BuiltinTool

func BuiltinTool(typ string) ToolOption

BuiltinTool sets a builtin tool type.

func EchoToolPreset

func EchoToolPreset() ToolOption

EchoToolPreset configures the builtin echo tool with safe defaults.

func FilesystemReadToolPreset

func FilesystemReadToolPreset() ToolOption

FilesystemReadToolPreset configures the fs.read tool for catalog ID filesystem-tool.

func FilesystemToolPreset

func FilesystemToolPreset() ToolOption

FilesystemToolPreset configures the builtin filesystem tool with safe defaults.

func GitToolPreset

func GitToolPreset() ToolOption

GitToolPreset configures the builtin git tool with safe defaults.

func HTTPTool

func HTTPTool() ToolOption

HTTPTool marks a tool as http.client.

func HTTPToolPreset

func HTTPToolPreset() ToolOption

HTTPToolPreset configures the builtin http tool with safe defaults.

func HTTPToolStatusPreset

func HTTPToolStatusPreset() ToolOption

HTTPToolStatusPreset configures the http.status tool for catalog ID http-tool.

func KnowledgeRetrieveToolPreset

func KnowledgeRetrieveToolPreset() ToolOption

KnowledgeRetrieveToolPreset configures the knowledge retriever tool.

func MCPSearchToolPreset

func MCPSearchToolPreset(serverName string) ToolOption

MCPSearchToolPreset configures the docs.search MCP tool for catalog ID mcp-tool.

func RepoSearchToolPreset

func RepoSearchToolPreset() ToolOption

RepoSearchToolPreset configures the builtin repo_search tool with safe defaults.

func SQLQueryToolPreset

func SQLQueryToolPreset() ToolOption

SQLQueryToolPreset configures the sql.query tool for catalog ID sql-tool.

func SQLToolPreset

func SQLToolPreset() ToolOption

SQLToolPreset configures the builtin sql tool with safe defaults.

func TicketToolPreset

func TicketToolPreset() ToolOption

TicketToolPreset configures the builtin ticket tool with safe defaults.

func ToolApproval

func ToolApproval(policy core.ApprovalPolicy) ToolOption

ToolApproval sets the tool approval policy.

func ToolSideEffect

func ToolSideEffect(level core.SideEffectLevel) ToolOption

ToolSideEffect sets the tool side effect level.

type TriggerOption

type TriggerOption func(*core.Trigger)

TriggerOption configures an event trigger.

func TicketCreatedTriggerPreset

func TicketCreatedTriggerPreset(agentName string) []TriggerOption

TicketCreatedTriggerPreset configures the ticket.created trigger from examples.

func TriggerAgent

func TriggerAgent(agent string) TriggerOption

TriggerAgent sets the target agent.

func TriggerContextPath

func TriggerContextPath(path string) TriggerOption

TriggerContextPath sets the JSONPath for run context.

func TriggerDefaultPrompt

func TriggerDefaultPrompt(prompt string) TriggerOption

TriggerDefaultPrompt sets the default prompt when the event has no payload field.

func TriggerEvent

func TriggerEvent(event string) TriggerOption

TriggerEvent sets the trigger event type.

func TriggerPromptPath

func TriggerPromptPath(path string) TriggerOption

TriggerPromptPath sets the JSONPath for the run prompt.

func TriggerRunIDPath

func TriggerRunIDPath(path string) TriggerOption

TriggerRunIDPath sets the JSONPath for the run id.

type WorkflowBuilder

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

WorkflowBuilder constructs a core.Workflow graph.

func NewWorkflow

func NewWorkflow() *WorkflowBuilder

NewWorkflow creates an empty workflow builder.

func (*WorkflowBuilder) Build

func (w *WorkflowBuilder) Build() core.Workflow

Build returns the workflow graph.

func (*WorkflowBuilder) DependsOn

func (w *WorkflowBuilder) DependsOn(deps ...string) *WorkflowBuilder

DependsOn sets depends_on for the most recently added node.

func (*WorkflowBuilder) Edge

func (w *WorkflowBuilder) Edge(from, to string) *WorkflowBuilder

Edge adds a directed edge between nodes.

func (*WorkflowBuilder) EdgeIf

func (w *WorkflowBuilder) EdgeIf(from, to, condition string) *WorkflowBuilder

EdgeIf adds a conditional edge.

func (*WorkflowBuilder) MapOver added in v0.2.1

func (w *WorkflowBuilder) MapOver(id, itemsPath string, branch MapBranch, opts ...MapNodeOption) *WorkflowBuilder

MapOver adds a dynamic fan-out map node (LangGraph Send-style) over itemsPath.

func (*WorkflowBuilder) NodeAgent

func (w *WorkflowBuilder) NodeAgent(id, agentRef string) *WorkflowBuilder

NodeAgent adds an agent node.

func (*WorkflowBuilder) NodeHumanGate

func (w *WorkflowBuilder) NodeHumanGate(id string) *WorkflowBuilder

NodeHumanGate adds a human gate node.

func (*WorkflowBuilder) NodeLoop added in v0.2.0

func (w *WorkflowBuilder) NodeLoop(id string, input json.RawMessage) *WorkflowBuilder

NodeLoop adds a loop node with JSON input payload.

func (*WorkflowBuilder) NodeMap added in v0.2.0

func (w *WorkflowBuilder) NodeMap(id string, input json.RawMessage) *WorkflowBuilder

NodeMap adds a dynamic fan-out map node.

func (*WorkflowBuilder) NodeParallelGroup

func (w *WorkflowBuilder) NodeParallelGroup(id string, input json.RawMessage) *WorkflowBuilder

NodeParallelGroup adds a parallel_group node.

func (*WorkflowBuilder) NodeSkill

func (w *WorkflowBuilder) NodeSkill(id, skillRef string) *WorkflowBuilder

NodeSkill adds a skill node.

func (*WorkflowBuilder) NodeSubgraph added in v0.2.0

func (w *WorkflowBuilder) NodeSubgraph(id, ref string) *WorkflowBuilder

NodeSubgraph adds a runtime subgraph node referencing orchestration.workflows[ref].

func (*WorkflowBuilder) NodeTool

func (w *WorkflowBuilder) NodeTool(id, toolRef string) *WorkflowBuilder

NodeTool adds a tool node.

func (*WorkflowBuilder) NodeTransform

func (w *WorkflowBuilder) NodeTransform(id string, input json.RawMessage) *WorkflowBuilder

NodeTransform adds a transform node with optional JSON input payload.

func (*WorkflowBuilder) NodeWithDepends

func (w *WorkflowBuilder) NodeWithDepends(node core.WorkflowNode, deps ...string) *WorkflowBuilder

NodeWithDepends adds a pre-built node and sets depends_on in one call.

func (*WorkflowBuilder) ParallelGroup added in v0.2.1

func (w *WorkflowBuilder) ParallelGroup(id string, refs ...string) *WorkflowBuilder

ParallelGroup adds a parallel_group node over agent refs.

func (*WorkflowBuilder) ParallelTools added in v0.2.1

func (w *WorkflowBuilder) ParallelTools(id, onError string, tools ...string) *WorkflowBuilder

ParallelTools adds a parallel_group node over tool refs.

func (*WorkflowBuilder) RouteIf added in v0.2.1

func (w *WorkflowBuilder) RouteIf(from, to, path string, value any) *WorkflowBuilder

RouteIf adds a conditional edge when eq(path, value).

func (*WorkflowBuilder) RouteIfExists added in v0.2.1

func (w *WorkflowBuilder) RouteIfExists(from, to, path string) *WorkflowBuilder

RouteIfExists adds a conditional edge when exists(path).

func (*WorkflowBuilder) RouteIfMissing added in v0.2.1

func (w *WorkflowBuilder) RouteIfMissing(from, to, path string) *WorkflowBuilder

RouteIfMissing adds a conditional edge when missing(path).

func (*WorkflowBuilder) RouteIfNe added in v0.2.1

func (w *WorkflowBuilder) RouteIfNe(from, to, path string, value any) *WorkflowBuilder

RouteIfNe adds a conditional edge when ne(path, value).

func (*WorkflowBuilder) WithInterrupt added in v0.2.0

func (w *WorkflowBuilder) WithInterrupt() *WorkflowBuilder

WithInterrupt marks the most recently added node for post-step declarative pause.

Jump to

Keyboard shortcuts

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