provider

package
v0.14.21 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package provider is the abstraction the workflow engine talks to for classify + agent nodes. Concrete impls (Claude Code, Codex, Gemini) satisfy Provider and register at boot via Registry. The interface keeps the engine decoupled from CLI spawn details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentRequest

type AgentRequest struct {
	Prompt    string
	Preset    string
	Workspace string
	Skills    []string
	Tools     []string
	MaxTurns  int
	SessionID string
}

AgentRequest is the call shape for an agent node.

type AgentResult

type AgentResult struct {
	Text       string
	ToolsUsed  []string
	SkillsUsed []string
	Usage      Usage
}

AgentResult is what the provider returns for an agent call.

type Capabilities

type Capabilities struct {
	StructuredOutput bool
	Streaming        bool
	DefaultPreset    string
}

Capabilities flags what the provider supports natively.

type Info

type Info struct {
	Name         string       `json:"name"`
	Capabilities Capabilities `json:"capabilities"`
	IsDefault    bool         `json:"is_default,omitempty"`
}

Info is one introspection row.

type Provider

type Provider interface {
	Name() string
	Capabilities() Capabilities
	StructuredCall(ctx context.Context, req StructuredRequest) (StructuredResult, error)
	AgentCall(ctx context.Context, req AgentRequest) (AgentResult, error)
	ListSkills(ctx context.Context) ([]Skill, error)
}

Provider implementations spawn the underlying CLI/API.

type Registry

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

Registry holds named providers for the engine.

func NewRegistry

func NewRegistry() *Registry

NewRegistry builds an empty registry.

func (*Registry) Describe

func (r *Registry) Describe() []Info

Describe returns introspection metadata for `workflow_providers` MCP op.

func (*Registry) Get

func (r *Registry) Get(name string) (Provider, error)

Get returns a provider, falling back to the default when name is empty.

func (*Registry) List

func (r *Registry) List() []string

List returns all provider names sorted.

func (*Registry) Register

func (r *Registry) Register(p Provider)

Register adds a provider. First registered becomes the default.

func (*Registry) SetDefault

func (r *Registry) SetDefault(name string) error

SetDefault picks which provider classify/agent nodes use when they don't specify `provider:`.

type Skill

type Skill struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"input_schema,omitempty"`
	Source      string         `json:"source"`
}

Skill is one provider-specific capability bundle. Surfaced via `workflow_skills` MCP introspection.

type StructuredRequest

type StructuredRequest struct {
	Prompt       string
	SystemPrompt string
	Schema       map[string]any
	Preset       string
	SessionID    string
}

StructuredRequest is the call shape for a classify node.

type StructuredResult

type StructuredResult struct {
	Raw    string
	Parsed map[string]any
	OK     bool
	Error  string
	Usage  Usage
}

StructuredResult is what the provider returns.

type Usage

type Usage struct {
	InputTokens  int     `json:"input_tokens,omitempty"`
	OutputTokens int     `json:"output_tokens,omitempty"`
	CostUSD      float64 `json:"cost_usd,omitempty"`
	LatencyMs    int64   `json:"latency_ms,omitempty"`
}

Usage captures token + cost telemetry per call.

Jump to

Keyboard shortcuts

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