Skip to content
AgentTx

Built-in tools

Arguments, outputs, errors and rollback behavior of the tools that ship with AgentTx.

1 min readSynced from mainUpdated Sep 15, 2026

The built-in tools are production-usable primitives and double as reference implementations for your own tools. Their error messages deliberately mirror real systems (PostgreSQL, POSIX, serde), so the error cleaner produces precise hints.

kv.put

Stores a JSON value in transactional state.

ArgumentTypeRequired
keystringyes
valueany JSONno (defaults to null)

Output: { "key", "value" }. Rollback: journal snapshot.

kv.get

ArgumentTypeRequired
keystringyes

Output: { "key", "value" }. Fails with no row with key=… in table "kv" when the key is missing.

kv.delete

Output: { "key", "deleted": bool }. Rollback: journal snapshot (a tombstone is written).

record.insert

Inserts a row, enforcing its primary key and any declared foreign keys.

ArgumentTypeRequiredNotes
tablestringyes[A-Za-z0-9_]{1,128}
idstring or numberyesprimary key
fieldsobjectnorow columns
referencesobjectno{ "field": "referenced_table" }

Output: the row plus table and id.

ErrorMessage (abridged)
duplicate idduplicate key value violates unique constraint "t_pkey" … Key (id)=(…) already exists.
missing referenced fieldnull value in column "field" of relation "t" violates not-null constraint
referenced row missing… violates foreign key constraint "t_field_fkey" … Key (field)=(…) is not present in table "ref".

Rollback: journal snapshot.

record.get

ArgumentTypeRequired
tablestringyes
idstring or numberyes

Output: the stored row. Fails with no row with id=… in table "…".

fs.write

Writes a UTF-8 file inside the sandbox (--fs-root), atomically via a temp file and rename.

ArgumentTypeRequired
pathstringyes; relative, no ..
contentsstringyes

Output: { "path", "bytes" }. Rollback: Saga undo restores the previous bytes, or deletes the file if it didn't exist. The action is crash-recoverable.

fs.read

Output: { "path", "contents" }. Fails with No such file or directory: '…'. Read-only.

effect.stage

Stages a non-reversible effect for dispatch after commit.

ArgumentTypeRequired
channelstringyes (e.g. email, webhook)
payloadany JSONno
idempotency_keystringno (generated if omitted)

Output: { "staged": true, "channel", "idempotency_key" }. Rollback: discarded; nothing was sent.