setup

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 14 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 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 RandomUserPrompt

func RandomUserPrompt(rng *rand.Rand) string

func RegisterBenchmarkTools

func RegisterBenchmarkTools(count int, cfg ToolConfig, rng *rand.Rand) *tools.Registry

func RootOptions

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

RootOptions returns agent options shared by the benchmark root agent and root worker. enableRemoteWorkers is agent-only (EnableRemoteWorkers).

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              `mapstructure:"runs"`
	Concurrent      bool             `mapstructure:"concurrent"`
	ConcurrentCount int              `mapstructure:"concurrent_count"`
	Tools           AgentToolsConfig `mapstructure:"tools"`
	Subagents       SubagentsConfig  `mapstructure:"subagents"`
}

type AgentToolsConfig

type AgentToolsConfig struct {
	Count     int    `mapstructure:"count"`
	Execution string `mapstructure:"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         `mapstructure:"runtime"`
	Temporal TemporalConfig `mapstructure:"temporal"`
	LLM      LLMConfig      `mapstructure:"llm"`
	Tool     ToolConfig     `mapstructure:"tool"`
	Agent    AgentConfig    `mapstructure:"agent"`
	Logger   LoggerConfig   `mapstructure:"logger"`
	Output   OutputConfig   `mapstructure:"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) OutputDir

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

func (*Config) UseTemporal

func (c *Config) UseTemporal() bool

type LLMConfig

type LLMConfig struct {
	LatencyMs  int `mapstructure:"latency_ms"`
	JitterMs   int `mapstructure:"jitter_ms"`
	MockTokens int `mapstructure:"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   `mapstructure:"enabled"`
	Dir     string `mapstructure:"dir"`
	Level   string `mapstructure:"level"`
}

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   `mapstructure:"console"`
	File    bool   `mapstructure:"file"`
	Dir     string `mapstructure:"dir"`
	Format  string `mapstructure:"format"`
}

type SubagentsConfig

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

type TemporalConfig

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

type ToolConfig

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

Jump to

Keyboard shortcuts

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