Trace generation, environments and benchmarks¶
Runs are not the only work CredenceStack traces. With the same switch (--otel, plus
--otel-content, --otel-granularity and --otel-metrics), credencestack test,
credencestack generate, the environment and both benchmarks emit traces too (a test
emits the same scenario traces as a run, for its fixed and its generated scenarios), following the same
registry. The diagrams below are drawn from the
golden span trees the test suite checks (tests/golden/otel/workflow-*.json), so they
show exactly what is emitted for PAY-001.
Generation¶
credencestack generate -p payments --n 200 --seed 42 --otel
The credencestack generate <id> span carries the packs, requested and accepted counts,
the seed, the level range, the duration and the rate (scenarios per minute). One event per
rejection reason and one per mutator used summarise the draw, so a generation of ten
thousand scenarios is still one span plus its children. At --otel-granularity scenario
(the default) each accepted scenario is a credencestack generate.scenario <id> child
with its level, difficulty, seed scenario and public mutators; --otel-granularity run
leaves them out.
Environment episodes¶
credencestack env episode -p payments -s PAY-001 --agent credencestack.agents:scripted_safe --otel
Episodes are traced only when asked: credencestack env episode --otel, or
CredenceEnv(..., otel=True) with telemetry on. Each is a credencestack episode
<scenario> root span with the reward, the reward mode, the seed, the steps and the
termination reason (final, max_steps, kill_switch, connector or reset), the
findings as events and the final answer as a credencestack.env.final event (its text
only with --otel-content, never for confidential scenarios). A step-by-step policy's tool
calls are execute_tool children; a connector policy gets an invoke_agent span, so the
framework's own spans nest under it.
Sampling in training loops¶
A training loop can run millions of episodes. A single CredenceEnv traces every episode;
make_env_batch traces 1% by default. The choice is deterministic per episode seed, so the
same seeds are traced on every rerun. Change it with the setting otel.sample_rate
(CREDENCESTACK_OTEL_SAMPLE_RATE) or make_env_batch(..., otel_sample_rate=0.1).
- Keep sampling low during training and raise it for evaluation runs.
- Prefer
--otel-metricsfor trends (episodes by result, findings by severity): metrics cost almost nothing per episode and carry no ids. - Filter on
credencestack.env.termination = kill_switchorcredencestack.result = failto look only at the episodes worth reading.
Benchmarks¶
credencestack bench run -c bench/sample_bench.yaml --otel
credencestack bench <id> carries the kind (bench or brittleness), the name, the
number of configurations, the cap and the spend. Each configuration is a
credencestack bench.config <config_id> child with its status, episodes, passes, pass
rate and cost (a brittleness benchmark adds the fixed pass rate and the pass rate at each
level), and each configuration's run span nests under it. With --otel-granularity
scenario the scenario traces stay separate and link to their run, as in credencestack
run. otel/ids.json in the benchmark's output directory maps the benchmark and each
configuration to its trace.
Filtering by generated scenarios and difficulty¶
Scenario and episode spans of generated scenarios carry credencestack.forge.generated,
credencestack.forge.level, credencestack.forge.difficulty,
credencestack.forge.seed_scenario and credencestack.forge.mutators (public mutators
only; confidential ones are counted in credencestack.forge.confidential_mutator_count).
Every platform page shows how to filter on them; for example, failed generated scenarios
at level 4 or 5 are credencestack.forge.level >= 4 AND credencestack.result = fail.
See them offline¶
credencestack otel print --kind generate
credencestack otel print --kind episode
credencestack otel print --kind bench
credencestack otel print --kind brittleness