MongoDB Atlas Sandboxes for AI Agents: Argon Now Supports Free M0 and M10

Give AI agents sandbox copies of a MongoDB Atlas database, review what they changed, and write approved changes back. Tested on free M0 and M10 with Argon 2.12.

By Argon Labs11 min readUpdated
MongoDBAtlasAI Agents

Argon gives AI agents sandbox copies of a MongoDB Atlas database, shows you what each agent changed, and writes the changes you approve back to Atlas. In this 2.12.0 walkthrough, the engine and sandboxes run on a separate, self-managed MongoDB replica set; Atlas is the source.

From Argon 2.12.0, this works on the free M0 tier and on dedicated replica-set clusters such as M10. Both are tested, including write-back. The run in this post is on a free M0; the M10 tests are in the pull request that added Atlas support. Atlas sharded clusters are not supported, and self-managed replica sets work as before.

How does Argon work with MongoDB Atlas?

Atlas keeps your database, and your application keeps using it as usual. The Argon engine, on a replica set you run, holds everything Argon makes: a copy that tracks Atlas, the agents' sandboxes and the merge plans.

Argon with a MongoDB Atlas source: import and follow from Atlas into main, fork sandboxes for agents, preview a merge plan, and write it back to Atlas after reviewMongoDB Atlas · the sourceFree M0, or a dedicated M10+ replica set (not sharded)Your database (shop)your application keeps reading and writing it as usualArgon engine · a MongoDB replica set you runmainAtlas at one cluster time,kept current by followingMerge planbefore and after of every document,plus an approval digestSandboxesreal MongoDB databases forkedfrom main, one per agent runArgon metadatachange log, branches, plans,the recorded Atlas identityAI agentspymongo, mongoose, mongosh…① import online② follow its change stream③ fork④ work in the sandbox⑤ preview⑥ write back after reviewdigest matches · same Atlas cluster ·unchanged since review · one transaction
Atlas keeps the database. The engine, on a replica set you run, keeps main, the sandboxes and the plans. Nothing reaches Atlas except step ⑥.
  1. Import online. Argon copies the database from Atlas while it is being written, then replays Atlas's change stream until the copy is Atlas at one cluster time. That copy is the branch main.
  2. Follow. argon source follow keeps reading the change stream, so main stays current. It records which cluster the source is and checks it on every connection.
  3. Fork. Each agent run gets a sandbox: a real MongoDB database on the engine, forked from main, with its own connection string.
  4. Work. The agent reads and writes the sandbox with any driver. Argon records every write. Atlas is not touched.
  5. Preview. argon merge preview turns the agent's writes into a plan: each document before and after, and an approval digest over all of it.
  6. Write back. After you review the plan, argon merge apply --write-back --approve <digest> writes it to Atlas in one transaction. It refuses if the digest is wrong, if the connection is not the same Atlas cluster, or if any document in the plan changed on Atlas since the review.

The tiers differ only in how Argon recognizes the cluster in steps 2 and 6. A write-back must reach the database the plan was reviewed against, so the identity is recorded at import and checked on every later connection:

Atlas tierHow Argon identifies the clusterTested
Free M0, FlexThese tiers refuse the command that reads the replica-set ID. Argon accepts instead a connection whose every host is under mongodb.net, with TLS verified against public certificate authorities. Only Atlas can hold those certificates, so a tunnel or another deployment cannot stand in for the cluster.M0
Dedicated M10 and up, as a replica setThe replica-set ID, as on a self-managed replica setM10

What is it for?

Each of these runs the six steps above. The agent works on a fork of the Atlas data, and nothing reaches Atlas until someone has read the plan.

  • Data cleanup and backfills by an agent. An agent fixes or fills in documents in a sandbox of your Atlas data. You review the plan, document by document, before it is written back, and a document that changed on Atlas in the meantime stops the write-back.
  • Rehearsing a migration. Run a migration script in a sandbox forked from current Atlas data and read the diff: which documents it changed, inserted or deleted. Discard the sandbox and run it again after a fix; Atlas is not touched.
  • Evaluating agents on real data. Give every evaluation run a fresh sandbox forked from the same point of main, compare what the runs changed, and throw the sandboxes away.
  • Several agents at once. Each gets its own sandbox. When two change the same document, the later preview shows a conflict and a person decides which version wins. See two AI agents, one MongoDB document.

How is this different from restoring an Atlas backup or using mongodump?

The common ways to put an agent or a test near Atlas data, from MongoDB's own documentation, checked on November 21, 2026:

ApproachWhat the agent getsGetting reviewed changes back to Atlas
Restore an Atlas backup to another clusterA full cluster as of a snapshot. Cloud Backup is for M10 and up; on a free M0, daily snapshots are a paid private preview. The restore target must not receive client requests while it restores.No built-in path. You find and copy the changes yourself, and the copy does not follow later writes to Atlas.
mongodump and mongorestoreA copy of the documents, collection options and index definitions, consistent with writes during the dump when run with --oplog.No built-in path, and the dump does not follow Atlas after it ends.
A temporary cluster from the Atlas CLIA new, empty cluster for testing scripts, deleted afterwards. MongoDB's tutorial creates an M10, which is billed hourly until it is deleted.Not applicable: it holds none of your data.
The MongoDB MCP server in read-only mode with a read-only userThe live data, read-only. MongoDB recommends this for production; read-only mode is not on by default.Nothing to bring back: the agent cannot write.
A database user with write access to productionThe live data, limited by the user's roles.Every write the roles allow lands on Atlas at once, with no review before it.
ArgonA sandbox forked from a copy that follows Atlas, one per agent run. The engine runs on a replica set you run, and each sandbox is a full copy of the database.A plan with every document before and after, written back in one transaction after approval, refused if Atlas changed since the review.

Read-only access is the right answer when the agent only needs to look. A restored cluster or a dump is simpler when nobody needs the agent's changes afterwards, or when the copy does not have to keep up with Atlas. Argon is for the case where an agent's work is meant to reach Atlas, and someone has to see it first. For branching tools beyond MongoDB, see database branching tools compared.

Can an AI agent write to Atlas safely this way?

The agent never needs Atlas credentials. It holds a connection string to its sandbox on the engine, and only argon merge apply --write-back, run by a person with the plan's digest, writes to Atlas.

The sandbox connection string is not a security boundary on its own. Without --credential it carries the engine's MongoDB credentials, so code holding it can reach whatever the engine can. With argon sandbox create --credential, available since 2.10.0, each sandbox gets its own MongoDB user that can read and write only that sandbox and is revoked when the sandbox is discarded. That needs an engine deployment with access control, which you run; see sandboxes that refuse what production refuses.

What happened on a free M0

We ran the whole path with the published release. The data is synthetic, and a second process wrote to Atlas the whole time, like an application would.

  • Argon 2.12.0, installed from npm as argonctl.
  • The source: a free MongoDB Atlas M0, MongoDB 8.0.39, AWS us-east-1. Its database shop starts with 2,000 orders and 200 customers.
  • The engine: MongoDB 7.0.45 as a one-member replica set in a container.
  • The application: a thread that inserts or updates an order on Atlas, then sleeps 50 ms, for the whole run.

Every command and its output is in the transcript, and the report has the script. The cluster's host and replica-set name are masked as <id>, and the output below keeps only the lines discussed. The same steps on a self-managed source, with more on each, are in branch a live MongoDB database and write reviewed changes back.

Import and follow, while Atlas is being written

$ export ARGON_SOURCE_URI="mongodb+srv://…@cluster1.<id>.mongodb.net/"
$ argon import database --database shop --project shop --online --yes
✅ Import Complete
   Documents Imported: 2.2K
   Consistent: LSN 2225 is the source at cluster time Timestamp(1795303135, 26)
   LSNs below 2225 are the copy in progress, not states the source was in.

$ argon source follow -p shop        # left running
$ argon source status -p shop
  Source:      mongodb+srv://cluster1.<id>.mongodb.net/shop (replica set atlas-<id>-shard-0)
  Identity:    replica-set name and TLS-verified MongoDB Atlas hosts
  Health:      healthy (exact)
  Last change: 2026-11-21T23:19:03Z (stored 96 ms after it happened)

The application made 13 writes to Atlas while the import ran. With the application paused for a moment, following stored Atlas's newest write 0.5 s after it was made, and a sandbox forked from main held exactly what Atlas held:

[orders: source 2077 documents, sandbox forked from main 2077 documents;
 exact BSON bytes IDENTICAL (sha256 8ebdf6cf33613739 / 8ebdf6cf33613739)]
[customers: source 200 documents, sandbox forked from main 200 documents;
 exact BSON bytes IDENTICAL (sha256 cbd620837406d59f / cbd620837406d59f)]

The 0.5 s is one measurement on one M0. A change is stored once the next oplog entry shows its cluster time is complete; on an idle self-managed replica set that next entry is MongoDB's periodic no-op, so the last change of a burst can wait 10 to 20 seconds there.

An agent changes three documents, and four shortcuts are refused

Through its sandbox's connection string, an agent refunds one order, adds a refund record and deletes another order:

$ argon diff -p shop -b agent-1
  delete orders/order-000017
  put    orders/order-000042
  put    orders/order-000042-refund
3 change(s), 0 conflict(s)

argon merge preview -o json saved a plan with an approval_digest and the source it was reviewed for, atlas-tls:atlas-<id>-shard-0. Four attempts that should not reach Atlas:

$ argon merge apply 6b0226e9… --write-back
Error: --write-back requires --approve with a 64-character lowercase hex digest; …

$ argon merge apply 6b0226e9… --write-back --approve 0000…0000
Error: approval digest does not match the saved plan; …

$ argon merge apply 6b0226e9… --write-back --approve 852c9aac… --uri mongodb://argon-atlaspost-meta:27017/?replicaSet=rs0
Error: write-back failed: this project identifies its source by a verified TLS connection
to MongoDB Atlas, and this connection is not one (…): …

$ argon merge apply 6b0226e9…
Error: apply failed: merge apply refused: branch main follows the external database "shop"
and only changes when that database does; …

The third points the write-back at the engine's own deployment instead of Atlas. After all four, the three documents on Atlas were as they had been.

The approved write-back

$ argon merge apply 6b0226e9… --write-back --approve 852c9aac…
Written to the source database: 3 change(s) in one transaction.

On Atlas, order 42 became refunded with a new refund_cents field, the refund record appeared and order 17 was gone. Order 42 kept its field order, with the new field at the end. The command took 599 ms, and applying the same plan again was refused with merge plan is applied, not pending.

When Atlas changes after the review

A second agent cancelled orders 50 and 51 in its own sandbox, and the plan was reviewed. Then, before the write-back, someone shipped order 51 directly on Atlas:

$ argon merge apply 6b0226f0… --write-back --approve 323cd7b6…
Error: write-back failed: write-back aborted, nothing was written: document orders/order-000051
in the source database differs from the state this plan was reviewed against.
Let following catch up and run preview again

$ argon merge preview -p shop -b agent-2
  put    orders/order-000050
  CONFLICT orders/order-000051 (both sides changed since the fork)
1 change(s), 1 conflict(s)

Order 50 was not cancelled either: a plan is written whole or not at all. From the new plan a person decides with --strategy: ours keeps the version on Atlas for a conflicting document, theirs takes the agent's. This run stopped at the preview.

At the end the application had made 125 inserts and 123 updates, and Atlas held 2,125 orders: 2,000 seeded, 125 inserted by the application, one inserted and one deleted by the plan. A new sandbox forked from main held the same 2,125 documents, with identical BSON bytes.

Which Atlas roles does Argon need?

The run connected as a user with read and write on any database, for brevity. In production give each command only what it needs. Atlas custom roles spell the actions in capitals, and none of them needs a cluster action:

CommandActions on the source database
import database --onlineFIND, CHANGE_STREAM, LIST_COLLECTIONS; add LIST_INDEXES so sandboxes get the source's indexes
source followFIND, CHANGE_STREAM
merge checkFIND, LIST_INDEXES
merge apply --write-backFIND, LIST_COLLECTIONS, INSERT, UPDATE, REMOVE

The table is from the operations guide, which was tested with these roles on an M0 and an M10. A follower without CHANGE_STREAM stops at once, and a write-back names the action it is missing.

How is Atlas support kept working?

Argon's Atlas tests import, follow, fork a sandbox, write back, and check that a weakened TLS connection is not accepted as the cluster. Since November 21, a workflow runs them against a free M0 once a day, when started by hand, and on pushes to master that change the code for importing, following and merging.

Argon 2.13.0 added a separate Atlas M0 engine test. Its passing CI run used M0 for engine metadata, checkouts and a writable sandbox, with a separate source replica set. It exercised following, write capture, merge preview, write-back and restart. It did not test the console on Atlas or put the source and engine on the same cluster. See current test coverage and limits.

Limits

  • For engine setups, Atlas M0 validation is limited to the separate-source CI scenario above. argon sandbox create --credential needs an engine deployment that allows createUser, which Atlas does not.
  • Sharded clusters, on Atlas or self-managed, are not supported as sources: an online import through mongos is refused.
  • Behind a TLS-inspecting proxy, reading and following a shared-tier cluster work, but write-back is refused.
  • Write-back is in the CLI only, not in the REST API, MCP server or console.
  • A sandbox is a full copy of the database on the engine, so it takes longer to be ready as the database grows. Validators and collection options are not copied to sandboxes.
  • A sandbox created from the CLI records the agent's writes while --watch or argon watch runs; sandboxes from the MCP server and the console are watched for you.
  • In 2.12.0, stopping argon source follow by sending a signal to the npm-installed argon command leaves the follower running; Ctrl-C in a terminal is not affected. The fix is in the next release.

Try it

npm install -g argonctl@2.13.0 --allow-scripts=argonctl
export MONGODB_URI="mongodb://…"              # the engine: a replica set you run
export ARGON_SOURCE_URI="mongodb+srv://…"     # your Atlas cluster; read per command, never stored
argon import database --database shop --project shop --online --yes
argon source follow -p shop                   # leave running
argon sandbox create -p shop --ttl 1h --watch

Review with argon merge preview, take the digest from argon merge list -p shop --output json, and write back with argon merge apply <plan> --write-back --approve <digest>. For a disposable sandbox without a live source, see disposable MongoDB sandboxes for AI agents.

Frequently asked questions

Does Argon support MongoDB Atlas?
Yes: Argon 2.12.0 tested Atlas as a source on free M0 and dedicated M10 replica sets, including reviewed write-back. This walkthrough uses an Atlas M0 source and a separate self-managed replica set for the engine and sandboxes. Argon 2.13.0 separately tested using an Atlas M0 for the engine with a separate source replica set; sharded sources are not supported.
Can an AI agent write to MongoDB Atlas safely?
MongoDB's own advice for production is read-only access: its MCP server has a --readOnly mode and recommends a read-only database user. When an agent's writes are the point, Argon gives it a sandbox copy instead: the agent writes only to the sandbox, a person reviews every changed document, and the write-back to Atlas needs the plan's approval digest, a connection that verifies as the same cluster, and no change on Atlas to the reviewed documents since the review.
Can I clone a MongoDB Atlas database for testing?
Atlas can restore a backup to another cluster, from M10 up, and mongodump with mongorestore copies a database; neither keeps following Atlas or brings reviewed changes back. Argon imports the Atlas database once, keeps a copy that follows it, and forks as many sandboxes from it as you need, each a real MongoDB database you can discard.
Do I need a paid Atlas tier?
No. This walkthrough uses a free Atlas M0 as the source and a separate replica set you run for the Argon engine. Argon 2.13.0 also separately tested hosting the engine on a free M0.
Is there Neon-style database branching for MongoDB Atlas?
Argon adds branching to MongoDB, Atlas included: a branch is a metadata write, and checking one out copies it into a real MongoDB database. Unlike Neon's copy-on-write branches, each checked-out sandbox is a full copy, so it takes longer to be ready as the database grows.
How fast does Argon follow changes on Atlas?
In this run on a free M0, status reported changes stored 84 to 96 ms after they happened while the application was writing, and with the application paused the newest write was stored 0.5 s after it was made. A change is stored once the next oplog entry shows its cluster time is complete; on an idle self-managed replica set that can take 10 to 20 seconds. One short run on one cluster is not a latency guarantee.