Problem
aisa run executes an arbitrary single API call and --show-cost reports billing headers only after it completes. That is correct for direct, low-friction API use, but it cannot bound the cost of an Agent task: an Agent can dynamically change provider, call order, pagination, fan-out and retry behavior as its prompt, context or tool results change. A prompt such as "keep cost low" is advisory, not an enforceable execution contract.
Goal
Add a first-class plan-based transaction path to the CLI. An Agent may propose a plan, but the CLI executes only an approved, finite Transaction Manifest with a quoted cost ceiling. This is an execution artifact for a resource task, not a generic workflow/DAG-builder product.
Agent goal → candidate plan → validate/quote → user approval
→ server reserve + execution lease → CLI run → settle + receipt
P0 CLI surface
aisa plan validate <manifest>: parse a versioned declarative manifest and reject undeclared capabilities, unbounded loops/pagination/fan-out, invalid dependencies, missing idempotency policy, or missing finite caps.
aisa plan quote <manifest>: submit the complete manifest for a server quote; show expected cost and worst-case ceiling, resolved providers/prices, policy warnings and expiry.
aisa plan run <manifest> --quote <id>: execute only the frozen, approved manifest; persist a task journal so interrupted runs resume without duplicating completed operations.
aisa receipt <task-id>: render/export node-level provider, attempt/retry, status, actual cost, total cost and request/operation IDs.
- Preserve
aisa run for simple direct calls. Multi-step, high-cost or fan-out work opts into plan; do not force every low-cost read through a human-visible plan.
Manifest constraints
Each node needs a resolved capability/provider version, declared data dependencies, finite max_calls, max_concurrency, timeout, output/page bounds, bounded retry policy, fallback allow-list, side-effect classification and stable operation_id. The manifest is restricted declarative data, not arbitrary shell/JS. Runtime data may choose among declared bounded branches; any new capability, entity expansion, higher-cost provider or enlarged bound requires replan → requote → approval.
Control-plane dependency (required; not client-only)
CLI must not become the authority for money or permission. AIsaServices needs corresponding endpoints/contract to:
- validate policy and return expected + worst-case quote;
- atomically reserve the ceiling before execution;
- issue a short-lived execution lease carrying
max_spend, call/concurrency ceilings and expiry;
- settle actual provider costs and release unused reservation;
- enforce
operation_id idempotency and reject undeclared/expired/over-budget calls.
CLI handles plan UX, local scheduling, cancellation, cache and journal; service-side policy/ledger remains non-bypassable for CLI, SDK, MCP and direct API paths.
Acceptance criteria
Non-goals
- A visual/no-code workflow builder.
- Arbitrary user scripts with unanalysable network effects.
- A CLI-local balance check as the authoritative guard.
- Auto-recharge as a runaway-cost remedy.
Problem
aisa runexecutes an arbitrary single API call and--show-costreports billing headers only after it completes. That is correct for direct, low-friction API use, but it cannot bound the cost of an Agent task: an Agent can dynamically change provider, call order, pagination, fan-out and retry behavior as its prompt, context or tool results change. A prompt such as "keep cost low" is advisory, not an enforceable execution contract.Goal
Add a first-class plan-based transaction path to the CLI. An Agent may propose a plan, but the CLI executes only an approved, finite Transaction Manifest with a quoted cost ceiling. This is an execution artifact for a resource task, not a generic workflow/DAG-builder product.
P0 CLI surface
aisa plan validate <manifest>: parse a versioned declarative manifest and reject undeclared capabilities, unbounded loops/pagination/fan-out, invalid dependencies, missing idempotency policy, or missing finite caps.aisa plan quote <manifest>: submit the complete manifest for a server quote; show expected cost and worst-case ceiling, resolved providers/prices, policy warnings and expiry.aisa plan run <manifest> --quote <id>: execute only the frozen, approved manifest; persist a task journal so interrupted runs resume without duplicating completed operations.aisa receipt <task-id>: render/export node-level provider, attempt/retry, status, actual cost, total cost and request/operation IDs.aisa runfor simple direct calls. Multi-step, high-cost or fan-out work opts intoplan; do not force every low-cost read through a human-visible plan.Manifest constraints
Each node needs a resolved capability/provider version, declared data dependencies, finite
max_calls,max_concurrency, timeout, output/page bounds, bounded retry policy, fallback allow-list, side-effect classification and stableoperation_id. The manifest is restricted declarative data, not arbitrary shell/JS. Runtime data may choose among declared bounded branches; any new capability, entity expansion, higher-cost provider or enlarged bound requires replan → requote → approval.Control-plane dependency (required; not client-only)
CLI must not become the authority for money or permission. AIsaServices needs corresponding endpoints/contract to:
max_spend, call/concurrency ceilings and expiry;operation_ididempotency and reject undeclared/expired/over-budget calls.CLI handles plan UX, local scheduling, cancellation, cache and journal; service-side policy/ledger remains non-bypassable for CLI, SDK, MCP and direct API paths.
Acceptance criteria
aisa runbehavior remains compatible.Non-goals