Documentation
¶
Overview ¶
Package aiagent contains the ai-agent node implementation: runs the model ↔ tool-call loop through github.com/dracory/llm's ToolsInterface.GenerateWithTools — the caller (this node) executes each requested tool by injecting a call message into an ai-tool node's flow and awaiting its ai-tool-return. Output 1 carries the final answer, output 2 the tool-call trace. Iterations are capped and every model/tool call runs under a timeout; conversation history optionally round-trips through an ai-memory config node.
Index ¶
Constants ¶
const Type = "ai-agent"
Type is the registered node type id.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentNode ¶
AgentNode is the ai-agent executor.
func NewAgentNode ¶
NewAgentNode creates a new ai-agent node. host may be nil — provider/tool resolution then fails with explicit errors.
func (*AgentNode) Execute ¶
func (n *AgentNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute runs the agent loop and returns the message carrying the final answer (routed to output 1 by SelectPorts); the tool-call trace is emitted on output 2.
func (*AgentNode) SelectPorts ¶
func (n *AgentNode) SelectPorts(input, output nodestore.MessageInterface) []string
SelectPorts routes the returned message to output 1 only — the trace left through an explicit output-2 emit inside Execute.
type Config ¶
type Config struct {
// Provider is the ID of the ai-provider config node to call through.
Provider string `json:"provider"`
// Memory is the optional ID of an ai-memory config node.
Memory string `json:"memory"`
// SystemPrompt is sent verbatim as the system message.
SystemPrompt string `json:"systemPrompt"`
// Prompt is the mustache template rendered against the message.
Prompt string `json:"prompt"`
// Tools is a comma-separated list of ai-tool references:
// "nodeID" within the same workflow or "workflowID/nodeID" for a
// tool flow living in another running workflow.
Tools string `json:"tools"`
// MaxIterations caps model ↔ tool rounds (default 8).
MaxIterations int `json:"maxIterations"`
// TimeoutSeconds is the per-model-call timeout; overrides the
// provider default when > 0.
TimeoutSeconds float64 `json:"timeoutSeconds"`
// ToolTimeoutSeconds bounds each tool invocation (default 60).
ToolTimeoutSeconds float64 `json:"toolTimeoutSeconds"`
// Target is the message property the final answer is written to.
Target string `json:"target"`
// Concurrency caps in-flight agent runs; <= 0 means unlimited.
Concurrency int `json:"concurrency"`
}
Config holds the ai-agent configuration.