Observed since 20 Oct, 22:59 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Preview and validate AI agent actions before execution.
Preview what your AI agent will do before it does it.
The terraform plan for AI agents. Open-source middleware that intercepts tool calls, classifies risk, and shows a human-readable execution plan before anything touches the real world.
================================================================
PREFLIGHT PLAN 5 action(s)
Send Q3 report to Sarah at Acme
================================================================
WARNING: 3 irreversible action(s) in plan
1. search_contacts [READ] [REVERSIBLE]
query: 'Sarah from Acme'
!! 2. send_email [WRITE] [IRREVERSIBLE]
to: 'sarah@acme.com'
subject: 'Q3 Performance Report'
body: 'Hi Sarah, please find the Q3 report attached...'
> External communication - cannot be unsent
! 3. update_database [WRITE] [REVERSIBLE]
query: "UPDATE invoices SET status='sent' WHERE quarter=...
!! 4. delete_old_records [DELETE] [IRREVERSIBLE]
table: 'temp_reports'
before_date: '2025-01-01'
> Destructive operation
! 5. generate_image [EXEC] [IRREVERSIBLE]
prompt: 'Professional header image for Q3 report'
est. cost: $0.0800
================================================================
Risk: HIGH (3 irreversible)
Cost: $0.0800 estimated
Actions: 5 total
================================================================
Agents take irreversible actions with zero preview:
Every incident had the same root cause: nobody saw what the agent was about to do.
Observability tools watch after. Security tools block. Preflight shows you the plan.
pip install agent-preflight
from agent_preflight import Preflight
pf = Preflight()
# Wrap your agent's tools
@pf.intercept
def send_email(to, subject, body):
smtp.send(to, subject, body)
@pf.intercept
def update_database(query):
db.execute(query)
@pf.intercept(cost=0.08)
def generate_image(prompt):
return dalle.generate(prompt)
# Run your agent in dry-run mode
plan = pf.dry_run(my_agent_workflow, task="Send Q3 report")
# See the full plan before anything executes
print(pf.format(plan))
# Approve and execute
plan.approve()
plan.execute()
Action Classification - Automatically detects risk level, reversibility, and action type from function names and arguments. send_email -> IRREVERSIBLE. get_users -> READ/LOW. DROP TABLE in args -> CRITICAL.
Loop Detection - Flags when the same tool is called 3+ times, catching runaway agent loops before they become $47K bills.
Cost Tracking - Attach cost estimates to tools, set budget limits. Preflight warns when a plan exceeds your threshold.
SQL Danger Detection - Catches DROP TABLE, DELETE without WHERE, TRUNCATE, and other destructive SQL patterns in arguments.
Approve/Execute Flow - Plans must be explicitly approved before execution. No accidental runs.
JSON Export - plan.to_json() for programmatic use, CI/CD integration, and audit trails.
Context Manager - Record mode for capturing actions in existing code:
with pf.recording(task="nightly cleanup") as rec:
cleanup_old_files()
archive_logs()
print(pf.format(rec.plan))
Custom Classifiers - Add your own classification logic:
def my_classifier(action):
if "prod" in str(action.args):
action.risk_level = RiskLevel.CRITICAL
action.risk_reasons.append("Production environment detected")
return action
pf.add_classifier(my_classifier)
@pf.intercept wraps your tool functionspf.dry_run() executes your agent logic but captures calls instead of running themZero dependencies. Works with any Python agent framework.
preflight demo
Preflight(auto_classify=True, max_actions=100, cost_limit=None)Create a preflight engine.
auto_classify - Run built-in classifiers on captured actionsmax_actions - Safety cap on captured actions per dry runcost_limit - Warn if total estimated cost exceeds this@pf.intercept / @pf.intercept(cost=0.05, reversible=False)Decorator to register a tool for interception. Supports manual metadata overrides.
pf.dry_run(run_fn, task="")Execute run_fn in dry-run mode. All intercepted calls are captured, not executed. Returns a Plan.
Planplan.actions - List of captured ActionCapture objectsplan.overall_risk - Highest risk level across all actionsplan.irreversible_count - Number of irreversible actionsplan.warnings - Auto-generated warnings (loops, cost, irreversible actions)plan.approve() - Mark plan as approvedplan.execute() - Execute all actions (must approve first)plan.to_json() - Export as JSONplan.to_dict() - Export as dictpf.format(plan, color=True)Render plan as terminal output with ANSI colors.
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 4 Mar 2026 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:59 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:17befb451cbffc6b3fabc384177a1929d113017dbf116ab9e230541dbe4fcd84