Documentation
¶
Index ¶
- func ContextWithWorkflowNode(ctx context.Context, nodeID string) context.Context
- func WorkflowNodeFromContext(ctx context.Context) string
- type Agent
- type AgentInput
- type AgentOutput
- type AgentPolicy
- type AgentRunner
- type ApprovalPolicy
- type CheckpointState
- type Decision
- type Event
- type EventSink
- type EventSinkFunc
- type EventType
- type HumanGate
- type HumanInLoopPolicy
- type KnowledgeCollection
- type KnowledgeConfig
- type LLMProfileRef
- type MCPConfig
- type MCPServer
- type MemoryRef
- type MemoryTierColdSummarySettings
- type MemoryTierRecallBudget
- type MemoryTierRecallWeights
- type MemoryTierSettings
- type Orchestration
- type OrchestrationMode
- type PlanningPolicy
- type PromptFragment
- type RetryPolicy
- type RuntimePolicy
- type Scenario
- type SideEffectLevel
- type Skill
- type SkillToolPolicy
- type Tool
- type ToolCall
- type ToolExecutor
- type ToolResolver
- type ToolResolverFunc
- type ToolResult
- type Trigger
- type Workflow
- type WorkflowEdge
- type WorkflowNode
- type WorkflowNodeKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithWorkflowNode ¶ added in v0.2.1
ContextWithWorkflowNode attaches the active workflow node ID to ctx for observability.
func WorkflowNodeFromContext ¶ added in v0.2.1
WorkflowNodeFromContext returns the workflow node ID bound to ctx, if any.
Types ¶
type Agent ¶
type Agent struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Role string `json:"role,omitempty"`
Instructions string `json:"instructions,omitempty"`
LLM string `json:"llm,omitempty"`
Memory string `json:"memory,omitempty"`
Tools []string `json:"tools,omitempty"`
Skills []string `json:"skills,omitempty"`
SubAgents []string `json:"sub_agents,omitempty"`
Policy AgentPolicy `json:"policy"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type AgentInput ¶
type AgentInput struct {
RunID string `json:"run_id"`
Prompt string `json:"prompt,omitempty"`
Context json.RawMessage `json:"context,omitempty"`
}
type AgentOutput ¶
type AgentOutput struct {
RunID string `json:"run_id"`
Text string `json:"text,omitempty"`
Raw json.RawMessage `json:"raw,omitempty"`
Events []Event `json:"events,omitempty"`
}
type AgentPolicy ¶
type AgentRunner ¶
type AgentRunner interface {
Run(ctx context.Context, input AgentInput) (AgentOutput, error)
}
type ApprovalPolicy ¶
type ApprovalPolicy string
const ( ApprovalNever ApprovalPolicy = "never" ApprovalRisky ApprovalPolicy = "risky" ApprovalAlways ApprovalPolicy = "always" // ApprovalPause pauses the run at a human gate instead of denying the tool call. ApprovalPause ApprovalPolicy = "pause" )
type CheckpointState ¶
type CheckpointState struct {
RunID string `json:"run_id"`
Version int64 `json:"version"`
NodeID string `json:"node_id"`
Payload json.RawMessage `json:"payload,omitempty"`
}
type Decision ¶
type Decision string
Decision is the human decision made at a human-in-the-loop checkpoint.
func (*Decision) UnmarshalText ¶
type Event ¶
type Event struct {
Type EventType `json:"type"`
RunID string `json:"run_id"`
ScenarioName string `json:"scenario_name,omitempty"`
Timestamp time.Time `json:"timestamp"`
TraceID string `json:"trace_id,omitempty"`
SpanID string `json:"span_id,omitempty"`
ParentSpanID string `json:"parent_span_id,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
}
type EventSinkFunc ¶
type EventType ¶
type EventType string
const ( EventRunStarted EventType = "RunStarted" EventRunCompleted EventType = "RunCompleted" EventRunFailed EventType = "RunFailed" EventRunPaused EventType = "RunPaused" EventRunResumed EventType = "RunResumed" EventStepStarted EventType = "StepStarted" EventStepCompleted EventType = "StepCompleted" EventStepFailed EventType = "StepFailed" EventSubgraphStarted EventType = "SubgraphStarted" EventSubgraphCompleted EventType = "SubgraphCompleted" EventToolCalled EventType = "ToolCalled" EventToolReturned EventType = "ToolReturned" EventToolDenied EventType = "ToolDenied" EventLLMCalled EventType = "LLMCalled" EventLLMReturned EventType = "LLMReturned" EventLLMTokenUsage EventType = "LLMTokenUsage" EventHumanGateOpened EventType = "HumanGateOpened" EventHumanGateDecided EventType = "HumanGateDecided" EventHumanGateExpired EventType = "HumanGateExpired" EventMemoryRead EventType = "MemoryRead" EventMemoryWrite EventType = "MemoryWrite" EventMemoryPromoted EventType = "MemoryPromoted" EventMemoryDemoted EventType = "MemoryDemoted" EventMemoryEvicted EventType = "MemoryEvicted" EventContextPrepared EventType = "ContextPrepared" )
type HumanInLoopPolicy ¶
type KnowledgeCollection ¶ added in v0.1.5
type KnowledgeCollection struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Namespace string `json:"namespace"`
Tool string `json:"tool,omitempty"`
EmbedProfile string `json:"embed_profile,omitempty"`
SearchMode string `json:"search_mode,omitempty"`
Agents []string `json:"agents,omitempty"`
TenantScoped bool `json:"tenant_scoped,omitempty"`
}
KnowledgeCollection binds agents to a retriever tool and vector namespace.
type KnowledgeConfig ¶ added in v0.1.5
type KnowledgeConfig struct {
Collections []KnowledgeCollection `json:"collections,omitempty"`
}
KnowledgeConfig groups knowledge collections for scenario-level RAG binding.
type LLMProfileRef ¶
type LLMProfileRef struct {
Provider string `json:"provider"`
Model string `json:"model"`
Endpoint string `json:"endpoint,omitempty"`
APIKeyEnv string `json:"api_key_env,omitempty"`
ContextWindowTokens int `json:"context_window_tokens,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
TopP *float32 `json:"top_p,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Thinking llm.ThinkingConfig `json:"thinking,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Context contextwindow.Policy `json:"context,omitempty"`
ExtraBody map[string]any `json:"extra_body,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type MCPConfig ¶ added in v0.1.5
type MCPConfig struct {
Servers []MCPServer `json:"servers,omitempty"`
}
type MCPServer ¶ added in v0.1.5
type MCPServer struct {
Name string `json:"name"`
Transport string `json:"transport"` // stdio | http
Command []string `json:"command,omitempty"`
URL string `json:"url,omitempty"`
ToolPrefix string `json:"tool_prefix,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
MCPServer declares an MCP server wired into scenario tools at Framework build time.
type MemoryTierColdSummarySettings ¶ added in v0.2.0
type MemoryTierRecallBudget ¶ added in v0.1.9
type MemoryTierRecallWeights ¶ added in v0.1.9
type MemoryTierSettings ¶ added in v0.1.9
type MemoryTierSettings struct {
Enabled bool `json:"enabled,omitempty"`
HotCapacity int `json:"hot_capacity,omitempty"`
WarmCapacity int `json:"warm_capacity,omitempty"`
ColdCapacity int `json:"cold_capacity,omitempty"`
HotTTL string `json:"hot_ttl,omitempty"`
WarmTTL string `json:"warm_ttl,omitempty"`
PromoteAccess int `json:"promote_access,omitempty"`
DemoteIdle string `json:"demote_idle,omitempty"`
RecallBudget MemoryTierRecallBudget `json:"recall_budget,omitempty"`
RecallWeights MemoryTierRecallWeights `json:"recall_weights,omitempty"`
ColdSummary *MemoryTierColdSummarySettings `json:"cold_summary,omitempty"`
}
MemoryTierSettings configures hot/warm/cold tiered recall for a memory reference.
type Orchestration ¶
type Orchestration struct {
Mode OrchestrationMode `json:"mode"`
Workflow *Workflow `json:"workflow,omitempty"`
Workflows map[string]Workflow `json:"workflows,omitempty"`
MaxParallel int `json:"max_parallel,omitempty"`
HumanInLoop HumanInLoopPolicy `json:"human_in_loop"`
Planning PlanningPolicy `json:"planning,omitempty"`
}
type OrchestrationMode ¶
type OrchestrationMode string
const ( OrchestrationAutonomous OrchestrationMode = "autonomous" OrchestrationFixedWorkflow OrchestrationMode = "fixed_workflow" OrchestrationHybrid OrchestrationMode = "hybrid" )
type PlanningPolicy ¶
type PlanningPolicy struct {
Enabled bool `json:"enabled,omitempty"`
Agent string `json:"agent,omitempty"`
MaxSteps int `json:"max_steps,omitempty"`
// Execute tracks plan step completion in run state during the tool loop.
Execute bool `json:"execute,omitempty"`
// Replan retries planning when execute mode stalls before max steps.
ReplanOnFailure bool `json:"replan_on_failure,omitempty"`
// AfterWorkflow enables planning during hybrid phase-2 after workflow outputs
// are hydrated into run context.
AfterWorkflow bool `json:"after_workflow,omitempty"`
}
type PromptFragment ¶
type RetryPolicy ¶
type RetryPolicy struct {
MaxAttempts int `json:"max_attempts,omitempty"`
}
type RuntimePolicy ¶
type RuntimePolicy struct {
Timeout time.Duration `json:"timeout,omitempty"`
MaxSteps int `json:"max_steps,omitempty"`
MaxRetries int `json:"max_retries,omitempty"`
MaxParallel int `json:"max_parallel,omitempty"`
StepOutputThreshold int64 `json:"step_output_threshold,omitempty"`
Secrets map[string]string `json:"secrets,omitempty"`
}
type Scenario ¶
type Scenario struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
LLMs map[string]LLMProfileRef `json:"llms,omitempty"`
Memories map[string]MemoryRef `json:"memories,omitempty"`
Knowledge KnowledgeConfig `json:"knowledge,omitempty"`
MCP MCPConfig `json:"mcp,omitempty"`
Tools map[string]Tool `json:"tools,omitempty"`
Skills map[string]Skill `json:"skills,omitempty"`
Agents map[string]Agent `json:"agents,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
Orchestration Orchestration `json:"orchestration"`
Runtime RuntimePolicy `json:"runtime"`
}
type SideEffectLevel ¶
type SideEffectLevel string
const ( SideEffectNone SideEffectLevel = "none" SideEffectRead SideEffectLevel = "read" SideEffectWrite SideEffectLevel = "write" SideEffectExternal SideEffectLevel = "external" SideEffectDangerous SideEffectLevel = "dangerous" )
type Skill ¶
type Skill struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Version string `json:"version,omitempty"`
CompatibleAgents []string `json:"compatible_agents,omitempty"`
PromptFragments []PromptFragment `json:"prompt_fragments,omitempty"`
AgentPolicy AgentPolicy `json:"agent_policy,omitempty"`
ToolPolicies []SkillToolPolicy `json:"tool_policies,omitempty"`
Workflow *Workflow `json:"workflow,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type SkillToolPolicy ¶
type SkillToolPolicy struct {
Tool string `json:"tool"`
Approval ApprovalPolicy `json:"approval,omitempty"`
SideEffect SideEffectLevel `json:"side_effect,omitempty"`
RateCap int `json:"rate_cap,omitempty"`
}
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
InputSchema json.RawMessage `json:"input_schema,omitempty"`
OutputSchema json.RawMessage `json:"output_schema,omitempty"`
SideEffect SideEffectLevel `json:"side_effect,omitempty"`
Approval ApprovalPolicy `json:"approval,omitempty"`
LLM string `json:"llm,omitempty"`
RateCap int `json:"rate_cap,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type ToolExecutor ¶
type ToolExecutor interface {
Execute(ctx context.Context, call ToolCall) (ToolResult, error)
}
type ToolResolver ¶
type ToolResolver interface {
ResolveTool(ctx context.Context, tool Tool) (ToolExecutor, error)
}
ToolResolver resolves a declared tool manifest to an executor at call time. Resolvers are useful for heavy or tenant-scoped tools whose clients should not be initialized during scenario loading.
type ToolResolverFunc ¶
type ToolResolverFunc func(ctx context.Context, tool Tool) (ToolExecutor, error)
func (ToolResolverFunc) ResolveTool ¶
func (fn ToolResolverFunc) ResolveTool(ctx context.Context, tool Tool) (ToolExecutor, error)
type ToolResult ¶
type ToolResult struct {
Tool string `json:"tool"`
Output json.RawMessage `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
type Trigger ¶ added in v0.1.2
type Trigger struct {
Event string `json:"event"`
Agent string `json:"agent,omitempty"`
PromptPath string `json:"prompt_path,omitempty"`
ContextPath string `json:"context_path,omitempty"`
RunIDPath string `json:"run_id_path,omitempty"`
DefaultPrompt string `json:"default_prompt,omitempty"`
}
Trigger maps an external event type to a run request template.
type Workflow ¶
type Workflow struct {
Nodes []WorkflowNode `json:"nodes,omitempty"`
Edges []WorkflowEdge `json:"edges,omitempty"`
}
type WorkflowEdge ¶
type WorkflowNode ¶
type WorkflowNode struct {
ID string `json:"id"`
Kind WorkflowNodeKind `json:"kind"`
Ref string `json:"ref,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
Condition string `json:"condition,omitempty"`
Interrupt bool `json:"interrupt,omitempty"`
Retry RetryPolicy `json:"retry"`
}
type WorkflowNodeKind ¶
type WorkflowNodeKind string
const ( NodeAgent WorkflowNodeKind = "agent" NodeTool WorkflowNodeKind = "tool" NodeSkill WorkflowNodeKind = "skill" NodeHumanGate WorkflowNodeKind = "human_gate" NodeTransform WorkflowNodeKind = "transform" NodeParallelGroup WorkflowNodeKind = "parallel_group" NodeLoop WorkflowNodeKind = "loop" NodeQueryRouter WorkflowNodeKind = "query_router" NodeRAGGrade WorkflowNodeKind = "rag_grade" NodeSupervisor WorkflowNodeKind = "supervisor" NodeSubgraph WorkflowNodeKind = "subgraph" NodeMap WorkflowNodeKind = "map" )