agent

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Spec processing constants
	MaxIterations = 10 // Maximum iterations for spec processing
)

Variables

This section is empty.

Functions

func BuildTestPlanPrompt

func BuildTestPlanPrompt(what, focus string) string

BuildTestPlanPrompt generates tests based on detailed endpoint description The main agent uses SearchSpec to gather full endpoint details and passes them in 'what'

Types

type APIEndpoint

type APIEndpoint struct {
	Method       string `json:"method"`
	Path         string `json:"path"`
	Description  string `json:"description"`
	RequiresAuth bool   `json:"requires_auth"`
	AuthType     string `json:"auth_type"`
}

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

func NewAgent

func NewAgent(baseURL string) (*Agent, error)

func (*Agent) Chat

func (a *Agent) Chat(messages []ChatMessage, thinkingEnabled bool, endpointsList ...string) (*ChatResponse, error)

func (*Agent) ChatStream

func (a *Agent) ChatStream(messages []ChatMessage, thinkingEnabled bool, callback ReasoningCallback, endpointsList ...string) (*ChatResponse, error)

func (*Agent) GenerateTestPlan

func (a *Agent) GenerateTestPlan(what, focus string) ([]Test, int64, error)

func (*Agent) ProcessSpecification

func (a *Agent) ProcessSpecification(rawContent string, baseURL string) ([]APIEndpoint, error)

type BaseAgent

type BaseAgent struct {
	// contains filtered or unexported fields
}

func NewBaseAgent

func NewBaseAgent(provider common.Provider) *BaseAgent

func (*BaseAgent) Chat

func (a *BaseAgent) Chat(systemPrompt string, tools []common.Tool, inputMessages []ChatMessage, thinkingEnabled bool) (*ChatResponse, error)

func (*BaseAgent) ChatStream

func (a *BaseAgent) ChatStream(systemPrompt string, tools []common.Tool, inputMessages []ChatMessage, thinkingEnabled bool, callback ReasoningCallback) (*ChatResponse, error)

type ChatMessage

type ChatMessage struct {
	Role             string                `json:"role"`
	Content          string                `json:"content"`
	ReasoningContent string                `json:"reasoning_content,omitempty"`
	FunctionCalls    []ToolCall            `json:"function_calls,omitempty"`
	FunctionResponse *FunctionResponseData `json:"function_response,omitempty"`
	InputTokens      int64                 `json:"input_tokens,omitempty"`
	OutputTokens     int64                 `json:"output_tokens,omitempty"`
}

type ChatResponse

type ChatResponse struct {
	Message      string     `json:"message"`
	Reasoning    string     `json:"reasoning,omitempty"`
	ToolCalls    []ToolCall `json:"tool_calls,omitempty"`
	TokensUsed   int64      `json:"tokens_used,omitempty"`   // Total tokens (input + output)
	InputTokens  int64      `json:"input_tokens,omitempty"`  // Input tokens used
	OutputTokens int64      `json:"output_tokens,omitempty"` // Output tokens used
}

type FunctionResponseData

type FunctionResponseData struct {
	ID       string         `json:"id"` // tool_use_id from original tool use block
	Name     string         `json:"name"`
	Response map[string]any `json:"response"`
}

type ReasoningCallback

type ReasoningCallback func(chunk string, isThought bool)

ReasoningCallback is called for each chunk as it's streamed isThought=true for reasoning chunks, false for text chunks

type Test

type Test struct {
	TestCase TestCase   `json:"test_case"`
	Status   TestStatus `json:"status"`
	Analysis string     `json:"analysis,omitempty"`
}

type TestCase

type TestCase struct {
	ID             int               `json:"id"`
	Description    string            `json:"description"`
	Method         string            `json:"method"`
	Endpoint       string            `json:"endpoint"`
	Headers        map[string]string `json:"headers,omitempty"`
	Body           interface{}       `json:"body,omitempty"`
	ExpectedStatus int               `json:"expected_status"`
	Reasoning      string            `json:"reasoning"`
	RequiresAuth   bool              `json:"requires_auth"`
}

type TestPlan

type TestPlan struct {
	Tests []TestCase `json:"tests"`
}

type TestStatus

type TestStatus string
const (
	StatusPending TestStatus = "pending"
	StatusRunning TestStatus = "running"
	StatusPassed  TestStatus = "passed"
	StatusFailed  TestStatus = "failed"
)

type ToolCall

type ToolCall struct {
	ID               string         `json:"id,omitempty"`
	Name             string         `json:"name"`
	Arguments        map[string]any `json:"arguments"`
	ThoughtSignature string         `json:"thought_signature,omitempty"` // base64 encoded []byte (not used by Claude)
}

Jump to

Keyboard shortcuts

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