Documentation
¶
Overview ¶
Package iteragent provides iterative agent framework integration for TokMan
Index ¶
- type Action
- type Agent
- func (a *Agent) ClearMemory()
- func (a *Agent) Execute(ctx context.Context, goal string) (*Result, error)
- func (a *Agent) GetIterations() []Iteration
- func (a *Agent) GetState() AgentState
- func (a *Agent) GetTool(name string) (Tool, bool)
- func (a *Agent) ID() string
- func (a *Agent) Name() string
- func (a *Agent) Pause() error
- func (a *Agent) RegisterTool(tool Tool)
- func (a *Agent) Resume(ctx context.Context) error
- func (a *Agent) SetEventHandler(handler EventHandler)
- type AgentConfig
- type AgentState
- type AgentStatus
- type Event
- type EventHandler
- type EventType
- type Iteration
- type Manager
- type Memory
- type MemoryEntry
- type Parameter
- type Result
- type TokenUsage
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Type string
Tool string
Parameters map[string]interface{}
Result interface{}
Error error
}
Action represents an action taken by the agent
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents an iterative agent capable of multi-step reasoning
func (*Agent) GetIterations ¶
GetIterations returns all iterations
func (*Agent) RegisterTool ¶
RegisterTool registers a tool for the agent
func (*Agent) SetEventHandler ¶
func (a *Agent) SetEventHandler(handler EventHandler)
SetEventHandler sets the event handler
type AgentConfig ¶
type AgentConfig struct {
Name string
Description string
MaxIterations int
Timeout time.Duration
Temperature float64
SystemPrompt string
AllowedTools []string
RequireApproval bool
EnableReflection bool
}
AgentConfig holds agent configuration
type AgentState ¶
type AgentState struct {
Status AgentStatus
CurrentGoal string
Context map[string]interface{}
Variables map[string]string
StartTime time.Time
EndTime *time.Time
}
AgentState represents the agent's current state
type AgentStatus ¶
type AgentStatus string
AgentStatus represents agent status
const ( StatusIdle AgentStatus = "idle" StatusRunning AgentStatus = "running" StatusPaused AgentStatus = "paused" StatusCompleted AgentStatus = "completed" StatusFailed AgentStatus = "failed" StatusAborted AgentStatus = "aborted" )
type Event ¶
type Event struct {
Type EventType
Timestamp time.Time
AgentID string
Iteration int
Message string
Data interface{}
}
Event represents an agent event
type EventType ¶
type EventType string
EventType represents event types
const ( EventStarted EventType = "started" EventIteration EventType = "iteration" EventThinking EventType = "thinking" EventAction EventType = "action" EventObservation EventType = "observation" EventReflection EventType = "reflection" EventCompleted EventType = "completed" EventFailed EventType = "failed" EventAborted EventType = "aborted" )
type Iteration ¶
type Iteration struct {
Number int
Timestamp time.Time
Thought string
Action Action
Observation string
Reflection string
Duration time.Duration
}
Iteration represents a single iteration of the agent
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple agents
func (*Manager) CreateAgent ¶
func (m *Manager) CreateAgent(config AgentConfig) *Agent
CreateAgent creates a new agent
func (*Manager) DeleteAgent ¶
DeleteAgent deletes an agent
type Memory ¶
type Memory struct {
ShortTerm []MemoryEntry
LongTerm []MemoryEntry
Working map[string]interface{}
// contains filtered or unexported fields
}
Memory provides agent memory capabilities
type MemoryEntry ¶
type MemoryEntry struct {
Timestamp time.Time
Type string
Content string
Importance float64
Metadata map[string]string
}
MemoryEntry represents a memory entry
type Result ¶
type Result struct {
Success bool
Output string
Iterations int
Duration time.Duration
ToolsUsed []string
TokenUsage TokenUsage
FinalState map[string]interface{}
}
Result holds the final result of agent execution
type TokenUsage ¶
TokenUsage tracks token consumption