Skip to content

About

Agentic harness and sandbox benchmarking on OpenShift AI

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

Agentic Trace Replay Simulator

Benchmark your own agentic AI deployment on different CPUs, with a different harness, or at the scale you are planning: replay recorded agent sessions at the concurrency you choose and see where the time actually goes -- context assembly in the harness, the OpenShell sandbox that runs tools, the services behind those tools, or the queue that forms when the fleet runs at once.

Responses are replayed, not generated, so a run needs no GPU and no live inference endpoint, and it repeats exactly: same traces, same pacing, same work. That is what makes a before/after comparison mean something.

How it works

Trace replay architecture

Recorded multi-turn sessions go in. A replay driver spreads them across agents, balances the workload mix, and admits them at the concurrency you ask for. The driver plays only the user: it sends a request at recorded turn 0 and at each later recorded user message, while the agent keeps ownership of the tool loop. Each agent then does its normal work -- context assembly, tool decisions, response processing against a simulator that returns the recorded response at a configurable pace -- and tool calls take the ordinary route into an OpenShell sandbox and out to the workload backend.

OpenTelemetry spans, CPU and memory samples, and tool and sandbox metrics are correlated per turn, so the answer is "this stage, this much" rather than a single end-to-end number.

Workload Backend What it stresses
swe software engineering pinned SWE-bench repositories long context, repeated execution, memory growth
pa personal assistant AppWorld interactive tool loops, application state
research deep search BrowseCompPlus variable tool depth, external waits
cs customer support Tau2 short transactions at high concurrency

The three added backends are stateful replay environments, not official benchmark score runs. The point is the platform cost around the work, not the model's answer quality.

Quick start

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# see what would run, without touching the cluster
./scripts/bench --agents 100 --corpus data/replay.json --dry-run

# run it across two worker nodes
./scripts/bench --agents 100 --nodes node-a,node-b --corpus data/replay.json

data/replay.json is a four-trace sample, one per workload, targeting the shipped trace-replay namespace and its mock-llm Service. Replace it with your own corpus for production runs.

scripts/bench is the sample-corpus shorthand: --workload-dist for the mix, --warm-pool and --cold-ratio to price readiness, --simulated-ttft and --simulated-itl for model pacing, --session-ids for hand-picked sessions, --agents for fleet size. --help lists the rest.

Profiles: the full run

scripts/run.py takes one argument: the profile.

python3 scripts/run.py mixed-warm

config/run-profiles/mixed-warm.json is the whole run: cluster and approved nodes, gateway, agent image, ownership, storage, mock topology, corpus, trace split, output directory, and whether the fleet is deployed, reused, attached or discovered. Editing that file is how a run changes.

"run":   { "out": "results/mixed-warm", "traces": {"swe": 1, "pa": 1, "research": 1, "cust": 1},
           "mode": "execute" },
"fleet": { "mode": "deploy", "reuse": true, "reconcile_agents": false }

"mode": "plan" writes the deployment plan and stops before touching the cluster. The agent count and warm pool default to the number of selected traces, because one trace runs per agent slot. For model pacing add "ttft_ms" and "itl_ms" under "mock" -- both or neither; leave them unset to use the simulator's own timing configuration.

The full schema, every controller flag, and the deploy-then-resume recipe are in docs/run-cli.md; config/run-profile.template.json documents every field.

Agents you already have

fleet.mode: "agents" runs traces against agents that are already running, without creating an agent or a sandbox. This run's mock, trace Jobs, and telemetry are still deployed. An entry names an in-cluster Deployment, its Service and its model_endpoint, and authenticates with token_secret ({"name": ..., "key": ...}, read from the benchmark namespace) or token_env. rebind: "restore" points a benchmark-owned agent at this run's simulator and restores its configuration afterward; rebind: "none" changes nothing and requires the live endpoint to already point at this run. See config/attached-agent.example.json.

For SWE, the slot needs the matching task image, pinned checkout, and command mappings. A compatible workspace with local changes is archived under the run's attached-workspace-backups directory and reset before replay; a different image or mapping needs a separately prepared sandbox.

fleet.mode: "discover" finds the agents instead of making you describe them. The profile says where to look; discovery keeps the Deployments with a ready pod, resolves their Service, workspace and gateway token, probes each endpoint, and prints the exact fleet.agents entry -- including for agents it found but the profile does not name, which are reported and never adopted. Discovery is read-only until the run starts. Only research and cust work for an adopted agent today: swe and appworld prepare the agent's workspace and configuration, which a run cannot do for a layout it does not own, so it refuses them up front.

Cluster prerequisites

The tool targets Red Hat OpenShift AI and admits every Job through the Kueue webhook (kueue-system/kueue-webhook-service by default). You need oc with a kubeconfig, Bash 4 or newer, Python 3.11, an OpenShell gateway reachable from the controller plus its openshell-client-tls Secret, an agent image that carries the OpenShell client, and a default storage class. Apply the namespace objects first:

oc apply -f k8s/00-namespace.yaml -f k8s/10-mock-llm.yaml -f k8s/20-jaeger.yaml \
         -f k8s/34-openshell-sandbox-scc.yaml -f k8s/35-openclaw-shell.yaml

k8s/50-monitoring.yaml is optional: it gives 1s cAdvisor samples, and without it the analysis falls back to the platform's 30s samples. Cluster settings are flags or TRACE_REPLAY_* environment variables; the customer-owned inputs -- approved nodes, kubeconfig, gateway, agent image, storage class, PVCs, and the AppWorld data and task map -- are listed with their defaults in docs/run-cli.md.

Replay corpus

python -m trace_replay_sim ingest --out data/replay.json             # 50 sessions
python -m trace_replay_sim ingest --out data/replay.json --limit 1781

ingest streams Exgentic/agent-llm-traces (1,781 sessions, CDLA-Permissive-2.0) and keeps 50 by default. pa runs also need the AppWorld environment, which is not redistributable: pip install appworld, appworld install, appworld download data, then point TRACE_REPLAY_APPWORLD_DATA at the directory holding base_dbs/ and tasks/. --skip-appworld-staging verifies a pre-populated customer-owned PVC instead of writing to it.

What you get

Each run writes per-turn and per-tool CSV and JSON, OpenTelemetry traces, cgroup and Prometheus CPU/memory series, sandbox and tool timing, node and warm-pool assignments, and one run-level latency and resource table. Before requesting cluster access, scripts/check_local_readiness.sh runs the same 100-agent queue-building path locally, without touching the cluster.

Layout

src/trace_replay_sim/   replay driver, simulator, harnesses, telemetry, analysis
scripts/                bench entrypoint, cluster controller, backends, gates
k8s/                    namespace objects, agent service template, workload backends
config/                 backend manifest, SWE task manifest, AppWorld task map
docs/                   architecture diagram and CLI reference
tests/                  unit and integration tests

Related

Questions, or your own results to compare: the PSAP Agentic team.

About

Agentic harness and sandbox benchmarking on OpenShift AI

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages