easy

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Name         string
	Model        string
	SystemPrompt string
	Tools        map[string]ToolFunc
	MaxTokens    int
	MaxCostUSD   float64
	APIKey       string
	BaseURL      string
}

Agent provides a 3-line high-level abstraction for developing governed AI agents.

func New

func New(name string) *Agent

New creates a new lightweight governed Agent.

func (*Agent) Run

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

Run executes the agent task with automatic tool dispatching, receipts generation, and budgeting.

func (*Agent) WithTool

func (a *Agent) WithTool(name string, fn ToolFunc) *Agent

WithTool registers a tool function on the Agent.

type Receipt

type Receipt struct {
	Tool     string        `json:"tool"`
	Duration time.Duration `json:"duration"`
	Hash     string        `json:"hash"`
	Status   string        `json:"status"`
}

Receipt represents an immutable audit receipt of a tool invocation.

type Result

type Result struct {
	Content  string    `json:"content"`
	Receipts []Receipt `json:"receipts"`
	Tokens   int       `json:"tokens"`
	CostUSD  float64   `json:"costUsd"`
}

Result encapsulates the agent execution output, receipts, and budget audit.

type ToolFunc

type ToolFunc func(ctx context.Context, input string) (string, error)

ToolFunc is the signature for an idiomatic Go tool.

Jump to

Keyboard shortcuts

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