agentsession

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Package agentsession implements the AgentSessionUser locust test: each VU is one coding-agent session replaying a scripted step sequence (a YAML file under scripts/, selected by --agentsession-script) against a glutton actor. After every step the actor is suspended for the step's "LLM thinking" gap; by default the next step's first request wakes it through the atenet router (request parking), so the benchmark measures the user-visible wake latency Substrate's oversubscription story rests on.

Per-step timings land in locust stats as Step_<name>. The first request after each suspend is additionally recorded as WakeFirstTouch — in implicit resume mode that row IS the parking wake latency distribution.

Index

Constants

View Source
const DefaultScript = "coding-session"

DefaultScript is the variant a run uses when --agentsession-script is unset: the 20-step coding session.

Variables

This section is empty.

Functions

func Encode

func Encode(s *Script) ([]byte, error)

Encode renders a Script as YAML in the form Decode reads, with one flow-style line per op so the file reads like the step table it is.

func FormatSize

func FormatSize(n int64) string

FormatSize renders a byte count as a Kubernetes quantity (32Mi, 1Gi).

func Names

func Names() []string

Names lists the built-in script variants.

func Validate

func Validate(s *Script) error

Validate pins a script's invariants: a usable name, a memory floor that covers what the script declares, unique non-empty steps with positive think times, and no op that consumes a sandbox object before an earlier step created it. A broken ordering would fail at run time with NotFound from glutton; this catches it when the script is loaded.

Types

type Budget

type Budget struct {
	RAM  int64
	Disk int64
}

Budget is what a script declares it will hold in the sandbox: resident RAM (the largest fill per array) and files in the data dir (the largest object per key). The data dir is tmpfs, so both come out of the actor's memory limit. It does not model the guest's real peak: kernel, kata-agent, and Go allocator transients sit on top.

func Budgets

func Budgets(steps []Step) Budget

Budgets sums the bytes a step sequence declares.

type Script

type Script struct {
	Name string
	// MinActorMemory is the smallest actor memory limit the script is known
	// to run under, in bytes. The driver refuses to start against a smaller
	// template. Required, and at least the script's declared RAM plus disk
	// (the data dir is tmpfs).
	MinActorMemory int64
	Steps          []Step
}

Script is a loaded agent-session script: a named step sequence plus the actor memory it needs.

The YAML form is a direct transcription of the Go types:

name: coding-session
min_actor_memory: 1Gi
steps:
- name: 01_read_task
  agent: Boots, reads the task prompt, loads its context window
  think: 2s
  ops:
  - fill_ram: {key: agent_context, size: 32Mi}
  - ping: {}

Each op is a one-key map whose key is the op kind and whose value holds that kind's arguments. Sizes are Kubernetes quantities (16Mi, 64Ki); think times are Go durations (2s, 1.5s). Unknown kinds, unknown fields, and arguments a kind does not take are errors.

func Decode

func Decode(data []byte) (*Script, error)

Decode parses a YAML script and validates it.

func Load

func Load(name string) (*Script, error)

Load returns the built-in script variant called name.

func LoadFile

func LoadFile(path string) (*Script, error)

LoadFile reads a script from a YAML file on the worker, typically a ConfigMap mounted by benchmarking/locust/deploy.sh --agentsession-script.

type Step

type Step struct {
	// Name keys the step's locust stats row: Step_<Name>.
	Name string
	// Agent says what the coding agent is doing, for humans.
	Agent string
	// Think is how long the LLM "thinks" before this step. The actor is
	// suspended for this gap (scaled by --agentsession-think-scale).
	Think time.Duration
	// Ops are the resource effects, executed in order.
	Ops []op
}

Step is one agent action: what a coding agent would be doing, the think time that precedes it (the LLM producing this step), and the resource operations acting it out.

Jump to

Keyboard shortcuts

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