Documentation
¶
Overview ¶
Package agent provides tool definitions and handlers for wetwire-core-go integration. These tools are used by the RunnerAgent to execute CLI commands for AI-assisted pipeline design and persona-based testing.
Index ¶
- type Event
- type Metrics
- type Param
- type Score
- type Session
- func (s *Session) AddError(err string)
- func (s *Session) AddEvent(event Event)
- func (s *Session) AddMessage(message string)
- func (s *Session) AddToolCall(tool string, args map[string]any)
- func (s *Session) AddToolResult(tool string, result ToolResult)
- func (s *Session) End(result *SessionResult)
- func (s *Session) SaveTo(path string) error
- type SessionResult
- type Tool
- type ToolHandler
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Timestamp time.Time `json:"timestamp"`
Type string `json:"type"` // "tool_call", "tool_result", "message", "error"
Tool string `json:"tool,omitempty"`
Args map[string]any `json:"args,omitempty"`
Result *ToolResult `json:"result,omitempty"`
Message string `json:"message,omitempty"`
}
Event represents an event in a session.
type Metrics ¶
type Metrics struct {
TotalToolCalls int `json:"total_tool_calls"`
ToolCallCounts map[string]int `json:"tool_call_counts,omitempty"`
LintCycles int `json:"lint_cycles"`
BuildAttempts int `json:"build_attempts"`
Duration time.Duration `json:"duration"`
}
Metrics holds session metrics.
type Param ¶
type Param struct {
Type string `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
Default any `json:"default,omitempty"`
}
Param represents a tool parameter.
type Score ¶
type Score struct {
Overall float64 `json:"overall"`
Categories map[string]float64 `json:"categories,omitempty"`
Feedback []string `json:"feedback,omitempty"`
}
Score holds evaluation scores for a session.
type Session ¶
type Session struct {
ID string `json:"id"`
Type string `json:"type"` // "design" or "test"
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time,omitempty"`
Persona string `json:"persona,omitempty"`
Config map[string]any `json:"config,omitempty"`
Events []Event `json:"events,omitempty"`
Result *SessionResult `json:"result,omitempty"`
}
Session represents an agent session for design or testing.
func LoadSession ¶
LoadSession loads a session from a file.
func NewSession ¶
NewSession creates a new session.
func (*Session) AddMessage ¶
AddMessage adds a message event.
func (*Session) AddToolCall ¶
AddToolCall adds a tool call event.
func (*Session) AddToolResult ¶
func (s *Session) AddToolResult(tool string, result ToolResult)
AddToolResult adds a tool result event.
func (*Session) End ¶
func (s *Session) End(result *SessionResult)
End marks the session as complete.
type SessionResult ¶
type SessionResult struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
FilesCreated []string `json:"files_created,omitempty"`
Score *Score `json:"score,omitempty"`
Metrics *Metrics `json:"metrics,omitempty"`
}
SessionResult holds the final result of a session.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]Param `json:"parameters"`
Required []string `json:"required,omitempty"`
}
Tool represents a tool that can be executed by the RunnerAgent.
type ToolHandler ¶
type ToolHandler struct {
// contains filtered or unexported fields
}
ToolHandler handles tool execution.
func NewToolHandler ¶
func NewToolHandler(wetwireBin string) *ToolHandler
NewToolHandler creates a new tool handler. If wetwireBin is empty, it attempts to find the binary in PATH.
func (*ToolHandler) Execute ¶
func (h *ToolHandler) Execute(toolName string, args map[string]any) ToolResult
Execute runs a tool with the given arguments.
type ToolResult ¶
type ToolResult struct {
Success bool `json:"success"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
ToolResult holds the result of executing a tool.