External approvals (experimental)
Experimental
The approval gate is experimental: tool confirmation, external approvals (approvals:), the provider interface and the on_missing_gate default may change in a minor release.
External approvals pause an agent on a risky tool call and ask a human to decide in Slack, Jira or any system you plug in. abt dispatch posts the request and exits. A later abt dispatch on the same thread picks up the decision and resumes the run, minutes or days later. State lives in SQLite, so the run survives restarts, cron schedules and CI.
When to use it
| Situation | Use |
|---|---|
You run abt run in a terminal, or chat in abt docs serve |
Tool confirmation: the prompt appears in the terminal or browser |
A scheduled, CI or bot-driven abt dispatch runs a tool the approver must see first, or you need an audit trail |
External approvals (this page) |
| A headless run should always allow or always refuse gated tools | on_missing_gate (refuses by default) or bypass |
Both systems key off the same confirmation_required: true flag on the tool. The runtime surface picks the gate.
Quick start: local file
This example needs no Slack or Jira. A small local_file provider writes each request to a JSON file, and you approve by editing it. You need a project from the Quickstart with a working model profile (the agent calls your model) and the checkpoint-sqlite extra (part of abt-core[all], see Installation).
1. Tools. Two stand-ins that change nothing. Save as tools/ops_tools.py (see Tools).
from abt import tool
@tool
def read_logs(service: str) -> str:
"""Return the most recent log lines of a service."""
return f"{service}: ERROR connection pool exhausted"
@tool
def restart_service(service: str) -> str:
"""Restart a service."""
return f"{service} restarted"
2. Provider. abt loads every *.py file in providers/, so no packaging is needed. Save as providers/local_file_approval.py. Writing a provider explains each method.
from __future__ import annotations
import json
from pathlib import Path
from pydantic import BaseModel, ConfigDict
from abt.infra.approvals.external_approval import BaseExternalApproval
from abt.infra.approvals.models import ApprovalDecision, ApprovalPollResult, EmptyOptions
from abt.infra.approvals.registry import external_approval_for
class LocalFileApprovalConfig(BaseModel):
model_config = ConfigDict(extra="forbid", frozen=True)
dir: str = "target/local_approvals"
@external_approval_for("local_file")
class LocalFileExternalApproval(BaseExternalApproval):
ConfigSchema = LocalFileApprovalConfig
OptionsSchema = EmptyOptions
async def post(self, req, approval_id, *, config, options) -> dict:
directory = Path(config.dir)
directory.mkdir(parents=True, exist_ok=True)
path = directory / f"{approval_id}.json"
path.write_text(json.dumps({
"status": "pending", "agent_name": req.agent_name, "tool_name": req.tool_name,
"tool_args": req.tool_args, "decision": None, "decided_by": None,
}), encoding="utf-8")
return {"path": str(path)}
async def fetch_decision(self, handle, *, config, options) -> ApprovalPollResult:
data = json.loads(Path(handle["path"]).read_text(encoding="utf-8"))
decision = data.get("decision")
if decision not in ("approved", "denied"):
return ApprovalPollResult.pending()
return ApprovalPollResult.decided(
approved=decision == "approved", decided_by=str(data.get("decided_by") or "local-user"),
)
async def update_resolved(self, handle, decision, decided_by, *, config, options) -> None:
path = Path(handle["path"])
data = json.loads(path.read_text(encoding="utf-8"))
data["status"] = "resolved"
data["resolution"] = str(decision)
data["resolved_by"] = decided_by
path.write_text(json.dumps(data), encoding="utf-8")
3. abt.yaml. Select a durable checkpoint backend by adding checkpoint: inside your existing config: block (a second top-level config: fails to parse). With the default memory backend, every gated call is denied.
checkpoint:
backend: sqlite
Then turn approvals on and declare a resource at the top level. allowed_approvers must name the approver: the provider reports local-user unless the JSON file sets decided_by, and an empty list rejects every decision.
approvals:
enabled: true
resources:
local_gate:
type: local_file
config:
dir: target/local_approvals # relative to the directory you run abt from
allowed_approvers:
users:
- local-user
4. Agent. Mark the tool confirmation_required and point the agent's approvals: block at the resource. Save as agents/ops.md:
---
name: ops
description: Ops agent with a guarded tool.
tools:
- read_logs
- restart_service:
confirmation_required: true
approvals:
use: local_gate
---
You are an on-call assistant. Read the logs of the service you are asked about.
If they show errors, restart the service.
5. Workflow. abt dispatch runs workflows. Save as workflows/ops_restart.yaml:
steps: [ops]
Run it from the project root, because dir is relative to where you run abt. -p is the task. --thread-id names the conversation, so the second run repeats it.
abt dispatch -s ops_restart -p "Restart the api service." --thread-id restart-demo
The agent reads the logs and asks to restart the service. That tool is gated, so the run pauses. abt prints the pending approval on stderr and exits 0:
β ops failed (Run stopped due to paused_for_approval before any response teβ¦)
workflow paused: 1 approval(s) pending in local_gate
approval_id: ap_effa0ca2823e39012f16 tool: restart_service resource: local_gate
The provider wrote the request to target/local_approvals/<approval_id>.json, and abt approvals list shows the row:
ID STATUS AGENT TOOL RESOURCE CREATED
------------------------------------------------------------------------------------------------------------------------
ap_effa0ca2823e39012f16 pending ops_restart restart_service local_gate 2026-11-06 06:48:04
Approve by setting "decision" in that file to "approved" (or "denied"):
{"status": "pending", "agent_name": "ops", "tool_name": "restart_service", "tool_args": {"service": "api"}, "decision": "approved", "decided_by": null}
Run the same command without -p:
abt dispatch -s ops_restart --thread-id restart-demo
This run reads the decision and replays it into the paused graph. An approved call runs its tool. A denied call gives the model a tool error, User rejected the tool call forrestart_servicewith reason: decided by local-user. The workflow then finishes, and abt approvals show <approval_id> reports status: resolved.
Slack
Slack asks the approver to react to a message or to reply to the bot in the approval thread. Use the same tools, agent and workflow as above.
Prerequisites
- The
slackextra (part ofabt-core[all]). - A bot token (
xoxb-...) exported asSLACK_BOT_TOKENbefore everyabt dispatch, with these scopes:chat:write;reactions:readfor the defaultreactionmode, orchannels:history/groups:history(public / private channels) formention_command;usergroups:readonly whenallowed_approvers.groupsis used. For a bot that also serves theslack_threadsource or theslackexposure, see the scope table. - The bot invited to the channel (
/invite @bot-name), the channel id, and the Slack user ids of the approvers.
Setup
- In
profiles.yaml, add a credentials namespace next to your model credentials:slack: {bot_token: "{{ env_var('SLACK_BOT_TOKEN') }}"}. -
In
abt.yaml, add a resource next tolocal_gate:approvals: resources: slack_hitl: type: slack credentials: slack # namespace in profiles.yaml, merged into config config: channel_id: "<your-channel-id>" allowed_approvers: users: - "<approver-slack-user-id>" # Slack user IDs, not display names -
In
agents/ops.md, changeuse: local_gatetouse: slack_hitl.
Run the same two abt dispatch commands. After the first, the request appears in the channel. Once a listed approver reacts with :white_check_mark: or :x:, the second picks up the decision. abt compile passes without the token, but a dispatch without it cannot build the Slack gate: it logs the error in logs/abt.log and denies the gated call.
How decisions are read
trigger_mode: reaction(default): the adapter pollsreactions.get. The approve emoji takes precedence over the deny emoji. Only the first user to add the winning emoji is checked against the allow-list. If that user is not allowed, the row stays pending until that reaction is removed.-
trigger_mode: mention_command: the adapter reads the thread throughconversations.replies(only messages after the request, paged) and takes the first reply posted after the approval request that starts with<@bot_user_id>. Earlier messages in the thread, such as the message that started the run or the approval of a previous request, never decide. The text after the mention is read as follows:- Deny: it starts with a deny keyword as a whole word or phrase, with the same decoration allowed as for approve (
@bot deny,@bot *deny*,@bot _no_,@bot no, wrong ticket). Whatever follows is ignored, because denying is the safe direction. - Approve: it equals an approve keyword exactly, ignoring case, surrounding spaces, a trailing
.or!, and a trailing positive emoji (:+1:,:thumbsup:,:white_check_mark:,:heavy_check_mark:, π, β , with skin-tone variants):@bot approve,@bot Approve!,@bot approve :+1:. Anything else leaves the request pending: other words (@bot approved,@bot approve, thanks,@bot approve except prod,@bot I don't approve),?(@bot yes?) and any other emoji (@bot approve :x:,@bot approve π). - Text before the mention (
no, @bot approve) also leaves it pending. Bot messages and replies from the bot's own user id are skipped.
Keywords can be several words (
go ahead) or emoji (:+1:); empty keywords are rejected at load. Replies from users who are not allowed approvers are skipped (and logged), so a channel member cannot decide first and block the real approver; reaction mode still checks only the first reactor. Use this mode when reactions are too noisy or a Slack Events webhook already signals bot mentions. - Deny: it starts with a deny keyword as a whole word or phrase, with the same decoration allowed as for approve (
The message shows the workflow, agent, tool, the full arguments (split over several blocks when long), how to decide, the approval ID and the arguments hash stored on the approval row. Arguments above 28,000 characters cannot be shown in full, so abt posts nothing for the batch: every member is checked before the first is posted, the batch is denied (approval_infra_failed) and logs/abt.log names the size and the hash. If a post fails midway, the prompts already posted are resolved as denied. Non-ASCII text such as CJK stays readable; bidi overrides, zero-width characters and blank fillers are shown as \uXXXX escapes. After the decision, chat.update replaces it with a banner plus the original blocks, without the how-to-decide section.
Resource config
| Key | Required | Notes |
|---|---|---|
bot_token |
yes | Slack bot token. A SecretStr, never persisted. Usually comes from credentials: slack. Other keys of the shared slack namespace, such as app_token, are ignored. |
channel_id |
yes | Destination channel (C0XXXXXXX). |
Agent options (approvals.options)
| Key | Default | Meaning |
|---|---|---|
approve_emoji |
white_check_mark |
Emoji name (no colons) that approves. |
deny_emoji |
x |
Emoji name that denies. |
mention |
null |
Prepended to the message, for example <!here> or <@U123>. |
broadcast |
false |
Sets reply_broadcast when posting into a thread. Needs thread_ts. |
thread_ts |
null |
Post as a reply to this thread timestamp. Supports {{ var('thread_ts') }}. |
trigger_mode |
reaction |
reaction or mention_command. |
bot_user_id |
"" |
The bot's Slack user id (Uxxxxxxx). Required for mention_command; empty keeps the row pending. In reaction mode, empty means abt asks Slack (auth.test) for it, to keep the bot's own reaction from deciding. |
approve_keywords |
["approve","proceed","ok","yes"] |
Case-insensitive words or phrases that approve in mention_command mode when they are the whole reply. |
deny_keywords |
["deny","reject","no","cancel"] |
Case-insensitive words or phrases that deny in mention_command mode when the reply starts with them. |
Jira
Two providers create a Jira issue per request. Pick by how your team signals approval:
type: jira-comment: the reviewer posts a comment whose first line starts with/abt-approveor/abt-deny. It suits teams that sign off in ticket comments, or approvals that must be a sub-task of an incident ticket.type: jira-status: the reviewer moves the ticket to a configured status. It needs no comment grammar and suits board-driven teams and custom status names.
Both install with the jira extra (part of abt-core[all]) and share credentials, resource config and most options.
Resource config (both types)
| Key | Required | Notes |
|---|---|---|
server (or url) |
yes | Jira site URL (https://your-org.atlassian.net). A trailing /wiki is removed. |
email (or username) |
yes | Bot or service account email for basic auth. |
api_token |
yes | Jira API token. A SecretStr, never persisted. |
project |
yes | Project key where approval issues are created (for example OPS). |
With credentials: atlassian (the namespace the Atlassian tools use), url, username and api_token come from profiles.yaml and the resource only needs project.
approvals:
resources:
jira_ops:
type: jira-comment # or jira-status
credentials: atlassian
config:
project: "OPS"
allowed_approvers:
users:
- "alice@your-org.com" # email address (recommended)
# - "5f8a...b42c" # raw Jira accountId also accepted
groups:
- "mock-oncall" # Jira group name
Agent options (both types)
| Key | Default | Meaning |
|---|---|---|
issue_type |
Task |
Jira issue type. Use "Sub-task" with parent_issue_key (jira-comment only). |
labels |
[] |
Labels on the created issue. |
components |
[] |
Component names on the created issue. |
assignee |
null |
A Jira accountId (712020:...), an email address or a username; abt resolves it to an accountId. A username matches the local part of an email at the bot's domain, and the value must match exactly one user. null leaves the issue unassigned. |
priority |
null |
Priority name (for example High). null uses the project default. |
sprint |
none |
"active" moves the issue into the project's active scrum sprint (needs Jira Software access). If no sprint is found, abt logs a warning and leaves the issue without one. |
Bot and app accounts (accountType: app) are never accepted as deciders, and neither is the account behind email / api_token itself (looked up with GET /myself; on Jira Server/DC the name, key and emailAddress are used): an agent holding a Jira write tool on the same credentials cannot approve its own call, even when that account is in allowed_approvers. The issue shows the full arguments plus their hash, and arguments above 28,000 characters, counted after the {code} neutralising, or a request body above Jira's 32,767-character limit are refused the same way as in Slack. The resolution comment, written after the decision, truncates arguments that long and says so.
jira-comment
The adapter creates an issue (or a sub-task) with the request and scans its comments in order for the first one from an allowed approver whose first line starts with /abt-approve or /abt-deny. Matching is case-insensitive, and the {{ }}, *, _ and backtick wrappers that Jira's editor adds are ignored. Comments with other text, or commands from other users, are skipped and cannot block a later decision.
Extra options:
| Key | Default | Meaning |
|---|---|---|
parent_issue_key |
null |
Create a sub-task under this issue instead of a standalone issue. |
max_comments_per_poll |
100 |
Page size (maxResults) when reading comments. Minimum 1. |
jira-status
The adapter creates a standalone issue that describes the request and the statuses it expects. Each resume polls the issue. When the status matches approve_status or deny_status, abt reads the changelog and takes the person who made the most recent transition into that status as the decider. If a bot made that transition, the row stays pending.
Extra options:
| Key | Default | Meaning |
|---|---|---|
approve_status |
Done |
Status that approves. Case-insensitive. |
deny_status |
Won't Do |
Status that denies. Case-insensitive, and must differ from approve_status. |
initial_status_warn |
true |
Log a WARNING when the issue is created in a status that already matches approve_status or deny_status. |
# agent frontmatter
approvals:
use: jira_ops
options:
approve_status: "Approved"
deny_status: "Rejected"
issue_type: "Approval"
labels: [abt, hitl]
assignee: "alice@your-org.com"
sprint: "active"
Reference
How a pause and resume works
flowchart LR
A[abt dispatch] --> B{gated tool calls\nin this model turn?}
B -- no --> Z[tools run]
B -- yes --> C[HumanInTheLoopMiddleware\npauses the whole turn]
C --> E[gate posts one request per call\nand saves one row each]
E --> D[dispatch exits 0]
D -. human decides .-> F[later abt dispatch\non the same thread]
F --> G[poll the provider for each row]
G --> H{every row decided?}
H -- no --> D
H -- yes --> K[provider.update_resolved\nfor each row]
K --> I[one resume for the whole batch]
I --> J[approved: tool runs\ndenied: tool error to the model]
- Pause.
HumanInTheLoopMiddlewareinterrupts after the model call, before any tool runs. It batches everyconfirmation_requiredcall of that model turn into one pause. - Post. The same dispatch then posts one request per call (a Slack message, a Jira issue, ...) and saves one row per call in the approval store, grouped by
interrupt_idand matched to the call bytool_call_id. If posting any member fails, abt marks that rowfailed, denies the whole batch and resumes at once, so a half-posted batch never waits. - Resume. A later
abt dispatchon the same thread polls each pending row. Only allowed approvers count. The batch resumes when every row has a decision, so if one turn called two gated tools, both are decided before either runs. - Resolve. The adapter updates each artifact with the outcome (best effort), then the graph resumes with one
Commandfor the batch.
In a workflow, the resume continues where the walk paused: the gated node finishes, branches and loop iterations that already ran are replayed from saved results, and only the remaining nodes run. The pause state sits in the thread's checkpoint backend. If approvals are pending but that state is gone, abt dispatch fails with E_WORKFLOW_RESUME_STATE_MISSING instead of guessing which node to resume.
With flags.offload_binary_content on, images and PDFs the agent read before the pause are unavailable after the resume. The model is told, and abt logs a warning for agents with approval-gated tools.
Approval timeout. Set approval_timeout and on_approval_timeout per tool or in config.confirmation.defaults (see Tool confirmation).
- The clock starts when the request is posted and covers only the human wait. The tool body has its own budget,
execution_timeout, which starts after approval. - A dispatch checks it in the resume phase. A row still undecided after the budget gets
on_approval_timeout(denyby default, orapprove) with the reasontimeout. A decision already available wins. - Without
approval_timeout, the row waits forever. - When one turn gates several tools, the clock is the smallest finite
approval_timeoutin the batch, and each tool applies its ownon_approval_timeout.
Known limitation
abt looks up each tool's timeout settings by the dispatched workflow's name, so approval_timeout and on_approval_timeout take effect only when the workflow has the same name as the agent that owns the gated tool. Under any other workflow name, rows wait forever.
Enable approvals for an agent
An agent opts in with an approvals: block in its own frontmatter. The block overrides the default resource, sets per-agent options and narrows the allow-list. Its keys are use, options, allowed_approvers and bypass. Any other key is a compile warning and is ignored.
approvals:
use: slack_hitl # resource name from abt.yaml
options: # the provider's agent options; {{ var('...') }} is rendered at dispatch
thread_ts: "{{ var('thread_ts') }}"
mention: "<!subteam^S0AB>"
allowed_approvers: # optional: replaces the resource allow-list for this agent
users: ["U0MOCK00001"]
groups: ["mock-oncall"]
bypass: null # approve | deny | null
abt dispatch reads the block from the first agent node of the workflow (the entry agent), like checkpoint:. It configures the gate for the whole workflow, so put approvals: on that agent even when a later agent owns the gated tool. A subagents: dependency is never read.
| Agent frontmatter | Behaviour |
|---|---|
no approvals: block |
Opt-out, whatever approvals.default says. A dispatch on a terminal prompts there. Otherwise gated tools follow on_missing_gate (deny, approve or raise; default deny, so the call fails and nothing runs until you opt in). Bypass settings still apply. |
approvals: {use: slack_hitl} |
Opt-in with a pinned resource. |
approvals: {options: {...}} or any other non-empty block without use |
Opt-in. use resolves to approvals.default. |
An empty approvals: {} currently counts as no block in abt dispatch. Write at least one key, such as use.
The resource is the agent's use, else approvals.default (or ABT_APPROVALS_DEFAULT). If neither names one, approvals.on_unresolved decides: raise (default) logs No approval resource resolved for this workflow and denies the gated calls, while warn and disable fall back to the tool's on_missing_gate (warn logs a warning).
The resource config, options and provider type are validated at dispatch, not at compile. A mistake there shows up as denied gated calls and an error in logs/abt.log.
Project block (abt.yaml)
approvals:
enabled: true # master on/off, default false (ABT_APPROVALS_ENABLED overrides)
default: slack_hitl # resource used when an agent's approvals: block omits 'use'
on_unresolved: raise # raise (default) | warn | disable
bypass: null # approve | deny | null (see Bypass modes)
store: # optional, see Approval store
backend: sqlite
resources:
<name>:
type: slack | jira-comment | jira-status | <your provider>
credentials: <profile_namespace> # merged into config; explicit config keys win
config: {} # provider-specific
allowed_approvers:
users: ["<provider-native id>"]
groups: ["<provider-native group>"]
Environment variables (ABT_APPROVALS_* and ABT_BYPASS_APPROVALS) are listed in Environment variables.
Authorization
allowed_approvers lists who may decide. An agent's allowed_approvers replaces the resource's list.
| Provider | users accepts |
groups accepts |
|---|---|---|
slack |
Slack user IDs (U...) |
Usergroup handle or id (S...) |
jira-comment, jira-status |
Email address (recommended), username (the local part of an email at the bot's domain) or Jira accountId |
Jira group name |
- The adapter's own account never decides. A decision whose
decided_byis the adapter's own identity (the Slackbot_user_id, the Jira credential'saccountId) is ignored even when the ACL lists it, and logged with reasonadapter_own_identity. The identity is looked up once per process and cached by credential (Slack: plusbot_user_id), before a poll scans for decisions. If it cannot be looked up in time, the poll skips the scan until it can:logs/abt.loghas a warning,abt dispatchprints onewarning:line per row, and no unauthorized-attempt record is written. If the approval times out in that state it is denied, even withon_approval_timeout: approve. - A decision from anyone else is ignored. The row stays pending, abt logs
unauthorized attempt by ...inlogs/abt.logand, for backends that support it, saves an audit record (see State). - An empty list fails closed. A resource with neither
usersnorgroupsrejects every decision. Dispatch logs a warning,abt compiledoes not. - Groups are a second path. An identity that matches
usersor belongs to a listed group is allowed. A failed group or alias lookup counts as no match. - Lists must be YAML lists.
users: U123without the leading dash is rejected at dispatch.
Bypass modes
Bypass modes skip approvals without editing YAML, for break-glass access, CI or local development.
| Mode | Effect |
|---|---|
approve |
Every confirmation_required tool runs at once. A loud banner prints on stderr for each call. |
deny |
Every gated tool returns an error to the model (reason bypass:deny). |
null / unset |
The provider decides. |
Precedence, highest first:
--bypass-approvals approve|denyonabt dispatchABT_BYPASS_APPROVALS- Agent frontmatter
approvals.bypass - Project
approvals.bypass - Otherwise approvals are off when
approvals.enabledis false and normal when it is true
Any bypass setting applies to every dispatch, including agents without an approvals: block and projects with approvals.enabled: false.
State and durability
Checkpoint. Pausing needs a durable checkpoint backend: sqlite or dynamodb (see Checkpointing). With memory, the state would be lost when abt dispatch exits, so abt logs a warning and denies every gated call with the reason bypass:deny (memory-backend-fallback). Do not combine bedrock_agentcore with approvals: langchain-aws#837 drops pending tool calls on resume.
Approval store. Rows live in the store selected by approvals.store:
backend |
Use it when | config keys |
|---|---|---|
sqlite (default) |
One host. | path, absolute or project-relative. Default target/approvals/approvals.sqlite. |
memory |
Dev loops, notebooks and tests. Rows are lost on exit. | none |
dynamodb |
Several processes or hosts share approvals, for example a dispatch Lambda and a Slack-webhook Lambda. | table_name (required), region_name, endpoint_url. See DynamoDB. |
abt clean deletes target/, including the default approval and checkpoint databases. Pending approvals and the runs paused on them are lost.
A --stateless dispatch works only when the checkpoint backend and the approval store both outlive the scratch workspace and the project's target/ directory. Otherwise abt refuses with E_STATELESS_APPROVALS. Resuming on another host needs a shared checkpoint backend and a shared approval store (dynamodb).
Row statuses. pending, resolved, orphaned (the paused graph has no live interrupt), cancelled, expired (the resource config changed between post and resume) and failed (posting raised, or the row had no provider handle for the recovery window).
Config drift. Each row stores a SHA-256 hash of the resource config. If a non-secret value changes between post and resume (say, the Slack channel or the Jira project), the row becomes expired and the dispatch resumes with a denial (reason config_drift). Rotating a secret, such as the token, leaves rows alone. Secrets never reach disk: config_nonsecret_json holds the redacted config.
Concurrency. A dispatch holds a lease on the thread while it resumes. A concurrent dispatch on the same thread skips the resume and reports the thread as paused. Resolving an already-resolved row does nothing, so a webhook can fire on every event.
New prompts while an approval is pending. abt dispatch never starts a new agent turn on a paused checkpoint.
- With a store that supports queuing (
sqlite,memory,dynamodb), abt saves the prompt and printsyour prompt was queued and will run once the pending approval resolves. The next successful dispatch on that thread, normally the one that resumes the approval, replays each queued prompt as its own turn, oldest first. - A prompt whose replay fails stays queued, and abt says so on stderr. Images sent with a queued prompt are not replayed. Replay is at-most-once: abt removes the queued prompts before it runs them, so a process killed in the middle of a replay (not one that fails) loses the prompts it had not run yet.
- Without queuing support, abt prints
your prompt was not persisted; resolve the pending approval and re-dispatch.
Rows stuck with no handle. A crash between creating a row and saving the provider handle leaves a pending row with nothing to poll. After ABT_APPROVALS_HANDLE_RECOVERY_SECONDS (default 3600), the resume phase fails such a row and denies it, and a later dispatch gets a fresh one. abt approvals list marks these rows [handle_state=missing].
Unauthorized-attempt audit. Stores that implement the optional UnauthorizedAttemptLog capability (sqlite, memory and dynamodb) save every decision from an identity outside allowed_approvers. The SQLite table is approval_unauthorized_attempts (approval_id, identity, reason, attempted_at). Other stores fall back to the log warning only.
DynamoDB store
The dynamodb store behaves like SQLite, with the same statuses and guarantees, on a table shared by several processes. boto3 is a core dependency, and the approvals-dynamodb extra adds nothing to it.
Each setting comes from approvals.store.config or an environment variable, and explicit config values win: table_name or ABT_APPROVALS_DYNAMODB_TABLE, region_name or ABT_APPROVALS_DYNAMODB_REGION (default: the boto3 chain), endpoint_url or ABT_APPROVALS_DYNAMODB_ENDPOINT (DynamoDB Local, moto or VPC endpoints).
approvals:
enabled: true
default: slack_hitl
store:
backend: dynamodb
config:
table_name: abt-approvals-prod
region_name: eu-west-1
Provision the table yourself (Terraform, CDK or CloudFormation). abt never creates it. The layout is fixed: hash key PK and range key SK (both strings), a global index GSI1 on GSI1PK and GSI1SK (strings, projection All) and on-demand capacity. required_table_schema() returns the create_table arguments:
import boto3
from abt.infra.approvals.dynamodb_store import required_table_schema
boto3.client("dynamodb").create_table(
TableName="platform-shared-hitl",
**required_table_schema(),
)
Then enable DynamoDB TTL on the ttl attribute. Only thread-lease items carry it. Without TTL, expired lease items pile up, and approvals still resolve correctly.
IAM. The store calls GetItem, PutItem, UpdateItem, DeleteItem, Query (on the table and the GSI1 index ARN) and Scan (on the GSI1 index ARN, arn:aws:dynamodb:<region>:<account>:table/<table>/index/GSI1). Only abt approvals list uses Scan, so drop it from roles that never run that command. A role without it fails with E_APPROVAL_STORE_ACCESS_DENIED.
Listing cost. abt approvals list --thread-id <id> is a Query on GSI1 and reads only that thread's rows. Without --thread-id it still reads every approval row: one pass over GSI1, which holds approval rows only and has no time-ordered key, so the cost grows with the number of approvals. Only non-approval items (leases, prompt queues, audit records, other items in a shared table) are skipped. Both forms print the newest 500 rows.
Inspect and recover
abt approvals reads the approval store, target/approvals/approvals.sqlite by default. Run it from the project root or pass --project-root. Flags and every subcommand are in the CLI reference.
abt approvals list # newest first, at most 500 rows (CREATED is UTC)
abt approvals list --status pending --thread-id restart-demo
abt approvals show <APPROVAL_ID> # one row in full
abt approvals show ap_effa0ca2823e39012f16 prints:
approval_id: ap_effa0ca2823e39012f16
status: pending
agent: ops_restart
tool: restart_service
resource: local_gate (local_file)
thread_id: restart-demo
prompt_index: 0
created_at: 2026-11-06 06:48:04.940389+00:00
decided_at: None
decided_by: None
decision: β
handle: {'path': 'target/local_approvals/ap_effa0ca2823e39012f16.json'}
config_hash: 0f598ea1d28ea1a2β¦
The AGENT column holds the dispatched workflow's name, and --agent filters on it. An empty result prints No approvals found., and an unknown id prints ERROR: Approval '<id>' not found. with exit code 1.
To recover a row whose Slack message was deleted, whose Jira issue is gone or whose reviewer is unreachable:
abt approvals resume <APPROVAL_ID> --approve --by you@example.com(or--deny) records a decision. The row stayspendinguntil you runabt dispatchwith the same thread again, which replays the decision into the paused graph. A secondresumereports that the row is already decided.abt approvals cancel <APPROVAL_ID>(or--thread-id <tid>) only marks rows cancelled. The paused run stays paused and a cancelled row cannot take a decision, so useresume --denyto deny a paused run. A new dispatch after a cancel posts a fresh request.abt approvals poll <APPROVAL_ID>runs one provider check without resuming anything.
abt approvals resume is an operator-trusted path. It records --by as given and does not check it against allowed_approvers: the CLI cannot verify who is typing, and anyone who can run it can already write to the approval store. The allow-list applies to decisions that arrive through Slack, Jira or another provider. Limit who can run abt approvals in the environment that holds the store.
Thread ids. Approval rows belong to a thread. By default it is the checkpoint thread, the --thread-id of the dispatch, or <workflow>::dispatch when there is none. --approval-thread-id <id> sets it separately and stores it as custom:<id>: filter with --thread-id custom:<id> and repeat the flag on the resuming dispatch. The :: separator is reserved.
Webhook-driven dispatch
In production, a webhook usually triggers abt dispatch: Slack Events, a Jira automation rule or a CI job. Run abt dispatch -s <workflow> --thread-id <id> on every event that might carry a decision, and leave -p off when the event carries only a decision. Otherwise its text is queued and replayed as a turn.
- If the event is not a decision, the provider reports pending and the dispatch exits 0 as a no-op.
- If it is one, the resume phase resolves the approval and resumes the graph.
After a denial the model gets the tool error User rejected the tool call for <tool> with reason: .... The reason says who or what decided: decided by <reviewer>, timeout, bypass:deny, config_drift, approval_resource_not_found, approval_infra_failed (posting failed) or approval_infra_failed:missing_handle. If building the gate fails (bad credentials, unknown provider type, schema error), dispatch logs the error and denies with bypass:deny (external-gate-build-failed: <ErrorType>).
Each row stores a hash of the arguments the approver was shown. At resume, a member whose live arguments no longer match it is denied with reason tool_args_changed; the store row keeps the approver in decided_by.
Add a provider
Slack and Jira ship with abt. Anything else (PagerDuty, Microsoft Teams, GitHub issues, an internal queue) is a class that registers under the abt.external_approvals entry-point group or in providers/, as the quick start does. See Writing a provider and Extending abt.
Threat model: abt docs serve
abt docs serve binds to loopback (127.0.0.1) by default and refuses requests whose Host is not that address, and requests whose Origin differs from their Host, which blocks DNS rebinding and cross-site requests from a browser. It has no authentication. Any process on the machine that can reach the port can call /api/... to run the project's agents and to approve their gated tool calls (/api/conversations/{id}/confirm).
Run it on a machine you trust, and do not bind a non-loopback --host without a network control in front of it (a private network, an authenticating reverse proxy or a firewall rule). abt docs serve warns when you do.