Inspiration

AI trading agents are becoming more powerful, but also more opaque. Most systems operate as black boxes with no transparency, no accountability, and no way to verify why a trade was made. As more people are onboarded onto base, and more autonomous agents are created, I aimed to build a system that could guide the tools people make to avoid making some of the more common mistakes that are in the crypto market. I wanted to build something different: a system where AI-driven trading is safe, auditable, and governed by rules that real people can understand and control. AgentGuard was created to make AI trading transparent, policy-driven, and verifiable on-chain.

What it does

AgentGuard evaluates every AI-proposed Polymarket trade through a customizable policy engine, determines whether it should be allowed or blocked, and logs each decision on Base for tamper-proof auditability. When trades are approved, the system simulates (or optionally executes) Polymarket orders and displays results in a live dashboard. The entire workflow is transparent: every rule, decision, and on-chain log is visible in one place.

How we built it

The project was built in Bolt.new using Next.js, TypeScript, and custom API routes. A Solidity smart contract deployed on Base Sepolia logs evaluation decisions on-chain. The Polymarket integration uses the clob-client and ethers wallet libraries, with a configurable dry-run mode for safe testing. I implemented a rule engine for evaluating AI-generated trade intents, built a dashboard UI to display all evaluations and trade simulations, and integrated on-chain logging and Polymarket dry-run execution into a seamless workflow.

Challenges we ran into

The hardest challenge was debugging on-chain write errors caused by checksum mismatches and ABI inconsistencies. A single character difference between the deployed contract and the local ABI caused the entire logging pipeline to fail. I also had to design a safe architecture to simulate trading without risking real funds, while still keeping the execution logic realistic. Managing environment variables securely inside Bolt, and ensuring compatibility between viem, ethers, and Polymarket libraries, also required careful troubleshooting.

Accomplishments that we're proud of

I successfully built a fully functional AI governance layer for trading—complete with rule evaluation, on-chain logging, Polymarket simulation, and a clean dashboard interface. Fixing the smart contract logging pipeline was a major milestone. Getting the Polymarket dry-run executor working on the first attempt was another big win, and the system now provides real transparency into how AI trading decisions are made.

What we learned

I learned how crucial it is to match contract ABIs exactly, how to debug Ethereum address errors, and how to design a safe trading simulation engine. I gained a much deeper understanding of Polymarket’s CLOB architecture, on-chain logging patterns, and how to wrap AI decision-making in strong governance controls. Most importantly, I learned how to build AI systems that are safer, more auditable, and more trustworthy.

What's next for Agent Guard

Next steps include enabling real trading with secure private key management, expanding the rule engine to allow user-defined policies, integrating more prediction markets and exchanges, and adding machine-learning models to improve evaluation quality. Long term, AgentGuard could become a universal AI governance layer for all automated trading systems—transparent, safe, and fully on-chain.

Built With

  • base-sepolia
  • bolt.new
  • cryptographic-signing
  • docker-(bolt-runtime)
  • ethers.js
  • ethersproject/wallet
  • event-logging
  • hardhat
  • json
  • modern-ui-components
  • next.js
  • node.js
  • on-chain
  • polymarket-clob-client
  • postgresql
  • react
  • rest-apis
  • solidity
  • supabase
  • typescript
  • viem
Share this project:

Updates