setup

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const BenchmarkToolPrefix = "benchmark_tool_"
View Source
const BenchmarkTreeSeed int64 = 42
View Source
const MockLLMModel = "benchmark-mock"
View Source
const RootAgentName = "benchmark-agent"

Variables

This section is empty.

Functions

func AppendMemoryOptions added in v0.2.2

func AppendMemoryOptions(cfg *Config, opts []agent.Option) ([]agent.Option, error)

AppendMemoryOptions adds WithMemory when memory is enabled in cfg.

func CloseAgents

func CloseAgents(agents []*agent.Agent)

func DefaultConfigPath

func DefaultConfigPath() string

DefaultConfigPath returns the default benchmark config file path.

func FindRepoRoot

func FindRepoRoot(from string) (string, error)

func MemoryAgentOption added in v0.2.2

func MemoryAgentOption(cfg *Config) (agent.Option, error)

MemoryAgentOption returns WithMemory when memory is enabled.

func RandomUserPrompt

func RandomUserPrompt(rng *rand.Rand) string

func RegisterBenchmarkTools

func RegisterBenchmarkTools(count int, cfg ToolConfig, rng *rand.Rand) agent.ToolRegistry

func RootOptions

func RootOptions(
	cfg *Config,
	llm interfaces.LLMClient,
	lgr logger.Logger,
	name, systemPrompt string,
	subAgents []*agent.Agent,
	taskQueue string,
) []agent.Option

RootOptions returns agent options shared by the benchmark root agent and root worker.

func RootSystemPrompt

func RootSystemPrompt(treeRng *rand.Rand) string

func RunRNG

func RunRNG() *rand.Rand

func SetupAgentLogger

func SetupAgentLogger(cfg *Config, repoRoot string) (logger.Logger, func(), error)

func SetupWorkerLogger

func SetupWorkerLogger(cfg *Config, repoRoot string, workerID int) (logger.Logger, func(), error)

func TaskQueueFor

func TaskQueueFor(cfg *Config, suffix string) string

func TreeRNG

func TreeRNG() *rand.Rand

Types

type AgentConfig

type AgentConfig struct {
	Runs            int              `yaml:"runs"`
	Concurrent      bool             `yaml:"concurrent"`
	ConcurrentCount int              `yaml:"concurrent_count"`
	Tools           AgentToolsConfig `yaml:"tools"`
	Subagents       SubagentsConfig  `yaml:"subagents"`
}

type AgentToolsConfig

type AgentToolsConfig struct {
	Count     int    `yaml:"count"`
	Execution string `yaml:"execution"`
}

type AgentTree

type AgentTree struct {
	RootPrompt string
	SubAgents  []*agent.Agent
	Created    []*agent.Agent
}

func BuildAgentTree

func BuildAgentTree(cfg *Config, llm interfaces.LLMClient, lgr logger.Logger) (*AgentTree, error)

type Config

type Config struct {
	Runtime  string         `yaml:"runtime"`
	Temporal TemporalConfig `yaml:"temporal"`
	LLM      LLMConfig      `yaml:"llm"`
	Tool     ToolConfig     `yaml:"tool"`
	Agent    AgentConfig    `yaml:"agent"`
	Memory   MemoryConfig   `yaml:"memory"`
	Logger   LoggerConfig   `yaml:"logger"`
	Output   OutputConfig   `yaml:"output"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) ExternalWorkersEnabled

func (c *Config) ExternalWorkersEnabled() bool

func (*Config) LogDir

func (c *Config) LogDir(repoRoot string) string

func (*Config) MemoryEnabled added in v0.2.2

func (c *Config) MemoryEnabled() bool

MemoryEnabled reports whether long-term memory is wired for benchmark runs.

func (*Config) OutputDir

func (c *Config) OutputDir(repoRoot string) string

func (*Config) UseTemporal

func (c *Config) UseTemporal() bool

type LLMConfig

type LLMConfig struct {
	LatencyMs  int `yaml:"latency_ms"`
	JitterMs   int `yaml:"jitter_ms"`
	MockTokens int `yaml:"mock_tokens"`
}

type LLMStats

type LLMStats struct {
	TotalInputTokens  int
	TotalOutputTokens int
	// contains filtered or unexported fields
}

func NewLLMStats

func NewLLMStats() *LLMStats

func (*LLMStats) Snapshot

func (s *LLMStats) Snapshot() (input, output int)

type LoggerConfig

type LoggerConfig struct {
	Enabled bool   `yaml:"enabled"`
	Dir     string `yaml:"dir"`
	Level   string `yaml:"level"`
}

type MemoryConfig added in v0.2.2

type MemoryConfig struct {
	Enabled   bool   `yaml:"enabled"`
	StoreMode string `yaml:"store_mode"`
	UserID    string `yaml:"user_id"`
}

MemoryConfig configures long-term memory for benchmark runs.

type MockBenchmarkTool

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

func NewMockBenchmarkTool

func NewMockBenchmarkTool(index int, cfg ToolConfig, rng *rand.Rand) *MockBenchmarkTool

func (*MockBenchmarkTool) Description

func (t *MockBenchmarkTool) Description() string

func (*MockBenchmarkTool) DisplayName

func (t *MockBenchmarkTool) DisplayName() string

func (*MockBenchmarkTool) Execute

func (t *MockBenchmarkTool) Execute(ctx context.Context, args map[string]any) (any, error)

func (*MockBenchmarkTool) Name

func (t *MockBenchmarkTool) Name() string

func (*MockBenchmarkTool) Parameters

func (t *MockBenchmarkTool) Parameters() interfaces.JSONSchema

type MockLLMClient

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

func NewMockLLMClient

func NewMockLLMClient(cfg LLMConfig, stats *LLMStats, rng *rand.Rand) *MockLLMClient

func (*MockLLMClient) Generate

func (*MockLLMClient) GenerateStream

func (m *MockLLMClient) GenerateStream(ctx context.Context, request *interfaces.LLMRequest) (interfaces.LLMStream, error)

func (*MockLLMClient) GetModel

func (m *MockLLMClient) GetModel() string

func (*MockLLMClient) GetProvider

func (m *MockLLMClient) GetProvider() interfaces.LLMProvider

func (*MockLLMClient) IsStreamSupported

func (m *MockLLMClient) IsStreamSupported() bool

func (*MockLLMClient) Stats

func (m *MockLLMClient) Stats() *LLMStats

type OutputConfig

type OutputConfig struct {
	Console bool   `yaml:"console"`
	File    bool   `yaml:"file"`
	Dir     string `yaml:"dir"`
	Format  string `yaml:"format"`
}

type SubagentsConfig

type SubagentsConfig struct {
	Count  int `yaml:"count"`
	Levels int `yaml:"levels"`
}

type TemporalConfig

type TemporalConfig struct {
	Host         string `yaml:"host"`
	Port         int    `yaml:"port"`
	Namespace    string `yaml:"namespace"`
	TaskQueue    string `yaml:"task_queue"`
	WorkersCount int    `yaml:"workers_count"`
}

type ToolConfig

type ToolConfig struct {
	LatencyMs int `yaml:"latency_ms"`
	JitterMs  int `yaml:"jitter_ms"`
}

Jump to

Keyboard shortcuts

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