← Back to blog

Pegas field notes · October 2026

From AI Workflow to Agentic Finance: How Pegas Learned to Pay for Expertise

How Pegas extended a multi-agent workflow with bounded authority, x402 payments on Solana Devnet, independent chain evidence, and a governance model inspired by Lead's agentic finance framework.

Pegas started with a simple product idea:

One request. The right team.

A user sends one request. Specialized AI roles understand it, reduce sensitive context where needed, decide where it should go, and independently review the result.

That already made Pegas a visible multi-agent workflow rather than a single model call hidden behind a form.

But once that worked, a more interesting question appeared:

What happens when the right next step is not another internal model call, but buying expertise from another service?

That question pushed Pegas into agentic finance.

Not by giving an LLM a wallet and hoping for the best.

By asking a much harder question:

How do you give an AI agent financial authority that is narrow, inspectable, revocable, and provable?

That became the design problem behind Pegas Agentic Payments.

The trigger: an agent that needs outside expertise

We deliberately chose a very small use case.

Imagine Pegas receives a request involving a vendor NDA. The Routing Agent can recognize that the request requires specialist Legal input.

Instead of pretending every capability exists inside one model, Pegas can request a separate paid Legal consultation.

The consultation costs:

0.01 test USDC on Solana Devnet.

The amount is intentionally tiny. The money itself is not the interesting part.

The interesting part is everything that must happen before and after the payment.

Pegas needs to know:

  • which agent is acting;
  • on whose behalf it acts;
  • which service it may purchase;
  • which counterparty it may pay;
  • which asset and network are permitted;
  • the maximum amount;
  • whether the authority is still active;
  • whether that authority has already been used;
  • whether the quoted payment still matches the approved terms;
  • whether the payment actually settled on-chain;
  • and whether the specialist response was delivered only after that settlement was proven.

That is a much more interesting system than:

LLM -> wallet -> send()text

Why we looked at Lead

While designing the payment authority model, we found a useful framing in Lead's September 2026 paper:

Leading into the AI Revolution: A proposed federal framework for agentic finance.

The paper makes an important distinction. The core issue is not whether an AI agent can call an API or move money. The issue is whether a system can clearly identify who is acting, under whose authority, within which limits, with what monitoring, and with a clean audit trail afterward.

That was very close to the problem we were trying to solve in Pegas.

So we used several ideas from the paper as design inspiration, then translated them into a small technical prototype.

Pegas is an independent project. It is not affiliated with Lead, endorsed by Lead, or an implementation of Lead's complete regulatory framework.

What we wanted to explore was simpler:

What could some of these governance ideas look like in an actual working multi-agent product?

From framework to prototype

Several concepts mapped naturally to technical primitives.

1. Agent identity

Lead discusses a world in which an autonomous agent should not simply appear as anonymous software. Its identity should be connected to a principal and to the authority it has been given.

Pegas implements a deliberately lightweight version of this idea through a KYA-lite Agent Registry.

For the paid demo we can identify:

  • the Pegas Routing Agent as the buyer;
  • the Legal Advisor as the seller;
  • the public wallet associated with each side;
  • the service the counterparty is allowed to provide.

This is not formal KYA or bank-grade identity.

It is a prototype showing what explicit agent identity can look like inside a transaction flow.

2. Delegated authority

The second idea was more important.

An AI agent should not receive vague permission to "spend money."

Pegas creates an Agent Mandate for the specific operation.

The mandate records things such as:

  • principal;
  • acting agent;
  • counterparty;
  • service;
  • purpose;
  • network;
  • asset;
  • maximum amount;
  • expiration;
  • maximum number of authorizations.

For our Legal consultation, that authority is intentionally narrow.

The agent is not allowed to discover arbitrary services and start buying things.

It is authorized for one specific demo action:

one service, one registered counterparty, one fixed asset, one fixed amount, one authorization.

3. Authority is an intersection, not a union

This became one of the most important design decisions.

A seller response cannot increase the buyer's authority.

An LLM cannot widen it.

A downstream agent cannot reinterpret it.

The effective payment authority in Pegas is the intersection of several constraints:

global policy
∩
operation mandate
∩
registered identity
∩
seller quote
∩
budget and rate controlstext

If any of those disagree, the payment does not happen.

That idea is closely aligned with one of the more interesting observations in Lead's paper: in agent-to-agent transaction chains, authority should not expand as it passes between agents.

For us, this became code rather than a prompt.

The LLM does not control the wallet

This is the most important architectural boundary in Pegas.

There is no "Payment Agent" LLM.

The model can reason about the request. It can determine that specialist Legal review is useful.

But it cannot decide:

"I think spending more money is reasonable."

It cannot change:

  • the recipient;
  • the amount;
  • the network;
  • the token;
  • the spending ceiling;
  • the mandate lifetime;
  • the number of permitted authorizations.

Those decisions belong to deterministic server-side policy.

In Pegas, model reasoning and financial authority are intentionally different layers.

Use the model for reasoning. Use deterministic code for invariants.

That distinction matters much more to us than whether the payment API itself is easy to call.

Why x402

For the actual machine-to-machine payment flow we chose x402 V2.

The pattern fits the experiment unusually well.

The Legal service behaves like a paid machine-readable resource.

Pegas calls it without payment.

The service responds with a real HTTP:

402 Payment Required

and a structured payment requirement.

Pegas then evaluates that exact requirement against its authority.

If it is approved, the server-side buyer wallet creates the payment payload and sends the signed request.

The current demo uses:

  • x402 V2;
  • exact scheme;
  • upfront payment flow;
  • Solana Devnet;
  • test USDC;
  • fixed price of 10,000 atomic units, or 0.01 test USDC.

There is no browser wallet.

There is no user MetaMask-style confirmation.

There are no real funds.

This is specifically a demo of agent-funded service consumption.

The first important implementation lesson: freeze the 402

An early version of the flow revealed a subtle authority problem.

Conceptually, it could do this:

request
-> receive 402 challenge A
-> approve challenge A
-> perform another unpaid request
-> receive challenge B
-> sign challenge Btext

That looks harmless.

It is not.

The deterministic policy would have approved one set of payment terms while the wallet could end up signing another.

That breaks the entire authority model.

So we changed the implementation around a simple invariant:

The exact 402 challenge that is approved is the exact challenge that gets signed.

The first accepted PAYMENT-REQUIRED object is frozen.

Policy evaluates that object.

Immediately before signing, Pegas re-checks the critical authority state.

Then the x402 SDK creates the payment payload from that same frozen challenge.

There is no second unpaid negotiation between approval and signing.

This sounds like a small implementation detail.

Architecturally, it is the difference between:

"the agent was generally allowed to pay"

and:

"the agent signed exactly the transaction terms that deterministic policy approved."

Ten deterministic checks before authorization

For the demo, Pegas exposes the authority decision as a visible policy chain.

The current flow checks ten controls before authorization.

They cover areas such as:

  • feature and mandate state;
  • expiry and remaining workflow time;
  • service scope;
  • registered counterparty identity;
  • network allowlist;
  • asset allowlist;
  • fixed amount ceiling;
  • single-authorization constraint;
  • request/privacy binding;
  • budget and rate controls.

A successful live run produced:

AUTH-01 through AUTH-10: passed.

The important part is that these checks are not an LLM-generated explanation of why a payment "seemed reasonable."

They are deterministic constraints.

Why Redis exists, and why it is deliberately limited

Adding payments changed one architectural assumption in Pegas.

The normal workflow is intentionally ephemeral.

We did not want to turn Pegas into a persistent workflow platform just because one agent could now pay another.

But financial side effects are different.

A browser can disconnect.

A serverless process can restart.

A request can be replayed.

A settlement can outlive the request that initiated it.

For that reason we introduced Upstash Redis, but with a strict boundary.

Redis stores payment-side state such as:

  • idempotency;
  • authorization reservations;
  • budget and concurrency controls;
  • receipts;
  • reconciliation state;
  • consumed mandates;
  • safe reuse of an already-paid operation where appropriate.

It does not become the general Pegas workflow database.

That boundary was deliberate.

Infrastructure should exist because the side effect requires it, not because persistence is fashionable.

Settlement is not proof

Another decision was to avoid treating a successful facilitator response as the final truth.

After settlement, Pegas independently checks the blockchain.

The current stack uses Alchemy as the Solana RPC evidence provider.

Pegas verifies things such as:

  • the correct network;
  • the correct token mint;
  • buyer token decrease;
  • seller token increase;
  • the expected amount;
  • transaction confirmation;
  • the actual transaction signature.

Only when the observed chain evidence matches the frozen offer do we treat the payment as confirmed.

The public receipt can then show:

  • transaction signature;
  • confirmation status;
  • token payer;
  • recipient owner;
  • asset mint;
  • amount;
  • evidence provider;
  • Solana Explorer link;
  • transfer_matches_offer: true.

This gave us another useful rule:

Settlement claims are useful. Independent evidence is better.

The live stack

The current Pegas demo deliberately combines several different infrastructure layers.

Vercel

The public Next.js application and deterministic orchestration run on Vercel.

This layer owns the workflow, policies, payment authority and public API behavior.

Modal

The AI runtime is self-hosted through Modal.

Modal runs:

  • Ollama;
  • qwen3:4b;
  • NVIDIA L4.

The same model infrastructure serves the specialist AI roles.

x402

x402 provides the machine-native paid-resource interaction:

402 challenge
-> authorization
-> signed payment
-> settlementtext

Solana Devnet

The actual demo payment settles on Solana Devnet using test USDC.

Alchemy

Alchemy provides the Solana RPC connection used for independent on-chain evidence.

Alchemy does not own the wallet and does not authorize the payment.

Its role in Pegas is evidence.

Upstash Redis

Upstash provides the payment-only persistent state required for idempotency, bounded budgets and receipts.

It is intentionally not the workflow database.

Then reality started fighting back

The architecture looked clean on paper.

The first live transaction still failed.

That was useful.

Problem 1: network identity is not the same thing as RPC genesis

The x402 / CAIP-2 identifier for the configured Solana Devnet environment is:

solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1text

Our setup verification also needed to make sure the RPC endpoint was connected to the intended cluster.

An implementation mistake treated the CAIP-2 reference as if it were the complete value returned by Solana RPC getGenesisHash.

It is not.

Our actual configured Alchemy Devnet RPC returned:

EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBGtext

The fix was conceptually simple but important:

network identifier and RPC genesis evidence are separate concepts.

The x402 network ID remained unchanged.

The RPC verification was changed to compare against the actual full genesis hash.

That allowed the infrastructure setup check to pass cleanly.

Problem 2: a valid seller wallet is not automatically ready to receive USDC

Our buyer wallet had Devnet SOL and test USDC.

Our seller wallet was a fresh Solana wallet.

Everything appeared ready.

The first x402 live smoke failed before settlement.

The facilitator returned:

invalid_exact_svm_transaction_simulation_failedtext

The buyer still had its full USDC balance, which told us no settlement had happened.

The missing piece was simple once identified:

the fresh seller wallet did not yet have the required USDC token account.

After provisioning the seller for Devnet USDC, the same architecture could proceed normally.

This was a useful reminder that "valid wallet" and "valid destination for this token transfer" are not always the same thing.

Problem 3: cold AI infrastructure is still infrastructure

The full workflow also reminded us that the payment path is only one part of the system.

The Legal Advisor still needs a model.

Our model runs on Modal, and a cold container may need time to start.

The x402 portion can be correct while the overall workflow still waits for inference infrastructure.

That is exactly why we kept payment state separate from consultation state.

If money has moved, losing the surrounding browser request must not erase that fact.

The live result

After the infrastructure fixes, we ran one controlled Devnet smoke test.

It worked.

The system produced:

  • a bounded Agent Mandate;
  • identified buyer and seller agents;
  • deterministic approval across all ten controls;
  • one authorization;
  • a real x402 V2 payment;
  • 0.01 test USDC transferred on Solana Devnet;
  • finalized settlement;
  • independent Alchemy chain evidence;
  • a matching transfer;
  • a consumed mandate;
  • a real Legal Advisor response;
  • Reviewer continuation;
  • and a replay check that produced no second payment authorization.

The transaction itself was visible through Solana Explorer.

More importantly, the system could explain why the transaction had been allowed to exist at all.

That was the real goal.

One payment means one payment

A major requirement was that an already-consumed mandate must not accidentally authorize another transaction.

After the successful workflow, the smoke test replayed the same request context.

The result:

no second payment authorization.

The consumed mandate stayed consumed.

That sounds obvious.

In agentic systems, obvious invariants are exactly the ones worth proving.

A small non-payment bug taught us something too

The successful run also surfaced an unrelated semantic problem in the Legal Advisor output.

The model produced a verdict equivalent to:

no_policy_issue_identifiedtext

while simultaneously listing findings for two policy issues.

Structurally, the JSON was valid.

Semantically, it contradicted itself.

This is a good example of why structured output schemas alone are not enough.

We added a semantic validator:

if the verdict says there is no policy issue, the findings list must be empty.

Otherwise the output fails validation and the existing repair mechanism asks the model to correct it.

The same design principle appears again:

Use the model for reasoning. Use deterministic code for invariants.

What is actually real in the demo?

We want to be explicit about that.

Real

  • real qwen3:4b model calls;
  • real self-hosted inference on Modal;
  • real multi-agent orchestration;
  • real HTTP 402 response;
  • real x402 V2 payment payload;
  • real server-side signing;
  • real Solana Devnet settlement;
  • real test USDC movement;
  • real Alchemy RPC evidence;
  • real Upstash-backed payment state;
  • real mandate consumption;
  • real deterministic policy checks;
  • real Legal Advisor result;
  • real duplicate-authorization protection.

Intentionally demo-scoped

  • fictional company;
  • fictional request;
  • Solana Devnet rather than mainnet;
  • test USDC rather than real funds;
  • fixed 0.01 USDC consultation;
  • KYA-lite rather than formal financial identity infrastructure;
  • one bounded Legal service;
  • no claim of regulatory compliance;
  • no claim of bank-grade production readiness;
  • no affiliation with Lead;
  • no legal advice.

That distinction matters.

The interesting part of the project is not pretending the prototype is already a financial institution.

It is showing, concretely, what a controlled architecture could look like.

What changed in how we think about agents

Before this extension, Pegas was mostly about coordination:

Which AI role should act next?

Agentic Payments changed the question to:

What is this agent actually allowed to do?

That is a much harder and more useful question.

The moment an AI system can create an external side effect, especially a financial one, routing quality is no longer enough.

You need:

  • identity;
  • authority;
  • constraints;
  • revocation;
  • idempotency;
  • evidence;
  • auditability.

And those cannot live only inside a prompt.

Our main takeaway

Making an AI agent send a payment was not the hard part.

The harder part was designing a system in which we could answer:

  • Why was this agent allowed to pay?
  • Who authorized it?
  • What exactly was it allowed to buy?
  • Which counterparty was permitted?
  • What was the spending limit?
  • Could the seller change the terms?
  • Could the agent pay twice?
  • Could we stop the capability globally?
  • Did the transaction actually settle?
  • Can someone reconstruct what happened afterward?

That is the part of agentic finance we find most interesting.

And that is the idea Pegas is now built to demonstrate.

Inspired by Lead, implemented independently

Several governance ideas in this prototype were conceptually inspired by Lead's September 2026 paper:

Leading into the AI Revolution: A proposed federal framework for agentic finance.

In particular, we found the ideas around:

  • principal-agent identity;
  • granular delegated authority;
  • cryptographically verifiable mandates;
  • transaction limits;
  • revocation;
  • audit trails;
  • KYA;
  • and authority intersection in multi-agent chains

especially useful as a way to think about the problem.

Pegas is an independent technical experiment exploring what a subset of those ideas can look like in software today.

Pegas is not affiliated with or endorsed by Lead, and this prototype should not be interpreted as an implementation of Lead's full regulatory framework.

What's next

The payment itself now works.

The next phase is less about adding another protocol and more about making the existing system easier to inspect.

We want a visitor to be able to look at a Pegas run and immediately understand:

request
-> mandate
-> identity
-> policy
-> 402 quote
-> authorization
-> payment
-> chain evidence
-> specialist result
-> reviewtext

Because if autonomous agents are going to perform meaningful external actions, "the AI decided to do it" is not a sufficient explanation.

The authority should be visible.

The limits should be visible.

And the evidence should survive the action.

---

Reference: Lead, Leading into the AI Revolution: A proposed federal framework for agentic finance, September 2026.

Disclosure: Pegas is an independent prototype. It is not affiliated with or endorsed by Lead. The demo uses Solana Devnet and test USDC and is not a claim of regulatory compliance or legal advice.