MongoDB Sandboxes That Refuse What Production Refuses Argon 2.11.0 now builds each collection's secondary indexes in every sandbox, so an insert that production would reject with a duplicate key error fails inside the sandbox instead of only surfacing at merge check, according to Argon Labs' published benchmark report on Argon 2.11.1. Argon 2.10.0 added per-sandbox MongoDB users that are revoked when the sandbox is discarded, closing a gap where the connection string carried the engine's own credentials and could read every database on the deployment. In the test against MongoDB 7.0.45, the sandbox reproduced a unique index on sku, a compound index on status and total, and a 30-day TTL on createdAt, though the TTL index was built without its expiry. MongoDB Sandboxes That Refuse What Production Refuses Argon 2.11 builds a database's secondary indexes in every sandbox, and 2.10 can give each sandbox its own MongoDB user, revoked on discard. A transcript on the published release, what it costs, and the limits. Current capability notes: checkout materializes a physical database; native actor attribution is per branch/run; undo needs complete images and retained history. CLI sandboxes require watch and scheduled sweep. Read the capability matrix https://argonlabs.tech/features capabilities . A sandbox is only a good place for an AI agent to work if it behaves like the database the change is meant for. Two things decide most of that. Does it refuse the writes production would refuse? And can the agent reach anything outside its sandbox? Until recently Argon got both wrong. A sandbox had the source's documents but only the id index, so an insert that production would reject with a duplicate key error went through. The connection string carried the engine's own MongoDB credentials, so code holding it could read every database the engine could. Two releases changed that: - Argon 2.10.0 can give each sandbox its own MongoDB user, revoked when the sandbox goes. - Argon 2.11.0 builds each collection's secondary indexes in every sandbox. This post runs both on the published release and shows what is refused. It also covers what happens when the data breaks an index, what the indexes cost, and what is still not covered. What we ran - Argon 2.11.1 , installed from npm as argonctl . - MongoDB 7.0.45 as a one-member replica set with access control --auth --keyFile , in a container. Argon connects as a root user. - A source database shop with 1,000 orders and three secondary indexes: unique on sku , compound on status, total , and a 30-day TTL on createdAt . A second database, billing , stands for everything else on the deployment. Every command and its output is in the transcript https://github.com/argon-lab/benchmarks/tree/main/reports/2026-11-21-v2.11.1-sandbox-safety/transcript.txt , with passwords masked. The report https://github.com/argon-lab/benchmarks/tree/main/reports/2026-11-21-v2.11.1-sandbox-safety has the script that produced it. Below, $SANDBOX is the connection string Argon returned; IDs and long output are shortened with … The source's indexes, in the sandbox js $ mongosh "$ENGINE" --eval 'db.getSiblingDB "shop" .orders.getIndexes .map i = i.name ' ' id ', 'sku 1', 'status 1 total -1', 'createdAt 1' $ argon import database --uri "$ENGINE" --database shop --project shop --source-quiesced --yes $ argon sandbox create -p shop --name agent-run --ttl 1h --credential --output json { "connection string": "mongodb://sandbox 6b015c85…:•••@localhost:27017/argon br 6b015c85…?authSource=argon br 6b015c85…&replicaSet=rs0", "index notes": "index createdAt 1 on orders was built without its TTL expiry" , "indexes": 3, … } The import recorded the three definitions, and the checkout built them after copying the documents. Inside the sandbox: bash $ mongosh "$SANDBOX" --eval 'db.orders.getIndexes .map … ' ' id ', 'sku 1 unique', 'status 1 total -1', 'createdAt 1' $ mongosh "$SANDBOX" --eval 'db.orders.updateOne { id: 7}, {$set: {status: "refunded"}} ' { acknowledged: true, insertedId: null, matchedCount: 1, modifiedCount: 1, upsertedCount: 0 } $ mongosh "$SANDBOX" --eval 'db.orders.insertOne { id: 5000, sku: "sku-42"} ' E11000 duplicate key error collection: argon br 6b015c85….orders index: sku 1 dup key: { sku: "sku-42" } The duplicate sku fails where the agent writes it, as it would in production. Before 2.11 the insert succeeded. The conflict surfaced only at argon merge check , after the agent's run, or when the write reached the real database. Queries in the sandbox now use the same indexes as on the source too. createdAt 1 is there, but without its expiry. A copy of a database is often older than its newest documents' TTL. With the expiry kept, MongoDB would start deleting the sandbox's documents on its own, and capture would record those deletions as the agent's changes. The definitions come from three places: - the import, which reads the source's indexes; - following, which records index builds and drops on the source as they happen; - capture, which records index builds and drops made through a branch's own checkout. These apply to that branch and its descendants, not to its parent. Indexes are not versioned: a branch uses the latest definitions recorded for it. Details are in the operations guide https://github.com/argon-lab/argon/blob/v2.11.1/docs/OPERATIONS.md indexes-in-checkouts and the pull request https://github.com/argon-lab/argon/pull/190 . A MongoDB user for each sandbox --credential made the connection string above carry a user named after the sandbox's branch ID. It can read and write that one database, and that database is its authSource . Argon returns the password once and stores only the user name. Outside the sandbox: bash $ mongosh "$SANDBOX" --eval 'db.getSiblingDB "billing" .invoices.findOne ' not authorized on billing to execute command { find: "invoices", … } $ mongosh "$SANDBOX" --eval 'db.getSiblingDB "argon br 6b015c85…" .orders.findOne ' main's database not authorized on argon br 6b015c85… to execute command { find: "orders", … } $ mongosh "$SANDBOX" --eval 'db.getSiblingDB "argon wal" .wal log.findOne ' not authorized on argon wal to execute command { find: "wal log", … } Discarding the sandbox drops the user before the database. We kept a connection open across the discard, writing once before and once after: bash $ argon sandbox discard -p shop -b agent-run Discarded; storage reclaimed. the connection opened before the discard first write: ok second write: Command update requires authentication $ mongosh "$SANDBOX" --eval 'db.orders.findOne ' a new connection MongoServerError: Authentication failed. Three conditions apply: - The deployment must enforce authentication. On one that does not, a per-sandbox user would not be enforced, so Argon refuses the flag. The REST API answers 422 since 2.11.1. - The engine needs userAdmin on the sandbox databases, or userAdminAnyDatabase . - Expiry alone revokes nothing. An expired sandbox's credential keeps working until a sweep runs. The REST and MCP servers sweep every minute; with the CLI alone, schedule argon sandbox sweep . Without the flag the connection string still uses the engine's credentials. The Python SDK takes the same option as create sandbox ..., credential=True from 0.3.0. See Exposure and credentials https://github.com/argon-lab/argon/blob/v2.11.1/docs/OPERATIONS.md exposure-and-credentials and the pull request https://github.com/argon-lab/argon/pull/182 . When the data breaks an index An index can only be built over data that satisfies it. To see what happens otherwise, we made a branch, checked it out with capture running, dropped its unique index and inserted a duplicate. That is the kind of change an agent cleaning up data might make. bash $ mongosh "$CLEANUP" --eval 'db.orders.dropIndex "sku 1" ; db.orders.insertOne { id: 6000, sku: "sku-42"} ' { acknowledged: true, insertedId: 6000 } $ argon merge preview -p shop -b cleanup Merging cleanup → main put orders/~argon:bson:DAAAABBpAHAXAAAA 1 change s , 0 conflict s $ argon merge apply 6b015ca0d335a77244e5d98c main is checked out and has sku 1 Error: apply failed: write exception: write errors: E11000 duplicate key error collection: argon br 6b015c85….orders index: sku 1 dup key: { sku: "sku-42" } main was checked out, so its database still had the unique index, and MongoDB refused the merge. Nothing changed: main stayed at LSN 1002. With main released, nothing enforced the index at merge time. A fresh preview applied, and the next sandbox reported what it could not build: bash $ argon release -p shop -b main $ argon merge apply 6b015ca0d335a77244e5d98c Error: apply failed: stale plan: branch state changed since preview; run preview again $ argon merge preview -p shop -b cleanup saves plan 6b015ca01cdbacf2ac128b6b $ argon merge apply 6b015ca01cdbacf2ac128b6b Merged: 1 change s applied. $ argon sandbox create -p shop --name next-run --ttl 1h Sandbox "next-run" forked from main at LSN 1008. Note: index sku 1 on orders was not built: DuplicateKey Index build failed: … E11000 duplicate key error … dup key: { sku: "sku-42" } Note: index createdAt 1 on orders was built without its TTL expiry The checkout built the other indexes and named the one it skipped, in the CLI output and in index notes . It did not fail the whole sandbox. The broader point: indexes are not versioned, and a merge does not carry index changes. Keep the branch you merge into checked out if you want MongoDB to enforce its unique indexes at merge time. Run argon merge check before writing a plan back to the source. What it costs Building indexes takes time, and a checkout now does it before the sandbox is handed over. We ran Argon 2.10.0 and 2.11.1 alternately, three rounds each with three sandboxes per round, at 100,000 documents of about 1 KB: | Fixture | 2.10.0, ready | 2.11.1, ready | |---|---|---| | 1 collection, only the id index | 1.98 s 1.67–2.32 | 2.04 s 1.73–2.35 | | 10 collections, 20 secondary indexes | 1.70 s 1.61–2.55 | 4.21 s 4.05–4.27 | Medians of nine sandboxes, with the range in brackets. The first write afterwards took a few milliseconds in both releases. Without secondary indexes nothing changed. With 20, a sandbox of this size takes about 2.5 seconds longer. The host is shared and its load average was 11 to 13 throughout, so the absolute times are inflated; alternating the releases keeps the comparison fair. The figures are in the report https://github.com/argon-lab/benchmarks/tree/main/reports/2026-11-21-v2.10.0-v2.11.1-index-cost . For how readiness grows with size, see the earlier measurement https://github.com/argon-lab/benchmarks/tree/main/reports/2026-11-20-v2.9.0-sandbox-ready : 0.2, 2.4 and 16 seconds at 10,000, 100,000 and 1,000,000 documents, nearly all of it the physical copy. Which deployments this is tested on Since 2.10.0, importing, following and write-back are tested against sources with access control and TLS, using the least-privilege role for each command. They are also tested through primary elections on a three-member replica set, and with MongoDB 6.0 and 8.0 sources and an 8.0 engine pull request https://github.com/argon-lab/argon/pull/185 . The source permissions https://github.com/argon-lab/argon/blob/v2.11.1/docs/OPERATIONS.md source-permissions table lists the roles. Grant listIndexes so that sandboxes get the source's indexes; without it the import still works and says which collections get only id . Limits - Indexes are not versioned. A branch uses its own or its nearest ancestor's latest definitions, and a merge does not carry index changes. - Validators, collation defaults and other collection options are not copied. - Atlas itself and sharded sources are not tested. Atlas Search indexes are not secondary indexes and are not built. - A sandbox credential needs a deployment that enforces authentication. It stays valid after expiry until a sweep runs. - Checkout copies the data, so readiness grows with the database. Index builds add to it. The full list for this release is in the changelog https://github.com/argon-lab/argon/blob/v2.11.1/CHANGELOG.md . Try it npm install -g argonctl@2.11.1 --allow-scripts=argonctl export MONGODB URI="mongodb://…" a replica set; with access control for --credential argon import database --uri "$MONGODB URI" --database shop --project shop --source-quiesced --yes argon sandbox create -p shop --ttl 1h --credential --watch The sandbox's JSON output, or its notes on stdout, lists the indexes it built. Discard it with argon sandbox discard -p shop -b