aiagent

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const Type = "ai-agent"

Type is the registered node type id.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentNode

type AgentNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

AgentNode is the ai-agent executor.

func NewAgentNode

func NewAgentNode(node nodestore.NodeInterface, config *Config, host nodebase.NodeHost) *AgentNode

NewAgentNode creates a new ai-agent node. host may be nil — provider/tool resolution then fails with explicit errors.

func (*AgentNode) Execute

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.

func (*AgentNode) Validate

func (n *AgentNode) Validate() error

Validate checks the structural config: a provider reference is required and max-iterations, when set, must be positive.

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.

Jump to

Keyboard shortcuts

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