orchestrator

package
v0.1.8-rc.21 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package orchestrator implements Genie's request routing and execution flow: it receives user messages, classifies intent (simple vs complex), runs the appropriate expert(s), and coordinates ReAcTree multi-step workflows.

It solves the problem of connecting the messenger layer to the agent layer: the orchestrator owns the conversation loop, injects skills/memory, applies HITL and clarification flows, and streams AG-UI events to the client. Without this package, there would be no single place that ties config, tools, experts, and execution together.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeQuestion

type CodeQuestion struct {
	Question string `json:"question"`

	// SkipClassification when true skips front-desk classification and runs
	// the request as COMPLEX. Used for internal tasks (e.g. graph learn) that
	// would otherwise be misclassified as REFUSE.
	SkipClassification bool `json:"-"`

	// Attachments holds file/media attachments from the incoming message.
	// Image attachments are passed as multimodal content to the LLM so it
	// can "see" them; other types are described textually.
	Attachments []messenger.Attachment `json:"-"`

	// BrowserTab is an optional context for a specific browser tab.
	// If provided, browser tools will use this context.
	BrowserTab context.Context `json:"-"`
}

type Orchestrator

type Orchestrator interface {
	Chat(ctx context.Context, req CodeQuestion, outputChan chan<- string) error
	InjectFeedback(ctx context.Context, message string) error
	Close() error
	Resume(ctx context.Context) string
}

Orchestrator is an expert that can answer users questions

func NewOrchestrator

func NewOrchestrator(
	ctx context.Context,
	modelProvider modelprovider.ModelProvider,
	availableTools *tools.Registry,
	vectorStore vector.IStore,
	graphStore memorygraph.IStore,
	auditor audit.Auditor,
	approvalStore hitl.ApprovalStore,
	memorySvc memory.Service,
	sessionSvc session.Service,
	agentPersona string,
	extraOpts ...OrchestratorOption,
) (Orchestrator, error)

type OrchestratorOption

type OrchestratorOption func(*orchestratorOpts)

NewOrchestrator creates a new orchestrator with an integrated ReAcTree executor. The working memory persists across chat turns, allowing the agent to share observations from previous interactions. The tree executor enables hierarchical task decomposition for complex queries when activated. The approvalStore enables HITL approval gating for sub-agent tool calls; when nil, sub-agents execute tools without requiring human approval. OrchestratorOption configures optional behaviour on the orchestrator.

func WithAccomplishmentConfidenceThreshold

func WithAccomplishmentConfidenceThreshold(threshold float64) OrchestratorOption

WithAccomplishmentConfidenceThreshold sets the minimum confidence score (0.0–1.0) required for a tree result to be stored as an accomplishment. Results below this threshold are discarded to prevent storing error outputs or low-quality responses as accomplishments. Default is 0.5.

func WithDisableResume added in v0.1.7

func WithDisableResume(disable bool) OrchestratorOption

WithDisableResume sets whether to disable the dynamic generation of the agent's resume.

func WithExpertEventErrorTranslator

func WithExpertEventErrorTranslator(translator expert.EventErrorTranslator) OrchestratorOption

WithExpertEventErrorTranslator registers an expert streamed-error translator.

This exists so host applications can inject domain-specific event error handling (for example policy deny messaging) without forking expert internals.

func WithHalGuardConfig added in v0.1.7

func WithHalGuardConfig(cfg halguard.Config) OrchestratorOption

WithHalGuardConfig sets the hallucination guard configuration. When not provided, halguard.DefaultConfig() is used.

func WithLearningConfig

func WithLearningConfig(cfg learning.Config) OrchestratorOption

WithLearningConfig sets the learning pipeline configuration. When not provided, learning.DefaultConfig() is used.

func WithSemanticRouter added in v0.1.7

func WithSemanticRouter(router semanticrouter.IRouter) OrchestratorOption

WithSemanticRouter sets the semantic router instance for fast embedding-based routing and caching.

func WithSkillRepo

func WithSkillRepo(repo *skills.MutableRepository) OrchestratorOption

WithSkillRepo sets the writable skill repository. When set, the orchestrator constructs a Learner that distills completed tasks into skills and indexes them in the vector store for discovery.

func WithSubAgentsConfig

func WithSubAgentsConfig(cfg config.SubAgentsConfig) OrchestratorOption

WithSubAgentsConfig sets the sub-agent behavior limits.

func WithToolIndexExtraTools

func WithToolIndexExtraTools(fn func(context.Context) []tool.Tool) OrchestratorOption

WithToolIndexExtraTools registers a callback that supplies extra tools for the vector tool index and search_tools keyword merge. Use this when the host application injects dynamic tools per agent (e.g. Guild-specific integrations) so they are embedded and discoverable alongside registry tools.

func WithToolwrapOptions

func WithToolwrapOptions(opts ...toolwrap.ServiceOption) OrchestratorOption

WithToolwrapOptions passes per-agent middleware configuration to the underlying toolwrap.Service. Use this to enable rate limiting, tracing, retries, timeouts, etc. on a per-agent basis.

Directories

Path Synopsis
Package orchestratorcontext provides context-scoped access to the running agent's identity.
Package orchestratorcontext provides context-scoped access to the running agent's identity.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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