agent

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertYAMLSchemaToResponseFormat added in v0.0.24

func ConvertYAMLSchemaToResponseFormat(config *ResponseFormatConfig) (*interfaces.ResponseFormat, error)

ConvertYAMLSchemaToResponseFormat converts a ResponseFormatConfig to interfaces.ResponseFormat

func CreateMemoryFromConfig added in v0.2.4

func CreateMemoryFromConfig(memoryConfig map[string]interface{}, llmClient interfaces.LLM) (interfaces.Memory, error)

CreateMemoryFromConfig creates a memory instance from YAML configuration This function is intended to be used by agent-blueprint applications that need to instantiate memory from YAML config stored in the agent

func ExpandEnv added in v0.2.4

func ExpandEnv(s string) string

ExpandEnv expands environment variables, checking both actual env vars and .env file This replaces os.ExpandEnv to support .env files

func FormatSystemPromptFromConfig added in v0.0.3

func FormatSystemPromptFromConfig(config AgentConfig, variables map[string]string) string

FormatSystemPromptFromConfig formats a system prompt based on the agent configuration

func GenerateConfigFromSystemPrompt added in v0.0.3

func GenerateConfigFromSystemPrompt(ctx context.Context, llm interfaces.LLM, systemPrompt string) (AgentConfig, []TaskConfig, error)

GenerateConfigFromSystemPrompt uses the LLM to generate agent and task configurations from a system prompt

func GetAgentForTask added in v0.0.3

func GetAgentForTask(taskConfigs TaskConfigs, taskName string) (string, error)

GetAgentForTask returns the agent name for a given task

func GetEnvValue added in v0.2.4

func GetEnvValue(key string) string

GetEnvValue gets an environment variable value from either env or .env cache

func GetInvocationID added in v0.0.26

func GetInvocationID(ctx context.Context) string

GetInvocationID retrieves the invocation ID from context

func GetParentAgent added in v0.0.26

func GetParentAgent(ctx context.Context) string

GetParentAgent retrieves the parent agent from context

func GetRecursionDepth added in v0.0.26

func GetRecursionDepth(ctx context.Context) int

GetRecursionDepth retrieves the current recursion depth from context

func GetSubAgentName added in v0.0.26

func GetSubAgentName(ctx context.Context) string

GetSubAgentName retrieves the sub-agent name from context

func IsSubAgentCall added in v0.0.26

func IsSubAgentCall(ctx context.Context) bool

IsSubAgentCall checks if the current context is a sub-agent call

func LoadEnvFile added in v0.2.4

func LoadEnvFile(path string) error

LoadEnvFile explicitly loads a .env file into the cache This can be called by applications to ensure a specific .env file is loaded

func SaveAgentConfigsToFile added in v0.0.3

func SaveAgentConfigsToFile(configs AgentConfigs, file *os.File) error

SaveAgentConfigsToFile saves agent configurations to a YAML file

func SaveMCPConfigToJSON added in v0.1.14

func SaveMCPConfigToJSON(config *MCPConfiguration, filePath string) error

SaveMCPConfigToJSON saves MCP configuration to a JSON file

func SaveMCPConfigToYAML added in v0.1.14

func SaveMCPConfigToYAML(config *MCPConfiguration, filePath string) error

SaveMCPConfigToYAML saves MCP configuration to a YAML file

func SaveTaskConfigsToFile added in v0.0.3

func SaveTaskConfigsToFile(configs TaskConfigs, file *os.File) error

SaveTaskConfigsToFile saves task configurations to a YAML file

func ValidateMCPConfig added in v0.1.14

func ValidateMCPConfig(config *MCPConfiguration) error

ValidateMCPConfig validates an MCP configuration

func ValidateRecursionDepth added in v0.0.26

func ValidateRecursionDepth(ctx context.Context) error

ValidateRecursionDepth checks if the recursion depth is within limits

func WithSubAgentContext added in v0.0.26

func WithSubAgentContext(ctx context.Context, parentAgent, subAgentName string) context.Context

WithSubAgentContext adds sub-agent context to the context

func WithTimeout added in v0.0.26

func WithTimeout(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

WithTimeout adds a timeout to the context for sub-agent calls

Types

type Agent

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

Agent represents an AI agent

func CreateAgentForTask added in v0.0.3

func CreateAgentForTask(taskName string, agentConfigs AgentConfigs, taskConfigs TaskConfigs, variables map[string]string, options ...Option) (*Agent, error)

CreateAgentForTask creates a new agent for a specific task

func NewAgent

func NewAgent(options ...Option) (*Agent, error)

NewAgent creates a new agent with the given options

func NewAgentFromConfig added in v0.0.3

func NewAgentFromConfig(agentName string, configs AgentConfigs, variables map[string]string, options ...Option) (*Agent, error)

NewAgentFromConfig creates a new agent from a YAML configuration

func NewAgentWithAutoConfig added in v0.0.3

func NewAgentWithAutoConfig(ctx context.Context, options ...Option) (*Agent, error)

NewAgentWithAutoConfig creates a new agent with automatic configuration generation based on the system prompt if explicit configuration is not provided

func (*Agent) ApproveExecutionPlan added in v0.0.2

func (a *Agent) ApproveExecutionPlan(ctx context.Context, plan *executionplan.ExecutionPlan) (string, error)

ApproveExecutionPlan approves an execution plan for execution

func (*Agent) Disconnect added in v0.0.26

func (a *Agent) Disconnect() error

Disconnect closes the connection to a remote agent

func (*Agent) ExecuteTaskFromConfig added in v0.0.3

func (a *Agent) ExecuteTaskFromConfig(ctx context.Context, taskName string, taskConfigs TaskConfigs, variables map[string]string) (string, error)

ExecuteTaskFromConfig executes a task using its YAML configuration

func (*Agent) GenerateExecutionPlan added in v0.0.2

func (a *Agent) GenerateExecutionPlan(ctx context.Context, input string) (*executionplan.ExecutionPlan, error)

GenerateExecutionPlan generates an execution plan

func (*Agent) GetAllConversations added in v0.1.7

func (a *Agent) GetAllConversations(ctx context.Context) ([]string, error)

GetAllConversations returns all conversation IDs from memory

func (*Agent) GetCapabilities added in v0.0.20

func (a *Agent) GetCapabilities() string

GetCapabilities returns a description of what the agent can do

func (*Agent) GetConversationMessages added in v0.1.7

func (a *Agent) GetConversationMessages(ctx context.Context, conversationID string) ([]interfaces.Message, error)

GetConversationMessages gets all messages for a specific conversation

func (*Agent) GetDescription added in v0.0.20

func (a *Agent) GetDescription() string

GetDescription returns the description of the agent

func (*Agent) GetGeneratedAgentConfig added in v0.0.3

func (a *Agent) GetGeneratedAgentConfig() *AgentConfig

GetGeneratedAgentConfig returns the automatically generated agent configuration, if any

func (*Agent) GetGeneratedTaskConfigs added in v0.0.3

func (a *Agent) GetGeneratedTaskConfigs() TaskConfigs

GetGeneratedTaskConfigs returns the automatically generated task configurations, if any

func (*Agent) GetLLM added in v0.0.43

func (a *Agent) GetLLM() interfaces.LLM

GetLLM returns the LLM instance (for use in custom functions)

func (*Agent) GetLogger added in v0.0.43

func (a *Agent) GetLogger() logging.Logger

GetLogger returns the logger instance (for use in custom functions)

func (*Agent) GetMemory added in v0.0.43

func (a *Agent) GetMemory() interfaces.Memory

GetMemory returns the memory instance (for use in custom functions)

func (*Agent) GetMemoryConfig added in v0.2.4

func (a *Agent) GetMemoryConfig() map[string]interface{}

GetMemoryConfig returns the stored memory configuration from YAML This allows agent-blueprint to access the memory config for instantiation

func (*Agent) GetMemoryStatistics added in v0.1.7

func (a *Agent) GetMemoryStatistics(ctx context.Context) (totalConversations, totalMessages int, err error)

GetMemoryStatistics returns basic memory statistics

func (*Agent) GetName added in v0.0.20

func (a *Agent) GetName() string

GetName returns the agent's name

func (*Agent) GetRemoteMetadata added in v0.1.7

func (a *Agent) GetRemoteMetadata() (map[string]string, error)

GetRemoteMetadata returns metadata for remote agents, nil for local agents

func (*Agent) GetRemoteURL added in v0.0.26

func (a *Agent) GetRemoteURL() string

GetRemoteURL returns the URL of the remote agent (empty string if not remote)

func (*Agent) GetSubAgent added in v0.0.26

func (a *Agent) GetSubAgent(name string) (*Agent, bool)

GetSubAgent retrieves a sub-agent by name

func (*Agent) GetSubAgents added in v0.0.26

func (a *Agent) GetSubAgents() []*Agent

GetSubAgents returns the sub-agents slice

func (*Agent) GetSystemPrompt added in v0.0.43

func (a *Agent) GetSystemPrompt() string

GetSystemPrompt returns the system prompt (for use in custom functions)

func (*Agent) GetTaskByID added in v0.0.2

func (a *Agent) GetTaskByID(taskID string) (*executionplan.ExecutionPlan, bool)

GetTaskByID returns a task by its ID

func (*Agent) GetTools added in v0.0.43

func (a *Agent) GetTools() []interfaces.Tool

GetTools returns the tools slice (for use in custom functions)

func (*Agent) GetTracer added in v0.0.43

func (a *Agent) GetTracer() interfaces.Tracer

GetTracer returns the tracer instance (for use in custom functions)

func (*Agent) HasSubAgent added in v0.0.26

func (a *Agent) HasSubAgent(name string) bool

HasSubAgent checks if a specific agent is a sub-agent

func (*Agent) IsRemote added in v0.0.26

func (a *Agent) IsRemote() bool

IsRemote returns true if this is a remote agent

func (*Agent) ListTasks added in v0.0.2

func (a *Agent) ListTasks() []*executionplan.ExecutionPlan

ListTasks returns a list of all tasks

func (*Agent) ModifyExecutionPlan added in v0.0.2

func (a *Agent) ModifyExecutionPlan(ctx context.Context, plan *executionplan.ExecutionPlan, modifications string) (*executionplan.ExecutionPlan, error)

ModifyExecutionPlan modifies an execution plan based on user input

func (*Agent) Run

func (a *Agent) Run(ctx context.Context, input string) (string, error)

Run runs the agent with the given input

func (*Agent) RunDetailed added in v0.1.13

func (a *Agent) RunDetailed(ctx context.Context, input string) (*interfaces.AgentResponse, error)

func (*Agent) RunStream added in v0.0.34

func (a *Agent) RunStream(ctx context.Context, input string) (<-chan interfaces.AgentStreamEvent, error)

RunStream executes the agent with streaming response

func (*Agent) RunStreamWithAuth added in v0.0.35

func (a *Agent) RunStreamWithAuth(ctx context.Context, input string, authToken string) (<-chan interfaces.AgentStreamEvent, error)

RunStreamWithAuth executes the agent with streaming response and explicit auth token

func (*Agent) RunWithAuth added in v0.0.29

func (a *Agent) RunWithAuth(ctx context.Context, input string, authToken string) (string, error)

func (*Agent) RunWithAuthDetailed added in v0.1.13

func (a *Agent) RunWithAuthDetailed(ctx context.Context, input string, authToken string) (*interfaces.AgentResponse, error)

type AgentConfig added in v0.0.3

type AgentConfig struct {
	Role           string                `yaml:"role"`
	Goal           string                `yaml:"goal"`
	Backstory      string                `yaml:"backstory"`
	ResponseFormat *ResponseFormatConfig `yaml:"response_format,omitempty"`
	MCP            *MCPConfiguration     `yaml:"mcp,omitempty"`

	// NEW: Behavioral settings
	MaxIterations       *int  `yaml:"max_iterations,omitempty"`
	RequirePlanApproval *bool `yaml:"require_plan_approval,omitempty"`

	// NEW: Complex configuration objects
	StreamConfig *StreamConfigYAML `yaml:"stream_config,omitempty"`
	LLMConfig    *LLMConfigYAML    `yaml:"llm_config,omitempty"`

	// NEW: LLM Provider configuration
	LLMProvider *LLMProviderYAML `yaml:"llm_provider,omitempty"`

	// NEW: Tool configurations
	Tools []ToolConfigYAML `yaml:"tools,omitempty"`

	// NEW: Memory configuration (config only)
	Memory *MemoryConfigYAML `yaml:"memory,omitempty"`

	// NEW: Runtime settings
	Runtime *RuntimeConfigYAML `yaml:"runtime,omitempty"`

	// NEW: Sub-agents configuration (recursive)
	SubAgents map[string]AgentConfig `yaml:"sub_agents,omitempty"`
}

AgentConfig represents the configuration for an agent loaded from YAML

type AgentConfigs added in v0.0.3

type AgentConfigs map[string]AgentConfig

AgentConfigs represents a map of agent configurations

func LoadAgentConfigsFromDir added in v0.0.3

func LoadAgentConfigsFromDir(dirPath string) (AgentConfigs, error)

LoadAgentConfigsFromDir loads all agent configurations from YAML files in a directory

func LoadAgentConfigsFromFile added in v0.0.3

func LoadAgentConfigsFromFile(filePath string) (AgentConfigs, error)

LoadAgentConfigsFromFile loads agent configurations from a YAML file

type AgentToolWrapper added in v0.2.4

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

AgentToolWrapper is a simple wrapper for agent tools (placeholder implementation) This would normally use the actual tools.AgentTool implementation

func (*AgentToolWrapper) Description added in v0.2.4

func (atw *AgentToolWrapper) Description() string

Description implements interfaces.Tool.Description

func (*AgentToolWrapper) Execute added in v0.2.4

func (atw *AgentToolWrapper) Execute(ctx context.Context, args string) (string, error)

Execute implements interfaces.Tool.Execute

func (*AgentToolWrapper) Name added in v0.2.4

func (atw *AgentToolWrapper) Name() string

Name implements interfaces.Tool.Name

func (*AgentToolWrapper) Parameters added in v0.2.4

func (atw *AgentToolWrapper) Parameters() map[string]interfaces.ParameterSpec

Parameters implements interfaces.Tool.Parameters

func (*AgentToolWrapper) Run added in v0.2.4

func (atw *AgentToolWrapper) Run(ctx context.Context, input string) (string, error)

Run implements interfaces.Tool.Run

type ContextKey added in v0.0.26

type ContextKey string

ContextKey is a type for context keys to avoid collisions

const (
	// SubAgentNameKey is the context key for sub-agent name
	SubAgentNameKey ContextKey = "sub_agent_name"

	// ParentAgentKey is the context key for parent agent
	ParentAgentKey ContextKey = "parent_agent"

	// RecursionDepthKey is the context key for recursion depth
	RecursionDepthKey ContextKey = "recursion_depth"

	// InvocationIDKey is the context key for invocation ID
	InvocationIDKey ContextKey = "invocation_id"

	// MaxRecursionDepth is the maximum allowed recursion depth
	MaxRecursionDepth = 5

	// DefaultSubAgentTimeout is the default timeout for sub-agent calls
	DefaultSubAgentTimeout = 30 * time.Second
)

type CustomRunFunction added in v0.0.43

type CustomRunFunction func(ctx context.Context, input string, agent *Agent) (string, error)

CustomRunFunction represents a custom function that can replace the default Run behavior

type CustomRunStreamFunction added in v0.0.43

type CustomRunStreamFunction func(ctx context.Context, input string, agent *Agent) (<-chan interfaces.AgentStreamEvent, error)

CustomRunStreamFunction represents a custom function that can replace the default RunStream behavior

type LLMConfigYAML added in v0.2.4

type LLMConfigYAML struct {
	Temperature      *float64 `yaml:"temperature,omitempty"`
	TopP             *float64 `yaml:"top_p,omitempty"`
	FrequencyPenalty *float64 `yaml:"frequency_penalty,omitempty"`
	PresencePenalty  *float64 `yaml:"presence_penalty,omitempty"`
	StopSequences    []string `yaml:"stop_sequences,omitempty"`
	EnableReasoning  *bool    `yaml:"enable_reasoning,omitempty"`
	ReasoningBudget  *int     `yaml:"reasoning_budget,omitempty"`
	Reasoning        *string  `yaml:"reasoning,omitempty"`
}

LLMConfigYAML represents LLM configuration in YAML

type LLMProviderYAML added in v0.2.4

type LLMProviderYAML struct {
	Provider string                 `yaml:"provider"`
	Model    string                 `yaml:"model,omitempty"`
	Config   map[string]interface{} `yaml:"config,omitempty"`
}

LLMProviderYAML represents LLM provider configuration in YAML

type LazyMCPConfig added in v0.0.42

type LazyMCPConfig struct {
	Name    string
	Type    string // "stdio" or "http"
	Command string
	Args    []string
	Env     []string
	URL     string
	Tools   []LazyMCPToolConfig
}

LazyMCPConfig holds configuration for lazy MCP server initialization

type LazyMCPToolConfig added in v0.0.42

type LazyMCPToolConfig struct {
	Name        string
	Description string
	Schema      interface{}
}

LazyMCPToolConfig holds configuration for a lazy MCP tool

type MCPConfiguration added in v0.1.14

type MCPConfiguration struct {
	MCPServers map[string]MCPServerConfig `json:"mcpServers" yaml:"mcpServers"`
	Global     *MCPGlobalConfig           `json:"global,omitempty" yaml:"global,omitempty"`
}

MCPConfiguration represents the complete MCP configuration

func GetMCPConfigFromAgent added in v0.1.14

func GetMCPConfigFromAgent(a *Agent) *MCPConfiguration

GetMCPConfigFromAgent extracts MCP configuration from an agent

func LoadMCPConfigFromJSON added in v0.1.14

func LoadMCPConfigFromJSON(filePath string) (*MCPConfiguration, error)

LoadMCPConfigFromJSON loads MCP configuration from a JSON file

func LoadMCPConfigFromYAML added in v0.1.14

func LoadMCPConfigFromYAML(filePath string) (*MCPConfiguration, error)

LoadMCPConfigFromYAML loads MCP configuration from a YAML file

type MCPDiscoveredCapabilities added in v0.1.14

type MCPDiscoveredCapabilities struct {
	SupportsTools     bool `json:"supportsTools,omitempty"`
	SupportsResources bool `json:"supportsResources,omitempty"`
	SupportsPrompts   bool `json:"supportsPrompts,omitempty"`
}

MCPDiscoveredCapabilities represents capabilities discovered from the server

type MCPDiscoveredServerInfo added in v0.1.14

type MCPDiscoveredServerInfo struct {
	Name         string                     `json:"name,omitempty"`
	Title        string                     `json:"title,omitempty"`
	Version      string                     `json:"version,omitempty"`
	Capabilities *MCPDiscoveredCapabilities `json:"capabilities,omitempty"`
}

MCPDiscoveredServerInfo represents metadata discovered from the server at runtime

type MCPGlobalConfig added in v0.1.14

type MCPGlobalConfig struct {
	Timeout         string `json:"timeout,omitempty" yaml:"timeout,omitempty"` // e.g., "30s"
	RetryAttempts   int    `json:"retry_attempts,omitempty" yaml:"retry_attempts,omitempty"`
	HealthCheck     *bool  `json:"health_check,omitempty" yaml:"health_check,omitempty"`
	EnableResources *bool  `json:"enable_resources,omitempty" yaml:"enable_resources,omitempty"`
	EnablePrompts   *bool  `json:"enable_prompts,omitempty" yaml:"enable_prompts,omitempty"`
	EnableSampling  *bool  `json:"enable_sampling,omitempty" yaml:"enable_sampling,omitempty"`
	EnableSchemas   *bool  `json:"enable_schemas,omitempty" yaml:"enable_schemas,omitempty"`
	LogLevel        string `json:"log_level,omitempty" yaml:"log_level,omitempty"`
}

MCPGlobalConfig represents global MCP settings

type MCPServerConfig added in v0.1.14

type MCPServerConfig struct {
	Command string            `json:"command,omitempty" yaml:"command,omitempty"`
	Args    []string          `json:"args,omitempty" yaml:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	URL     string            `json:"url,omitempty" yaml:"url,omitempty"`
	Token   string            `json:"token,omitempty" yaml:"token,omitempty"`
}

MCPServerConfig represents a single MCP server configuration

func (*MCPServerConfig) GetServerType added in v0.1.14

func (c *MCPServerConfig) GetServerType() string

GetServerType returns the server type based on configuration

type MemoryConfigYAML added in v0.2.4

type MemoryConfigYAML struct {
	Type   string                 `yaml:"type"` // "buffer", "redis", "vector"
	Config map[string]interface{} `yaml:"config,omitempty"`
}

MemoryConfigYAML represents memory configuration in YAML

type Option

type Option func(*Agent)

Option represents an option for configuring an agent

func WithAgentConfig added in v0.0.3

func WithAgentConfig(config AgentConfig, variables map[string]string) Option

WithAgentConfig sets the agent configuration from a YAML config

func WithAgents added in v0.0.26

func WithAgents(subAgents ...*Agent) Option

WithAgents sets the sub-agents that can be called as tools

func WithCustomRunFunction added in v0.0.43

func WithCustomRunFunction(fn CustomRunFunction) Option

WithCustomRunFunction sets a custom run function that replaces the default Run behavior

func WithCustomRunStreamFunction added in v0.0.43

func WithCustomRunStreamFunction(fn CustomRunStreamFunction) Option

WithCustomRunStreamFunction sets a custom streaming run function that replaces the default RunStream behavior

func WithDescription added in v0.0.20

func WithDescription(description string) Option

WithDescription sets the description for the agent

func WithGuardrails

func WithGuardrails(guardrails interfaces.Guardrails) Option

WithGuardrails sets the guardrails for the agent

func WithLLM

func WithLLM(llm interfaces.LLM) Option

WithLLM sets the LLM for the agent

func WithLLMConfig added in v0.0.11

func WithLLMConfig(config interfaces.LLMConfig) Option

func WithLazyMCPConfigs added in v0.0.42

func WithLazyMCPConfigs(configs []LazyMCPConfig) Option

WithLazyMCPConfigs sets the lazy MCP server configurations for the agent

func WithLogger added in v0.0.36

func WithLogger(logger logging.Logger) Option

WithLogger sets the logger for the agent

func WithMCPConfig added in v0.1.14

func WithMCPConfig(config *MCPConfiguration) Option

WithMCPConfig adds MCP servers from configuration object

func WithMCPConfigFromJSON added in v0.1.14

func WithMCPConfigFromJSON(filePath string) Option

WithMCPConfigFromJSON adds MCP servers from a JSON configuration file

func WithMCPConfigFromYAML added in v0.1.14

func WithMCPConfigFromYAML(filePath string) Option

WithMCPConfigFromYAML adds MCP servers from a YAML configuration file

func WithMCPPresets added in v0.1.14

func WithMCPPresets(presetNames ...string) Option

WithMCPPresets adds predefined MCP server configurations

func WithMCPServers added in v0.0.13

func WithMCPServers(mcpServers []interfaces.MCPServer) Option

WithMCPServers sets the MCP servers for the agent

func WithMCPURLs added in v0.1.14

func WithMCPURLs(urls ...string) Option

WithMCPURLs adds MCP servers from URL strings Supports formats: - stdio://command/path/to/executable - http://localhost:8080/mcp - https://api.example.com/mcp?token=xxx - mcp://preset-name (for presets)

func WithMaxIterations added in v0.0.19

func WithMaxIterations(maxIterations int) Option

WithMaxIterations sets the maximum number of tool-calling iterations for the agent

func WithMemory

func WithMemory(memory interfaces.Memory) Option

WithMemory sets the memory for the agent

func WithName added in v0.0.2

func WithName(name string) Option

WithName sets the name for the agent

func WithOrgID

func WithOrgID(orgID string) Option

WithOrgID sets the organization ID for multi-tenancy

func WithRemoteTimeout added in v0.0.29

func WithRemoteTimeout(timeout time.Duration) Option

WithRemoteTimeout sets the timeout for remote agent operations

func WithRequirePlanApproval added in v0.0.2

func WithRequirePlanApproval(require bool) Option

WithRequirePlanApproval sets whether execution plans require user approval

func WithResponseFormat added in v0.0.4

func WithResponseFormat(formatType interfaces.ResponseFormat) Option

WithResponseFormat sets the response format for the agent

func WithStreamConfig added in v0.0.46

func WithStreamConfig(config *interfaces.StreamConfig) Option

WithStreamConfig sets the streaming configuration for the agent

func WithSystemPrompt

func WithSystemPrompt(prompt string) Option

WithSystemPrompt sets the system prompt for the agent

func WithTools

func WithTools(tools ...interfaces.Tool) Option

WithTools sets the tools for the agent

func WithTracer

func WithTracer(tracer interfaces.Tracer) Option

WithTracer sets the tracer for the agent

func WithURL added in v0.0.26

func WithURL(url string) Option

WithURL creates a remote agent that communicates via gRPC

type ResponseFormatConfig added in v0.0.24

type ResponseFormatConfig struct {
	Type             string                 `yaml:"type"`
	SchemaName       string                 `yaml:"schema_name"`
	SchemaDefinition map[string]interface{} `yaml:"schema_definition"`
}

ResponseFormatConfig represents the configuration for the response format of an agent or task

type RuntimeConfigYAML added in v0.2.4

type RuntimeConfigYAML struct {
	LogLevel        string `yaml:"log_level,omitempty"` // "debug", "info", "warn", "error"
	EnableTracing   *bool  `yaml:"enable_tracing,omitempty"`
	EnableMetrics   *bool  `yaml:"enable_metrics,omitempty"`
	TimeoutDuration string `yaml:"timeout_duration,omitempty"` // "30s", "5m"
}

RuntimeConfigYAML represents runtime behavior settings in YAML

type StreamConfigYAML added in v0.2.4

type StreamConfigYAML struct {
	BufferSize                  *int  `yaml:"buffer_size,omitempty"`
	IncludeToolProgress         *bool `yaml:"include_tool_progress,omitempty"`
	IncludeIntermediateMessages *bool `yaml:"include_intermediate_messages,omitempty"`
}

StreamConfigYAML represents streaming configuration in YAML

type SubAgentContext added in v0.0.26

type SubAgentContext struct {
	ParentAgent    string
	SubAgentName   string
	RecursionDepth int
	InvocationID   string
	StartTime      time.Time
}

SubAgentContext contains context information for sub-agent invocations

type TaskConfig added in v0.0.3

type TaskConfig struct {
	Description    string                `yaml:"description"`
	ExpectedOutput string                `yaml:"expected_output"`
	Agent          string                `yaml:"agent"`
	OutputFile     string                `yaml:"output_file,omitempty"`
	ResponseFormat *ResponseFormatConfig `yaml:"response_format,omitempty"`
}

TaskConfig represents a task definition loaded from YAML

type TaskConfigs added in v0.0.3

type TaskConfigs map[string]TaskConfig

TaskConfigs represents a map of task configurations

func LoadTaskConfigsFromDir added in v0.0.3

func LoadTaskConfigsFromDir(dirPath string) (TaskConfigs, error)

LoadTaskConfigsFromDir loads all task configurations from YAML files in a directory

func LoadTaskConfigsFromFile added in v0.0.3

func LoadTaskConfigsFromFile(filePath string) (TaskConfigs, error)

LoadTaskConfigsFromFile loads task configurations from a YAML file

type ToolConfigYAML added in v0.2.4

type ToolConfigYAML struct {
	Type        string                 `yaml:"type"` // "builtin", "custom", "mcp", "agent"
	Name        string                 `yaml:"name"`
	Description string                 `yaml:"description,omitempty"`
	Config      map[string]interface{} `yaml:"config,omitempty"`
	Enabled     *bool                  `yaml:"enabled,omitempty"`

	// For agent tools
	URL     string `yaml:"url,omitempty"`     // Remote agent URL
	Timeout string `yaml:"timeout,omitempty"` // Timeout duration
}

ToolConfigYAML represents tool configuration in YAML

type ToolFactory added in v0.2.4

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

ToolFactory creates tools from YAML configuration

func NewToolFactory added in v0.2.4

func NewToolFactory() *ToolFactory

NewToolFactory creates a new tool factory with builtin tools registered

func (*ToolFactory) CreateTool added in v0.2.4

func (tf *ToolFactory) CreateTool(config ToolConfigYAML) (interfaces.Tool, error)

CreateTool creates a tool from YAML configuration

func (*ToolFactory) CreateToolWithParentConfig added in v0.2.4

func (tf *ToolFactory) CreateToolWithParentConfig(config ToolConfigYAML, parentConfig *AgentConfig) (interfaces.Tool, error)

CreateToolWithParentConfig creates a tool from YAML configuration with access to parent agent config

func (*ToolFactory) RegisterCustomTool added in v0.2.4

func (tf *ToolFactory) RegisterCustomTool(name string, factory func(map[string]interface{}) (interfaces.Tool, error))

RegisterCustomTool allows external registration of custom tools

Jump to

Keyboard shortcuts

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