executor

package
v0.2.65 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2AAuthProxy added in v0.2.9

type A2AAuthProxy struct {
	Enabled       bool
	Resource      string
	Scopes        []string
	UseIDToken    bool
	ExcludePrefix string
}

A2AAuthProxy mirrors agent.A2AAuth to avoid an import cycle in bootstrap.

type A2AClientConfig added in v0.2.9

type A2AClientConfig struct {
	Name             string            `yaml:"name" json:"name"`
	JSONRPCURL       string            `yaml:"jsonrpcURL" json:"jsonrpcURL"`
	StreamURL        string            `yaml:"streamURL,omitempty" json:"streamURL,omitempty"`
	Headers          map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
	StreamingDefault bool              `yaml:"streamingDefault,omitempty" json:"streamingDefault,omitempty"`
}

A2AClientConfig defines an external A2A endpoint for outbound calls.

type Config

type Config struct {
	BaseURL      string                                  `yaml:"baseUrl" json:"baseUrl" `
	Agent        *mcpcfg.Group[*agent.Agent]             `yaml:"agents" json:"agents"`
	Model        *mcpcfg.Group[*llmprovider.Config]      `yaml:"models" json:"models"`
	Embedder     *mcpcfg.Group[*embedderprovider.Config] `yaml:"embedders" json:"embedders" `
	MCP          *mcpcfg.Group[*mcpcfg.MCPClient]        `yaml:"mcp" json:"mcp"`
	MCPServer    *MCPServerConfig                        `yaml:"mcpServer,omitempty" json:"mcpServer,omitempty"`
	DAOConnector *view.DBConfig                          `yaml:"daoConfig" json:"daoConfig" `
	Default      config.Defaults                         `yaml:"default" json:"default"`
	Auth         *authcfg.Config                         `yaml:"auth" json:"auth"`

	Services []string `yaml:"services" json:"services"`

	// External A2A consumption and directory
	A2AClients []*A2AClientConfig `yaml:"a2aClients,omitempty" json:"a2aClients,omitempty"`
	Directory  *DirectoryConfig   `yaml:"directory,omitempty" json:"directory,omitempty"`
	// Timeout for outbound A2A requests (seconds). When zero, a default is applied.
	A2ATimeoutSec int `yaml:"a2aTimeoutSec,omitempty" json:"a2aTimeoutSec,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) DefaultAgentFinder

func (c *Config) DefaultAgentFinder(options ...agent2.Option) *agentfinder.Finder

func (*Config) DefaultEmbedderFinder

func (c *Config) DefaultEmbedderFinder() *embedderfinder.Finder

func (*Config) DefaultModelFinder

func (c *Config) DefaultModelFinder() *modelfinder.Finder

func (*Config) Meta

func (c *Config) Meta() *meta.Service

func (*Config) Validate

func (c *Config) Validate() error

type DirectoryConfig added in v0.2.9

type DirectoryConfig struct {
	External []*ExternalDirectoryItem `yaml:"external,omitempty" json:"external,omitempty"`
	Strict   *bool                    `yaml:"strict,omitempty" json:"strict,omitempty"`
}

DirectoryConfig defines external directory entries merged with internal agents.

type ExternalDirectoryItem added in v0.2.9

type ExternalDirectoryItem struct {
	ID           string                 `yaml:"id" json:"id"`
	ClientRef    string                 `yaml:"clientRef" json:"clientRef"`
	Name         string                 `yaml:"name,omitempty" json:"name,omitempty"`
	Description  string                 `yaml:"description,omitempty" json:"description,omitempty"`
	Tags         []string               `yaml:"tags,omitempty" json:"tags,omitempty"`
	Domains      []string               `yaml:"domains,omitempty" json:"domains,omitempty"`
	Priority     int                    `yaml:"priority,omitempty" json:"priority,omitempty"`
	Capabilities map[string]interface{} `yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
}

ExternalDirectoryItem registers an external agent for the LLM directory.

type MCPServerConfig added in v0.2.30

type MCPServerConfig struct {
	// Port specifies the local TCP port to bind the MCP HTTP server to.
	// When zero, the MCP server endpoint is disabled.
	Port int `yaml:"port" json:"port"`

	// Tool scopes which tools are exposed over MCP.
	// Example:
	//  tool:
	//    items:
	//    - pattern: system/exec
	//    - pattern: system/patch
	Tool agent.Tool `yaml:"tool,omitempty" json:"tool,omitempty"`
}

MCPServerConfig exposes the executor's tool registry over an MCP server endpoint (HTTP) when running in serve mode.

func (*MCPServerConfig) Enabled added in v0.2.30

func (c *MCPServerConfig) Enabled() bool

func (*MCPServerConfig) ToolPatterns added in v0.2.30

func (c *MCPServerConfig) ToolPatterns() []string

type Option

type Option func(config *Service)

func WithAgents

func WithAgents(agents ...*agent.Agent) Option

WithAgents sets a custom agent registry.

func WithApprovalService added in v0.2.6

func WithApprovalService(svc approval.Service) Option

WithApprovalService sets an internal approval service implementation. Passing nil clears any existing service.

func WithConfig

func WithConfig(config *Config) Option

func WithConversionClient added in v0.2.0

func WithConversionClient(client conversation.Client) Option

func WithElicitationRouter added in v0.2.0

func WithElicitationRouter(r elicrouter.ElicitationRouter) Option

WithElicitationRouter injects a shared router used by the agent to wait on assistant-originated elicitations. In server mode, pass the same instance as the HTTP handler uses so UI callbacks unblock the agent loop.

func WithMCPManager added in v0.2.0

func WithMCPManager(m *mcpmgr.Manager) Option

WithMCPManager attaches a per-conversation MCP client manager so that tool executions can inject the appropriate client/token at call time.

func WithMetaService

func WithMetaService(metaService *meta.Service) Option

WithMetaService sets metaService service

func WithModelConfig

func WithModelConfig(providers ...*modelprovider.Config) Option

func WithNewElicitationAwaiter

func WithNewElicitationAwaiter(newAwaiter func() elicitation.Awaiter) Option

WithNewElicitationAwaiter registers an interactive Awaiter responsible for resolving schema-driven user prompts ("elicitation"). When set, the awaiter is attached to the internally managed MCP client so that interactive CLI sessions can synchronously obtain the required payload.

The last non-nil value wins when the option is applied multiple times. WithNewElicitationAwaiter registers (or overrides) the Awaiter that will be used to resolve schema-based elicitation requests originating from the runtime.

Passing a non-nil Awaiter enables interactive (or otherwise custom) behaviour. Passing nil explicitly disables any previously registered Awaiter – this is useful for headless deployments such as the embedded HTTP server where blocking on stdin must be avoided.

The *last* call wins, therefore a later invocation can override an earlier one (including the implicit registration performed by the CLI helpers).

func WithToolDebugLogger

func WithToolDebugLogger(w io.Writer) Option

WithToolDebugLogger enables debug logging for every atool call executed via the executor's atool registry. Each invocation is written to the supplied writer. Passing nil disables logging.

func WithTools

func WithTools(tools gtool.Registry) Option

WithTools sets a custom atool registry.

func WithoutHotSwap

func WithoutHotSwap() Option

WithoutHotSwap disables automatic workspace hot-reload. Use this option for deterministic production runs where configuration should not change while the process is running.

type Service

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

func New

func New(ctx context.Context, options ...Option) (*Service, error)

New creates a new executor service

func (*Service) AgentService

func (e *Service) AgentService() *agent2.Service

AgentService returns the registered llmagent service

func (*Service) ApprovalService

func (e *Service) ApprovalService() approval.Service

ApprovalService exposes the internal approval service when present.

func (*Service) Config

func (e *Service) Config() *Config

Config returns the underlying configuration struct (read-only). Callers must treat the returned pointer as immutable once the executor has been initialised.

func (*Service) Conversation

func (e *Service) Conversation() *conversation.Manager

Conversation returns the shared conversation manager initialised by the service.

func (*Service) ExecuteTool

func (e *Service) ExecuteTool(ctx context.Context, name string, args map[string]interface{}, timeout time.Duration) (interface{}, error)

ExecuteTool invokes a registered tool through the configured tool registry. It provides a lightweight way to run an individual tool without crafting a full workflow. When `timeout` is positive a child context with that deadline is used.

func (*Service) FindToolMetadata added in v0.2.1

func (e *Service) FindToolMetadata(service, method string) []*tool.FeedSpec

FindToolMetadata returns ordered tool metadata (workspace extensions) that match the provided service/method combination. When none match it returns nil.

func (*Service) IsStarted

func (e *Service) IsStarted() bool

func (*Service) LLMCore

func (e *Service) LLMCore() *core.Service

LLMCore returns the underlying llm/core service instance (mainly for introspection or test hooks).

func (*Service) NewContext

func (e *Service) NewContext(ctx context.Context) context.Context

func (*Service) OAuthFinder

func (e *Service) OAuthFinder() *oauthfinder.Finder

OAuthFinder exposes decrypted OAuth2 configurations loaded from workspace.

func (*Service) RegistryForConversation added in v0.2.0

func (e *Service) RegistryForConversation(convID string) tool.Registry

RegistryForConversation returns a Registry that is scoped to the provided conversation ID. Execute calls performed through the returned registry carry the conversation identifier in context so adapters can resolve per-conv resources (e.g., MCP clients, auth tokens).

func (*Service) Shutdown

func (e *Service) Shutdown(ctx context.Context)

func (*Service) Start

func (e *Service) Start(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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