### Example config for plan examples Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_4.md Example configuration used in the examples section. ```yaml te_bonus: 20 invention_skill: 3 ``` -------------------------------- ### Example config (YAML) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_6.md Example configuration with split_days, component_bpo_defaults, te_bonus, and invention_skill. Used in the example to calculate build requirements. ```yaml split_days: 30 component_bpo_defaults: me: 10 te: 20 te_bonus: 20 invention_skill: 3 ``` -------------------------------- ### BENCH full adder example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-circuit_eval-cp5/task.txt Complete BENCH full adder example. ```text # Full adder in BENCH format INPUT(a) INPUT(b) INPUT(cin) OUTPUT(sum) OUTPUT(cout) t1 = XOR(a, b) sum = XOR(t1, cin) t2 = AND(a, b) t3 = AND(cin, t1) cout = OR(t2, t3) ``` -------------------------------- ### BENCH syntax example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-circuit_eval-cp5/task.txt Example of BENCH circuit format syntax. ```text # Comments start with # INPUT(a) INPUT(b) OUTPUT(y) y = AND(a, b) ``` -------------------------------- ### Minimal Example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case005/tasks/checkpoint_1.md Illustrative example showing creation of a base config, an app config inheriting it, resolving the app config, and the returned resolved_config JSON. ```http POST /v1/configs/base { "scope": {"env":"prod"}, "config": {"db":{"host":"prod.db","pool":4}}, } ``` ```http POST /v1/configs/billing { "scope": {"env":"prod","app":"billing"}, "includes": [{ "name":"base", "scope":{"env":"prod"} }], "config": {"db":{"pool":8},"feature_flags":["a","b"]}, } ``` ```http POST /v1/configs/billing:resolve { "scope": {"env":"prod","app":"billing"} } ``` ```json { "db": { "host":"prod.db", "pool":8 }, "feature_flags": ["a","b"] } ``` -------------------------------- ### Example --stocks file Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_6.md Example stockpile list showing items on hand with quantities. ```text Fullerides 100000 Hydrogen Fuel Block 1000 Helium Fuel Block 1000 R.A.M.- Ammunition Tech 100 Rifter 100 ``` -------------------------------- ### Missing store configuration is fatal Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case008/tasks/checkpoint_2.md Example where a parameter declares primary-store but --primary-store is absent, causing setup to fail before resolution. The error must identify the affected parameter. ```json { "timeout": { "type": "float", "primary-store": "app/timeout" } } ``` ```text python cfgpipe.py schema.json ``` -------------------------------- ### JSON full adder example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-circuit_eval-cp5/task.txt Complete JSON full adder example. ```json { "format_version": 1, "inputs": [ {"name": "a", "msb": 0, "lsb": 0}, {"name": "b", "msb": 0, "lsb": 0}, {"name": "cin", "msb": 0, "lsb": 0} ], "outputs": [ {"name": "cout", "msb": 0, "lsb": 0}, {"name": "sum", "msb": 0, "lsb": 0} ], "wires": [ {"name": "t1", "msb": 0, "lsb": 0}, {"name": "t3", "msb": 0, "lsb": 0} ], "assignments": [ {"lhs": "t1", "rhs": "XOR(a, b)"}, {"lhs": "sum", "rhs": "XOR(t1, cin)"}, {"lhs": "t2", "rhs": "AND(a, b)"}, {"lhs": "t3", "rhs": "AND(cin, t1)"}, {"lhs": "cout", "rhs": "OR(t2, t3)"} ] } ``` -------------------------------- ### Example --targets file Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_6.md Example target stock levels for items to maintain. ```text Rifter 10 Hydrogen Fuel Block 1000 ``` -------------------------------- ### Example: BENCH export Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Export to BENCH format. ```bash $ python circopt.py opt adder.circ -o adder.bench # exit 0 ``` -------------------------------- ### File tree for relative paths example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case004/tasks/checkpoint_1.md File tree used in Example 1 to illustrate how paths are relative to each job's source mount. ```txt files/ ├── A/ │ ├── B/ │ │ ├── C/ │ │ │ └── D.py │ │ └── E.bin │ ├── F/ │ │ ├── G.bin │ │ └── H.py │ ├── I.py │ ├── J.bin │ ├── K.html │ └── L.md ├── M.py ├── N.py └── O.md ``` -------------------------------- ### Example: basic optimization Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Basic optimization command. ```bash $ python circopt.py opt messy.circ -o clean.circ # exit 0 ``` -------------------------------- ### Example: custom passes Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Run with custom passes. ```bash $ python circopt.py opt circuit.circ -o out.circ --passes normalize,dce # exit 0 ``` -------------------------------- ### Example: optimize with verification Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Optimize with verification and JSON output. ```bash $ python circopt.py opt messy.circ -o clean.circ --verify --max-input-bits 16 --json {"ok":true,"command":"opt","out_path":"clean.circ"} # exit 0 ``` -------------------------------- ### Expected STDOUT from example query Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_3.md Expected output of the example command, showing the result table with columns id, spent, and first_name. ```text | id | spent | first_name | | -- | ------ | ---------- | | 4 | 335.93 | Teodor | | 33 | 108.96 | Osmond | | 3 | 74.46 | Sheilah | | 19 | 54.97 | Darryl | | 31 | 53.47 | Othilia | | 2 | 48.97 | Darin | | 5 | 39.48 | Mirelle | | 32 | 6.78 | Gaylene | | 1 | 5.49 | Rori | ``` -------------------------------- ### Validate Type III environment Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/README.md Install test dependencies and run the official start tests. ```bash python -m pip install -e '.[test]' python -m pytest tests/test_type3_official_start.py ``` -------------------------------- ### Example 3: Recursive CTE Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-file_query_tool-cp5/task.txt This example demonstrates a recursive CTE that builds an employee hierarchy starting from top-level managers. ```sql WITH RECURSIVE employee_hierarchy AS ( SELECT id, name, manager_id, department, salary, 0 as level FROM employees WHERE manager_id IS NULL UNION ALL SELECT e.id, e.name, e.manager_id, e.department, e.salary, eh.level + 1 FROM employees e JOIN employee_hierarchy eh ON e.manager_id = eh.id ) ``` -------------------------------- ### Run Command for Defaults Example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case008/tasks/checkpoint_1.md Command to run cfgpipe with a schema file. ```text python cfgpipe.py schema.json ``` -------------------------------- ### API JSON Examples Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_5.md JSON examples for the execute request, execute response, and stats response. ```json { "command": "echo 'hello'", "env": {}, "files": {}, "stdin": "", "timeout": 10, "track": [], "continue_on_error": false, "force": false // optional, default false; bypasses cache if true } ``` ```json { "id": "UUIDv4", // always unique, even on cache hit "stdout": "hello\n", "stderr": "", "exit_code": 0, "duration": 0.007, "timed_out": false, "files": {}, "cached": false // true if result came from cache } ``` ```json { "ran": 42, "duration": { "average": 0.123, "median": 0.101, "max": 1.234, "min": 0.012, "stddev": 0.050 }, "commands":{ "total": 100, "ran": 84, "average": 2.381, "average_ran": 42.000, "duration": { "average": 0.123, "median": 0.101, "max": 1.234, "min": 0.012, "stddev": 0.050 } }, "cache": { "hits": 15, "misses": 27, "hit_rate": 0.357 } } ``` -------------------------------- ### Schema Document Example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case008/tasks/checkpoint_1.md Example schema document showing parameter declarations with type, default, env, file, and arg fields. ```json { "host": { "type": "string", "default": "localhost", "env": "APP_HOST" }, "port": { "type": "integer", "default": "3000", "env": "APP_PORT", "file": "/etc/app/port.conf", "arg": "port" } } ``` -------------------------------- ### eval command example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_2.md Example of running the eval command on a circuit with given inputs and the resulting text output. ```bash $ python circopt.py eval adder.circ --set a=1 --set b=0 --set cin=1 cout=1 sum=0 ``` -------------------------------- ### Example resulting jobs (CSV) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_6.md CSV output of jobs generated from the example, showing name, runs, days, and count. ```csv name,runs,days,count Barrage L Blueprint,10,1.28,10 Carbon Polymers Reaction Formula,3,0.3,1 Ceramic Powder Reaction Formula,15,1.5,1 Fernite Alloy Reaction Formula,15,1.5,1 Fernite Carbide Reaction Formula,30,3.0,1 Fulleride Reaction Formula,6,0.6,1 Hydrogen Fuel Block Blueprint,8,0.05,1 Nitrogen Fuel Block Blueprint,2,0.01,1 Platinum Technite Reaction Formula,3,0.3,1 ``` -------------------------------- ### Create config version (draft-only) - example response Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case005/tasks/checkpoint_3.md Example response for creating a config version. The new version is marked with `status: "draft"` and `active: false`. No endpoint may activate a version immediately; activation must flow through proposals. ```json { "name": "billing", "scope": {"env": "prod", "app": "billing"}, "version": 7, "status": "draft", "active": false } ``` -------------------------------- ### Run panel and summarize with looparena-type2-panel and looparena-type2-summarize Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/README.md Commands for resumable multi-case execution using a provider-neutral plan, starting from panel.example.json, and summarizing results. ```bash looparena-type2-panel \ --plan benchmarks/type2/panel.example.json \ --out-dir runs/type2 \ --assets-root "$LOOPARENA_ASSETS_ROOT" looparena-type2-summarize runs/type2 ``` -------------------------------- ### Example: generate report Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Generate a JSON report file. ```bash $ python circopt.py opt messy.circ -o clean.circ --report report.json --json {"ok":true,"command":"opt","out_path":"clean.circ","report_path":"report.json"} # exit 0 ``` -------------------------------- ### Example build request Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_6.md A build request line for 'Barrage L 10 None x10'. ```text Barrage L 10 None x10 ``` -------------------------------- ### Invocation command for relative paths example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case004/tasks/checkpoint_1.md Command to run the backup scheduler with the schedule and mount for Example 1. ```sh python backup_scheduler.py --now 2025-09-10T03:30:00Z --schedule schedule.yaml --duration 1 --mount files ``` -------------------------------- ### Example: compact renaming Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Compact renaming of internal wires. ```bash $ python circopt.py opt circuit.circ -o out.circ --rename compact # exit 0 ``` -------------------------------- ### Example: fanin limiting Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Limit fanin to 2. ```bash $ python circopt.py opt wide.circ -o narrow.circ --fanin-limit 2 # exit 0 ``` -------------------------------- ### Example 1: Track a Simple File Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_2.md Example 1: Track a simple file. Request with track glob and response containing the tracked file contents. ```json { "command": "echo \"Hello tracked files\" > test.txt", "env": {}, "files": {}, "stdin": [], "timeout": 10, "track": ["*.txt"] } ``` ```json { "id": "123e4567-e89b-12d3-a456-426614174000", "stdout": "", "stderr": "", "exit_code": 0, "duration": 0.123, "timed_out": false, "files": { "test.txt": "Hello tracked files\n" } } ``` -------------------------------- ### YAML Schedule with Strategy Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case004/tasks/checkpoint_2.md Example YAML schedule configuration demonstrating the new optional 'strategy' field with a 'full' strategy and an empty options object. ```yaml version: 1 timezone: "UTC" jobs: - id: "daily-home" enabled: true when: { kind: "daily", at: "03:30" } strategy: kind: "full" # one of: full | pack | verify options: {} # strategy-specific settings (optional) destination: "ignored://sink" exclude: - "**/*.bin" ``` -------------------------------- ### Example: BENCH export fails for vectors Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md BENCH export fails for vector circuits. ```bash $ python circopt.py opt vector.circ -o vector.bench --json {"ok":false,"command":"opt","exit_code":1,"error":{"type":"UnsupportedFeatureError","message":"BENCH format requires scalar-only circuits","file":null,"line":null,"col":null}} # exit 1 ``` -------------------------------- ### Example command using --sharded flag Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_3.md Example invocation of the CLI with a --sharded flag that merges shard files into a 'users' table, then runs a SQL query joining 'pampas' and 'users' tables. ```bash python query_files.py --data data --sharded users=data/shards/shard-*.csv --sql "SELECT p.id, sum(p.price) as spent, u.first_name FROM pampas as p INNER JOIN users as u on p.id = u.id GROUP BY p.id, u.first_name ORDER BY spent desc" ``` -------------------------------- ### Example: verification failure Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Verification failure with counterexample. ```bash $ python circopt.py opt buggy.circ -o out.circ --verify --max-input-bits 16 --json {"ok":true,"command":"opt","equivalent":false,"counterexample":{"inputs":[{"name":"a","msb":0,"lsb":0,"value":"1"}],"outputs_compared":["y"],"a_outputs":[{"name":"y","msb":0,"lsb":0,"value":"1"}],"b_outputs":[{"name":"y","msb":0,"lsb":0,"value":"0"}]}} # exit 10 ``` -------------------------------- ### Barrage L manual ME/TE materials.csv Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_4.md Example `materials.csv` output for the Barrage L manual ME/TE example. ```text name,to_buy,buy_volume,start_amount,end_amount Fernite Carbide,270000,2700.0,0,0 Fullerides,108000,16200.0,0,0 Morphite,1350,13.5,0,0 R.A.M.- Ammunition Tech,100,4.0,0,0 ``` -------------------------------- ### Barrage L manual ME/TE jobs.csv Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_4.md Example `jobs.csv` output for the Barrage L manual ME/TE example. ```text name,runs,days,count Barrage L Blueprint,10,1.07,10 ``` -------------------------------- ### Example 1: Basic CTE Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-file_query_tool-cp5/task.txt This example demonstrates a simple CTE that calculates total salary and employee count per department, then orders by total salary descending. ```sql WITH dept_totals AS ( SELECT department, SUM(salary) as total_salary, COUNT(*) as employee_count FROM employees GROUP BY department ) SELECT department, total_salary, employee_count FROM dept_totals ORDER BY total_salary DESC ``` -------------------------------- ### Example resulting materials (CSV) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_6.md CSV output of materials with buy volumes and start/end amounts based on stockpile and targets. ```csv name,to_buy,buy_volume,start_amount,end_amount Coolant,82,61.5,0,0 Datacore - Mechanical Engineering,24,2.4,0,0 Datacore - Nuclear Physics,24,2.4,0,0 Enriched Uranium,37,27.75,0,0 Evaporite Deposits,1500,75.0,0,0 Fernite Carbide,0,0.0,0,6000 Fullerides,0,0.0,100000,400 Heavy Water,1530,612.0,0,0 Helium Fuel Block,0,0.0,1000,985 Hydrocarbons,300,15.0,0,0 Hydrogen Fuel Block,0,0.0,1000,1020 Hydrogen Isotopes,3240,97.2,0,0 Liquid Ozone,3150,1260.0,0,0 Mechanical Parts,37,27.75,0,0 Morphite,1470,14.7,0,0 Nitrogen Fuel Block,0,0.0,0,34 Nitrogen Isotopes,810,24.3,0,0 Oxygen,199,37.81,0,0 Platinum,300,15.0,0,0 R.A.M.- Ammunition Tech,0,0.0,100,0 Robotics,10,30.0,0,0 Scandium,1500,75.0,0,0 Silicates,1800,90.0,0,0 Strontium Clathrates,180,540.0,0,0 Technetium,300,15.0,0,0 Vanadium,1500,75.0,0,0 ``` -------------------------------- ### Example 1: Running Total query Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md Uses SUM with PARTITION BY region and ORDER BY date to compute a running total. The output table is shown below the query. ```sql SELECT region, product, sales, SUM(sales) OVER (PARTITION BY region ORDER BY date) as running_total FROM sales ORDER BY region, date ``` -------------------------------- ### Example 3: Result table Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md The expected output for the sales ranking query, showing sales_rank values per partition. ```text | region | product | sales | sales_rank | | ------ | -------- | ----- | ---------- | | EU | Widget B | 1200 | 1 | | EU | Widget A | 900 | 2 | | EU | Widget A | 800 | 3 | | NA | Widget B | 1500 | 1 | | NA | Widget A | 1200 | 2 | | NA | Widget A | 1000 | 3 | ``` -------------------------------- ### Declaration lines Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_1.md Example declaration lines for inputs, outputs, and wires. Multiple names per line are space-separated. ```text input a b c output y z wire t1 t2 ``` -------------------------------- ### BENCH output format Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_8.md Example of the BENCH output format for a full adder circuit. ```text INPUT(a) INPUT(b) INPUT(cin) OUTPUT(cout) OUTPUT(sum) n0 = XOR(a,b) n1 = AND(a,b) n2 = AND(cin,n0) sum = XOR(cin,n0) cout = OR(n1,n2) ``` -------------------------------- ### Example 1: Result table Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md The expected output for the running total query, showing the SQL result as a table. ```text | region | product | sales | running_total | | ------ | -------- | ----- | ------------- | | EU | Widget A | 800 | 800 | | EU | Widget B | 1200 | 2000 | | EU | Widget A | 900 | 2900 | | NA | Widget A | 1000 | 1000 | | NA | Widget B | 1500 | 2500 | | NA | Widget A | 1200 | 3700 | ``` -------------------------------- ### CSV output example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_7.md Example CSV output for a truth table with inputs a and b and output y. Shows the default radix (bin) and row order. ```csv a,b,y 0,0,0 0,1,0 1,0,0 1,1,1 ``` -------------------------------- ### Start datagate service Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/Datagate/tasks/checkpoint_1.md Starts the datagate service on a specified port and address. The --port option defaults to 8001 and --address defaults to 127.0.0.1. ```bash python datagate.py start --port --address
``` -------------------------------- ### Success JSON (equivalent) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_7.md Example success JSON output when circuits are equivalent. ```json { "ok": true, "command": "equiv", "equivalent": true, "method": "exhaustive", "comparisons": 8 } ``` -------------------------------- ### Install LoopArena and run Type I smoke test Source: https://github.com/amap-ml/looparena/blob/main/docs/index.html Clone the LoopArena repository, install with the gateway extra, configure an OpenAI-compatible endpoint, and run the Type I zero-call preflight check followed by one execution-validated control question. The preflight uses the --preflight-only flag to validate configuration without calling a model, and the final command writes a single JSONL result. The smoke test requires Python 3.10+ and one model call. ```shell $ git clone https://github.com/AMAP-ML/LoopArena.git $ cd LoopArena $ python -m pip install -e '.[gateway]' # Use any OpenAI-compatible endpoint. $ export OPENAI_API_KEY=YOUR_API_KEY $ export OPENAI_BASE_URL=YOUR_BASE_URL # Validate configuration with zero model calls. $ looparena-type1-run \ --data benchmarks/type1/questions.jsonl \ --model MODEL_ID \ --preflight-only # Run one execution-validated control question. $ looparena-type1-run \ --data benchmarks/type1/questions.jsonl \ --model MODEL_ID \ --output results/type1-smoke.jsonl \ --limit 1 --concurrency 1 ``` -------------------------------- ### Successful /convert response Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/Datagate/tasks/checkpoint_1.md Example JSON response for a successful GET /convert request. Returns an endpoint for the dataset. ```json {"ok": true, "endpoint": "/datasets/"} ``` -------------------------------- ### Example 2: Result table Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md The expected output for the total sales query, showing the total_sales column repeated for each row. ```text | region | product | sales | total_sales | | ------ | -------- | ----- | ----------- | | EU | Widget A | 800 | 6600 | | EU | Widget B | 1200 | 6600 | | NA | Widget A | 1000 | 6600 | | NA | Widget B | 1500 | 6600 | | NA | Widget A | 1200 | 6600 | | EU | Widget A | 900 | 6600 | ``` -------------------------------- ### Stats endpoint response with commands Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_4.md Example response from /v1/stats/execution showing command statistics including total, ran, average, and duration metrics. ```json { "ran": 42, // total number of POST /v1/execute calls that produced a 201 "commands":{ "total": 100, "ran": 84, "average": 2.381, "average_ran": 42.000, "duration": { "average": 0.123, "median": 0.101, "max": 1.234, "min": 0.012, "stddev": 0.050 } }, "duration": { "average": 0.123, "median": 0.101, "max": 1.234, "min": 0.012, "stddev": 0.050 } } ``` -------------------------------- ### Successful /datasets/ response Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/Datagate/tasks/checkpoint_1.md Example JSON response for a successful GET /datasets/ request. Contains columns, rows, and query_ms. ```json { "ok": true, "columns": ["", "", "..."], "rows": [ ["", "", "..."], ["..."] ], "query_ms": 3.2 } ``` -------------------------------- ### Example 4: Stats after runs response Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_1.md GET /v1/stats/execution returns 200 with aggregated statistics after three runs. Duration values are rounded to 3 decimal places. ```json { "ran": 3, "duration": { "average": 0.204, "median": 0.100, "max": 0.500, "min": 0.012, "stddev": 0.217 } } ``` -------------------------------- ### Backward compatibility (string command) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_4.md Example 5: Backward compatibility (string command). Shows a POST request with a simple string command and the 201 response with the output. ```json { "command": "echo 'hello world'" } ``` ```json { "id": "e5f6a7b8-c9d0-1234-ef01-234567890abc", "stdout": "hello world\n", "stderr": "", "exit_code": 0, "duration": 0.007, "timed_out": false, "files": {} } ``` -------------------------------- ### Success JSON (not equivalent) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_7.md Example success JSON output when circuits are not equivalent, including a counterexample. ```json { "ok": true, "command": "equiv", "equivalent": false, "method": "randomized", "comparisons": 3, "counterexample": { "inputs": [ {"name": "a", "msb": 0, "lsb": 0, "value": "1"}, {"name": "b", "msb": 0, "lsb": 0, "value": "1"} ], "outputs_compared": ["y"], "a_outputs": [ {"name": "y", "msb": 0, "lsb": 0, "value": "0"} ], "b_outputs": [ {"name": "y", "msb": 0, "lsb": 0, "value": "1"} ] } } ``` -------------------------------- ### GET /v1/stats/execution Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_1.md Retrieves aggregate statistics for all runs since process start, including total count and duration metrics (average, median, max, min, stddev). ```APIDOC ## [GET] /v1/stats/execution ### Description Retrieves aggregate statistics for all runs since process start, including total count and duration metrics (average, median, max, min, stddev). ### Method GET ### Endpoint /v1/stats/execution ### Parameters None ### Response #### Success Response (200) - **ran** (integer) - Total number of POST /v1/execute calls that produced a 201. - **duration** (object) - Duration statistics. - **average** (float or null) - Average duration in seconds, rounded to 3 decimal places. Null if no runs. - **median** (float or null) - Median duration in seconds, rounded to 3 decimal places. Null if no runs. - **max** (float or null) - Maximum duration in seconds, rounded to 3 decimal places. Null if no runs. - **min** (float or null) - Minimum duration in seconds, rounded to 3 decimal places. Null if no runs. - **stddev** (float or null) - Standard deviation of durations in seconds, rounded to 3 decimal places. Null if no runs. #### Response Example { "ran": 3, "duration": { "average": 0.204, "median": 0.100, "max": 0.500, "min": 0.012, "stddev": 0.217 } } ### Error Handling - **4xx** - Client errors (malformed requests, invalid inputs, missing required fields). - **5xx** - Server errors (unexpected failures). - Error format: {"error": "human-readable message", "code": "UPPER_SNAKE_MACHINE_CODE"} ``` -------------------------------- ### Highest-Priority Source Schema Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case008/tasks/checkpoint_1.md Schema for highest-priority source wins example. ```json { "threshold": { "type": "float", "default": "0.5", "env": "THRESHOLD", "file": "/tmp/threshold.txt", "arg": "threshold" } } ``` -------------------------------- ### Example 4: Result table Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md The expected output for the multi-window query, showing row_num, overall_rank, and moving_avg columns. ```text | region | product | sales | row_num | overall_rank | moving_avg | | ------ | -------- | ----- | ------- | ------------ | ---------------- | | EU | Widget B | 1200 | 1 | 2 | 1050 | | EU | Widget A | 900 | 2 | 4 | 966.666666666667 | | EU | Widget A | 800 | 3 | 5 | 850 | | NA | Widget B | 1500 | 1 | 1 | 1350 | | NA | Widget A | 1200 | 2 | 2 | 1233.33333333333 | | NA | Widget A | 1000 | 3 | 3 | 1100 | ``` -------------------------------- ### GET /v1/stats/execution response body schema Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_1.md JSON object aggregating all runs since process start. Includes ran count and duration statistics (average, median, max, min, stddev). When no runs, ran is 0 and all duration stats are null. ```json { "ran": 42, // total number of POST /v1/execute calls that produced a 201 "duration": { "average": 0.123, "median": 0.101, "max": 1.234, "min": 0.012, "stddev": 0.050 } } ``` -------------------------------- ### Missing key falls through Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case008/tasks/checkpoint_2.md Example where the primary-store key 'app/retries' does not exist, so the default '3' is used. Includes the schema, the command, and the resolved output. ```json { "retries": { "type": "integer", "default": "3", "primary-store": "app/retries" } } ``` ```text python cfgpipe.py --primary-store http://127.0.0.1:8500 schema.json ``` ```json { "retries": "3" } ``` -------------------------------- ### LoopArena CLI Commands Source: https://github.com/amap-ml/looparena/blob/main/README.md Commands for installing dependencies, configuring endpoints, running smoke tests, preparing assets, running complete tasks, and summarizing results. ```bash python -m pip install -e '.[gateway]' ``` ```bash export OPENAI_API_KEY="your-api-key" export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" ``` ```bash looparena-type1-run \ --data benchmarks/type1/questions.jsonl \ --model MODEL_ID \ --output results/type1-smoke.jsonl \ --limit 1 \ --concurrency 1 \ --summary results/type1-smoke.summary.json ``` ```bash python -m pip install -e '.[gateway,scbench]' ``` ```bash looparena-assets prepare \ --assets-root ~/.cache/looparena/assets \ --beyondswe-source /path/to/BeyondSWE-harbor \ --scbench-source /path/to/scb-problems ``` ```bash looparena-type3-run \ --case-dir benchmarks/type3/cases/case203 \ --assets-root "$LOOPARENA_ASSETS_ROOT" \ --arm controlled ``` ```bash looparena-results-summarize results/0.1.0 ``` -------------------------------- ### Output excerpt for sorting example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case004/tasks/checkpoint_1.md JSON output excerpt showing jobs executed in alphabetical order: alpha-job, beta-job, zebra-job. ```json {"event":"SCHEDULE_PARSED","timezone":"UTC","jobs_total":3} {"event":"JOB_ELIGIBLE","job_id":"alpha-job","kind":"daily","now_local":"2025-09-10T03:30:00Z"} {"event":"JOB_STARTED","job_id":"alpha-job","exclude_count":1} ... (file processing events for alpha-job) ... {"event":"JOB_COMPLETED","job_id":"alpha-job","selected":0,"excluded":11} {"event":"JOB_ELIGIBLE","job_id":"beta-job","kind":"daily","now_local":"2025-09-10T03:30:00Z"} {"event":"JOB_STARTED","job_id":"beta-job","exclude_count":1} ... (file processing events for beta-job) ... {"event":"JOB_COMPLETED","job_id":"beta-job","selected":0,"excluded":11} {"event":"JOB_ELIGIBLE","job_id":"zebra-job","kind":"daily","now_local":"2025-09-10T03:30:00Z"} {"event":"JOB_STARTED","job_id":"zebra-job","exclude_count":1} ... (file processing events for zebra-job) ... {"event":"JOB_COMPLETED","job_id":"zebra-job","selected":0,"excluded":11} ``` -------------------------------- ### Create environment with base mode - POST /v1/environment Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_6.md Creates an environment named 'test-base' with concurrency_mode 'base' and a setup.sh file. The response includes written_bytes. ```json { "name": "test-base", "concurrency_mode": "base", "files": { "setup.sh": "#!/bin/bash\necho 'initialized'\n" } } ``` ```json { "name": "test-base", "concurrency_mode": "base", "files": { "setup.sh": {"written_bytes": 35} } } ``` -------------------------------- ### Naga output with ME=5 Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-eve_industry-cp3/task.txt Example output when ME is set to 5, showing intermediate quantities and Run Time: 250. ```text ... Run Time: 250 | Item | Quantity | Buildable | |:---------:|:---------:|----------:| | Isogen | 24700 | No | | Megacyte | 494 | No | | Mexallon | 222300 | No | | Nocxium | 9880 | No | | Pyerite | 1235000 | No | | Tritanium | 3458000 | No | | Zydrine | 2470 | No | ``` -------------------------------- ### CSV output file (out.csv) Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_1.md Example output file `out.csv` containing the ordered results with columns id, price, and first_name. ```csv id,price,first_name 4,335.93,Teodor 33,108.96,Osmond 3,74.46,Sheilah 19,54.97,Darryl 31,53.47,Othilia 2,48.97,Darin 5,39.48,Mirelle 32,6.78,Gaylene 1,5.49,Rori ``` -------------------------------- ### Naga output without ME/TE flags Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-eve_industry-cp3/task.txt Example output of the recipe command with no efficiency flags, showing Run Time: 250 and quantities for each item. ```text ... Run Time: 250 | Item | Quantity | Buildable | |:---------:|:---------:|----------:| | Isogen | 26000 | No | | Megacyte | 520 | No | | Mexallon | 234000 | No | | Nocxium | 10400 | No | | Pyerite | 1300000 | No | | Tritanium | 3640000 | No | | Zydrine | 2600 | No | ``` -------------------------------- ### Start Watch Mode with Primary Store Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case008/tasks/checkpoint_4.md Runs cfgpipe.py with `--watch` and a primary store, monitoring `server.host` and `verbose`. Each resolved parameter emits a seed event, followed by the full configuration. ```text python cfgpipe.py --primary-store http://localhost:8500 --watch schema.json ``` -------------------------------- ### Naga output with ME=10 Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-eve_industry-cp3/task.txt Example output when ME is set to 10, showing reduced quantities and Run Time: 250. ```text ... Run Time: 250 | Item | Quantity | Buildable | |:---------:|:---------:|----------:| | Isogen | 23400 | No | | Megacyte | 468 | No | | Mexallon | 210600 | No | | Nocxium | 9360 | No | | Pyerite | 1170000 | No | | Tritanium | 3276000 | No | | Zydrine | 2340 | No | ``` -------------------------------- ### Barrage L invention jobs.csv Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_4.md Example `jobs.csv` output for the Barrage L invention example. ```text name,runs,days,count Barrage L Blueprint,10,1.28,10 ``` -------------------------------- ### Example 3: Ranking within partitions query Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md Uses RANK() OVER (PARTITION BY region ORDER BY sales DESC) to assign rank within each region. The result is ordered by region and rank. ```sql SELECT region, product, sales, RANK() OVER (PARTITION BY region ORDER BY sales DESC) as sales_rank FROM sales ORDER BY region, sales_rank ``` -------------------------------- ### Barrage L invention materials.csv Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case203/tasks/checkpoint_4.md Example `materials.csv` output for the Barrage L invention example. ```text name,to_buy,buy_volume,start_amount,end_amount Datacore - Mechanical Engineering,24,2.4,0,0 Datacore - Nuclear Physics,24,2.4,0,0 Fernite Carbide,294000,2940.0,0,0 Fullerides,117600,17640.0,0,0 Morphite,1470,14.7,0,0 R.A.M.- Ammunition Tech,100,4.0,0,0 ``` -------------------------------- ### Example 1: Minimal echo request and response Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_1.md POST /v1/execute with a simple echo command. Returns 201 with stdout containing the echoed text, exit_code 0, and timed_out false. ```json { "command": "echo 'Hello, world!'", "env": {}, "files": {}, "stdin": [], "timeout": 10 } ``` ```json { "id": "8b3d8a7f-5a4f-4b2f-9f0f-3e1a0d6a9a10", "stdout": "Hello, world!\n", "stderr": "", "exit_code": 0, "duration": 0.100231232, "timed_out": false } ``` -------------------------------- ### Output excerpt for relative paths example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case004/tasks/checkpoint_1.md JSON output excerpt showing file selection and exclusion for both jobs, with paths relative to each job's source. ```json {"event":"SCHEDULE_PARSED","timezone":"UTC","jobs_total":2} {"event":"JOB_ELIGIBLE","job_id":"job-root","kind":"daily","now_local":"2025-09-10T03:30:00Z"} {"event":"JOB_STARTED","job_id":"job-root","exclude_count":3} {"event":"FILE_SELECTED","job_id":"job-root","path":"A/B/C/D.py"} {"event":"FILE_EXCLUDED","job_id":"job-root","path":"A/B/E.bin","pattern":"**/*.bin"} ... (more file events) ... {"event":"FILE_EXCLUDED","job_id":"job-root","path":"A/I.py","pattern":"A/*"} {"event":"FILE_EXCLUDED","job_id":"job-root","path":"M.py","pattern":"*.py"} {"event":"FILE_SELECTED","job_id":"job-root","path":"O.md"} {"event":"JOB_COMPLETED","job_id":"job-root","selected":3,"excluded":8} {"event":"JOB_ELIGIBLE","job_id":"job-subdir","kind":"daily","now_local":"2025-09-10T03:30:00Z"} {"event":"JOB_STARTED","job_id":"job-subdir","exclude_count":2} {"event":"FILE_SELECTED","job_id":"job-subdir","path":"C/D.py"} {"event":"FILE_EXCLUDED","job_id":"job-subdir","path":"E.bin","pattern":"**/*.bin"} {"event":"JOB_COMPLETED","job_id":"job-subdir","selected":1,"excluded":1} ``` -------------------------------- ### Multiple executions with base mode (isolated) - second execution sees clean base Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_6.md Second execution in base mode sees only the original setup.sh file, confirming isolation. The response shows stdout 'setup.sh' and snapshot_source 'base'. ```json { "command": "ls -la", "environment": "test-base" } ``` ```json { "stdout": "setup.sh\n", "exit_code": 0, "environment": { "name": "test-base", "snapshot_source": "base", "committed": false } } ``` -------------------------------- ### Prepare assets with looparena-assets prepare Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/README.md Command to prepare all 27 evaluators from pinned upstream downloads. Use --only beyondswe or --only scbench to prepare one upstream family. ```bash looparena-assets prepare \ --assets-root "$LOOPARENA_ASSETS_ROOT" \ --beyondswe-source /path/to/BeyondSWE-harbor \ --scbench-runner /path/to/slop-code-bench \ --scbench-source /path/to/scb-problems ``` -------------------------------- ### JSON mode output example Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_2.md Example JSON output from the eval command in JSON mode. ```json {"ok":true,"command":"eval","mode":"2val","radix":"bin","outputs":[{"name":"cout","msb":0,"lsb":0,"value":"1"},{"name":"sum","msb":0,"lsb":0,"value":"0"}]} ``` -------------------------------- ### Preview website with Python HTTP server Source: https://github.com/amap-ml/looparena/blob/main/docs/README.md Command to preview the static website locally from the repository root. ```bash python -m http.server 8000 --directory docs ``` -------------------------------- ### Usage example for dot command Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case012/tasks/checkpoint_6.md Command-line usage of `python circopt.py dot` to export a DOT graph. Options include output file, format, cone filtering, and JSON. ```bash python circopt.py dot -o [--format ...] [--cone out1,out2,...] [--json] ``` -------------------------------- ### Get the active raw version Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case005/tasks/checkpoint_1.md Request body for getting the active raw version and the response body for a successful retrieval. ```json { "scope": { "k":"v" } } ``` ```json { "name": "billing", "scope": { "env":"prod","app":"billing" }, "version": 3, "active": true } ``` -------------------------------- ### Example 2: Window over entire result query Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case204/tasks/checkpoint_4.md Uses SUM(sales) OVER () to compute the total across all rows without partitioning. Returns the same total_sales value for every row. ```sql SELECT region, product, sales, SUM(sales) OVER () as total_sales FROM sales ``` -------------------------------- ### Example 2: With files and stdin (array) request and response Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type3/cases/case016/tasks/checkpoint_1.md POST /v1/execute with a files map providing input.txt. The command reads the file via cat. Returns 201 with stdout containing the file content. ```json { "command": "echo $(cat input.txt)", "env": {}, "files": { "input.txt": "Hello, world" }, "stdin": [], "timeout": 10 } ``` ```json { "id": "8b3e8a7f-5a4f-4b2f-9f0f-3e1a0d6a9a10", "stdout": "Hello, world", "stderr": "", "exit_code": 0, "duration": 0.12422444, "timed_out": false } ``` -------------------------------- ### Example 6: EXISTS Subquery Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-file_query_tool-cp5/task.txt This example uses an EXISTS subquery to find employees who are managers (i.e., have at least one direct report). ```sql SELECT name, department, salary FROM employees e1 WHERE EXISTS ( SELECT 1 FROM employees e2 WHERE e2.manager_id = e1.id ) ORDER BY department, name ``` -------------------------------- ### Example 4: Scalar Subquery Source: https://github.com/amap-ml/looparena/blob/main/benchmarks/type2/cases/scbench-file_query_tool-cp5/task.txt This example shows scalar subqueries used in the SELECT list to compute company average salary and count of people earning more. ```sql SELECT name, salary, (SELECT AVG(salary) FROM employees) as company_avg, (SELECT COUNT(*) FROM employees e2 WHERE e2.salary > e1.salary) as people_earning_more FROM employees e1 ORDER BY salary DESC ```