Skip to content

Proposal: optional external spend-authority gate before lease creation (fail-closed, audit receipts) #4549

Open

Description

@eddyflores100-lang

Context

Akash console is becoming a programmatic deployment gateway — and agents are starting to hold wallets and pay for their own GPU leases (x402-style payments and USDC micropayments are live in the agent ecosystem). Today, nothing stands between "an agent decided to spend" and "the lease got created" except whatever budget config lives inside the agent itself.

Proposal

An optional, host-configured external spend-authority hook in the deployment/lease approval path: before creating a lease, the console consults a configured authority endpoint with a frozen spend request (caller, operation id, amount, currency, deployment facts) and proceeds only on an unambiguous allow.

Design guarantees we'd bring (reference contract already public):

  • Fail-closed: 2xx + {"decision":"allow"} proceeds; timeout, non-2xx, malformed verdict, or any ambiguity -> deny-as-unavailable. The only path to allow is an explicit verdict.
  • Replay protection: (caller_id, operation_id) so a retried request can't double-spend.
  • Audit receipts: signed verdicts (Ed25519) + hash-chained receipts, verifiable offline later.
  • No on-chain changes: this is a host-side policy checkpoint, exactly where console sits.

Reference contract (Rust, working code + tests): solana-foundation/pay#525 — a reference RemoteHttpAuthority (HTTP(S) consultation, redirects disabled, deadline-bounded) built on the SpendingAuthority trait from #514. Production implementation: UTA (Universal Trust Adapter), https://utalabs.tech — currently dogfooding as the spend authority for an agent making real x402 payments.

Ask

Would the team be open to an optional integration point here (env/config-gated, default off) so that operators running agent fleets on Akash can enforce external budgets without forking console? Happy to spec the request/response shape against the #525 contract if there's interest.

Activity

  1. pullfrog commented on Oct 22, 2026

    @pullfrog
    Contributor

    Thanks for the detailed write-up. I checked for existing coverage (spend gates, budget enforcement, lease approval, x402/agent payments) — no open issue covers this, so it's a new topic here.

    Some grounding from the codebase, since it directly affects feasibility:

    All console-sourced spend already flows through apps/api. deploy-web no longer supports browser-extension wallets — WalletProvider resolves only a managed wallet (apps/deploy-web/src/context/WalletProvider/WalletProvider.tsx:56) — and leases are composed and signed server-side: POST /v1/leases → LeaseService.#planCreation, which runs every refusal before anything is recorded or queued (apps/api/src/deployment/services/lease/lease.service.ts:126). So a host-side checkpoint in the api would genuinely cover every console spend, including API-key callers — the insertion point this proposal needs does exist.

    The gates that exist today are all internal — none consult an external authority:

    • project budgets: assertWithinBudgets → 403 project_budget_exceeded (apps/api/src/billing/services/deployment-deposit-ledger/deployment-deposit-ledger.service.ts:133)
    • grant allowances, activation, trial caps and abuse locks in ManagedSignerService's pre-broadcast checks (apps/api/src/billing/services/managed-signer/managed-signer.service.ts:177)
    • tx-signer's TxPolicyService as the last line: per-message actor bindings (including MsgCreateLease) and rejection of grants without finite spend limits (apps/tx-signer/src/services/tx-policy/tx-policy.service.ts:28)

    The building blocks for an outbound authority call also exist: ExternalSignerHttpSdkService (typed HTTP client with api-key + timeout) and ProviderOutagesHttpService (fetch + zod-parsed response) are the two templates, and fail-closed matches house style (requireInternalToken already fails closed when unset).

    What would need deciding before this is spec-able:

    1. Tenancy model — console is a multi-tenant service; an env-configured authority endpoint would gate every user of that deployment. Is the intended model operators self-hosting console for their agent fleets, or per-org/per-user authority configuration on the hosted service?
    2. Scope of "spend" — lease creation only, or every spend message (deployment-create deposit, top-ups, /v1/tx)? The budget gate today covers deposits at both create and top-up; the same boundary question applies to an external gate.
    3. Deny surface — a new error code alongside project_budget_exceeded, for both API-key callers and the web UI?
    4. Receipts — where signed verdicts and the hash chain would live, who distributes/rotates the Ed25519 verification keys, and what retention is expected?

    Items 1 and 2 are the ones that determine whether this is a small middleware or a larger configuration surface.

    Pullfrog  | Implement a fix ➔ | View workflow run | via Pullfrog | Using GLM-5.3 | 𝕏

  2. eddyflores100-lang commented on Oct 22, 2026

    @eddyflores100-lang
    Author

    Answering the four questions in order — items 1 and 2 first, since they set the shape.

    1. Tenancy model: operator-level, self-hosted fleets. The authority endpoint is operator configuration, in the same spirit as the existing internal gates (requireInternalToken already fails closed when unset — same pattern, one more consult). Console changes nothing per-user: the operator points a deployment at an authority, and every spend intent from that deployment is gated. Per-org/per-user authority routing on the hosted service is a future layer; it does not need console changes because the verdict carries the subject, so different fleets can sit behind different authorities without this codebase caring.

    2. Scope of spend: lease creation first, then the existing budget boundary. Start with LeaseService.#planCreation — the highest-value, hardest-to-un-serve operation, and the one where serving-first leaves the operator exposed. Once that is proven, extend to the boundary assertWithinBudgets already covers (deposits at create and top-up) and /v1/tx via TxPolicyService as the last line. Principle: gate where the internal gates already live, so there is one policy boundary, not two competing ones. This is the small-middleware path.

    3. Deny surface: a dedicated code, structured reason, no upstream leakage. New error alongside project_budget_exceeded (e.g. spend_authority_denied), surfaced to both API-key callers and the web UI. The verdict's deny reason and verdict id go out as structured detail; the authority's URL, errors and internals never leave the server logs. Timeout, malformed response, non-2xx and an explicit deny are all the same outcome: fail closed, with authority_unavailable distinguishable from denied only in the operator-facing logs.

    4. Receipts: signed verdicts, operator-pinned key, no PII egress. Verdicts are Ed25519 signatures over the RFC 8785 JCS canonical form, scope-bound to {challenge, resource, amount_usd} (RFC-ATC §5.2 rev 4 — hardened through public review, incl. a seller-side premise check on sub-cent pricing). The challenge is console-minted and one-time, so replay dies with no operator-side state. Verification key is pinned in console config; verdicts carry a key id for rotation. Retention sits with the existing lease audit trail; what leaves the deployment is spend-intent metadata only (resource, amount, agent subject) — no user PII. Reference implementation, MIT: https://github.com/alicelabs-llc/universal-trust-adapter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions