Selected workCase study

AI agents that negotiate with suppliers over real email, and can't commit to a deal until the company's rules say yes.

MultiAgent Governance and Audit System. My final-year project at FAST NUCES Lahore, built by a team of three.

Project
Final-year project, FAST NUCES Lahore
My part
The confidential checks and the on-chain record
Team
Three students and a supervisor
Status
Prototyping now. Full build January to May 2027
01

The problem

An AI agent that can buy things will, sooner or later, be talked into something it shouldn't do.

It might be a cleverly worded email from a vendor, a bug, or a prompt nobody tested. Most tools only notice afterwards, in the logs. By then the order is placed and the money is gone.

MAGAS moves the check to before the action. The agent can read, draft and negotiate freely, but it can't commit to anything until the company's rules have said yes.

02

How a deal goes through

  1. 01

    A vendor sends an offer

    A buyer agent and a vendor agent negotiate over real email, through the Gmail API. Both listen to their inboxes and reply as messages arrive.

  2. 02

    The agent writes down its intent

    Before it says yes, the buyer agent records exactly what it wants to do: who it would pay, how much, and why. Nothing has been sent yet.

  3. 03

    The rules are checked, privately

    Two checks run: is this vendor on the approved list, and is the total under the spending limit? They run inside Arcium’s encrypted computation, so the company’s actual limits stay hidden, even from the computers doing the checking.

  4. 04

    A receipt goes on the blockchain

    The decision record (which agent, when, what it saw, what it planned and the verdict) is hashed with SHA-256, and that fingerprint is anchored on Solana. The full record is stored in PostgreSQL next to it.

  5. 05

    Only then does it act

    An approved deal gets its reply. A rejected one doesn’t, and there is no path around the check. Every decision moves through five states:

    PendingApprovedRejectedSuccessFailed
03

A guardrail, not just a log

The most important design rule in MAGAS is keeping two jobs apart.

The guardrail: Arcium

Decides

Runs the policy checks on encrypted inputs and returns a verdict. This is the part that actually stops a bad action.

The receipt: Solana

Proves

Stores only a fingerprint of each decision. It doesn’t make decisions. It makes later tampering detectable.

Mixing these up is a common overclaim in blockchain projects. A contract that only logs isn’t a guardrail, and a record in your own database isn’t proof. So to check for tampering, MAGAS reads the chain directly instead of comparing two copies inside the same database.

04

Who can see what

Each company can ask questions about its own agent’s decisions in plain English, through a search over the decision records (RAG). It can never see the other side’s.

  • The company filter runs before the search, not after, so other records never reach the AI at all.
  • It’s enforced by row-level security in PostgreSQL, not only by the app.
  • The test vendor runs on its own separate database, so the separation is real, not simulated.
05

Risks I’m tracking

I’m trained to attack systems, so I keep a list of the ways MAGAS could be broken. These are open items I’m designing against, not solved problems.

  • Prompt injection hidden in a vendor’s email, aimed at the buyer agent.
  • Someone with the update key quietly swapping the policy.
  • The central database becoming a trust point that nothing anchors.
  • The checking network going down. It must fail closed: no check, no action.
  • Policy values leaking into the agents’ own logs.
  • Custody of the encryption keys, and timing patterns that could hint at what’s being checked.
06

Honest limits

What this isn’t, yet

For the project, MAGAS runs on a local test network, not a public blockchain. The confidential checks rely on Arcium’s security model, which one local test setup can’t demonstrate, so I document that limit instead of hiding it. And the on-chain record is tamper-evident. It is not a mathematical proof that a decision was right.

Built with LangGraph for the agents, Arcium and Solana (Rust, Anchor) for the checks and receipts, PostgreSQL with row-level security, and the Gmail API for real email.

The same pattern works anywhere an AI acts for you: purchasing, refunds, emails to customers. Check first, keep the receipt.

How I bring this to client builds

Want checks like this on your AI?

Tell me what your AI is allowed to do today, and what must never happen. You’ll get a straight answer on how to put guardrails around it.

Or write directly to mailbilalkhan9@gmail.com

A useful first message says

  • What the task is, in your own words
  • How often it happens, and who does it today
  • Which tools it touches: email, spreadsheets, a CRM
  • What must never go wrong