ABC (Agent Block Chain)

Inspiration

As AI agents become increasingly autonomous — writing code, managing files, making decisions — there's a growing trust gap. How do you know what an AI actually did? How can you prove logs haven't been doctored? We were inspired by blockchain's core promise of immutability and thought: what if we applied that to AI accountability? At HackCU, we set out to build a lightweight, developer-friendly system that gives AI agents a tamper-proof audit trail instead of heavyweight infrastructure required.

What it does

ABC records every action an AI agent takes (task assignments, code generation, recommendations, errors) into a SHA-256 hash chain stored in a human-readable markdown file (ledger.md). Each entry (block) contains:

  • Who performed the action (agent ID)
  • What they did (action type + payload)
  • When it happened (timestamp)
  • A cryptographic hash that chains to the previous block

If anyone modifies a past record, the hash chain breaks — and abc verify catches it instantly. ABC includes:

  • CLI — Record actions, view logs, diff blocks, and verify chain integrity from the terminal
  • Web Dashboard — A real-time visual interface for monitoring agent activity, filtering by agent, and verifying the chain with one click
  • Python SDK — Import directly into your codebase for programmatic recording

How we built it

  • Core engine: Python with SHA-256 hashing (hashlib) and Pydantic for data validation
  • CLI: Built with Typer and Rich for beautiful terminal output
  • Dashboard: FastAPI backend with SSE (Server-Sent Events) for real-time updates, served as a single-page HTML/JS frontend
  • Storage: Markdown-based ledger (ledger.md) — no database needed, fully portable, human-readable, and version-controllable with Git
  • Integration demo: Connected ABC to a Magic Mirror AI application that uses local LLM vision (Ollama/LLaVA) for outfit recommendations, logging every AI decision to the blockchain

Challenges we ran into

  • Canonical JSON serialization — Hash consistency requires deterministic JSON output (sorted keys, consistent spacing). One stray whitespace character and the entire chain breaks.
  • Markdown parsing — Reading and writing structured JSON blocks inside markdown while preserving formatting was trickier than expected.
  • Chain integrity during development — Every time we changed the block schema during prototyping, we had to re-genesis the chain since old blocks would fail verification.
  • Real-time dashboard updates — Getting SSE to reliably push new blocks to the browser without dropping connections required careful error handling.

Accomplishments that we're proud of

  • Zero external dependencies for the core — The blockchain engine uses only Python's standard library (hashlib, json). No heavyweight blockchain frameworks.
  • Human-readable storage — Unlike traditional blockchains that use binary databases, our ledger is a plain markdown file you can open in any text editor or commit to Git.
  • Full verification in milliseconds — Verifying 25+ blocks with SHA-256 hash chain validation runs nearly instantly.
  • End-to-end integration — We demonstrated ABC working live with a real AI application (Magic Mirror), proving it's not just theoretical.

What we learned

  • Blockchain fundamentals don't require complex infrastructure — the core concept of hash-chaining is elegantly simple
  • Canonical serialization is crucial for any hash-based integrity system
  • AI accountability is a real and growing need as agents become more autonomous
  • Building developer tools requires obsessive attention to UX — the CLI needed to feel as natural as git log

What's next for ABC (Agent Block Chain)

  • Multi-agent consensus — Allow multiple agents to cross-sign blocks for distributed verification
  • Automatic recording hooks — Middleware/plugins for popular AI frameworks (LangChain, CrewAI) that auto-log agent actions without manual abc record calls
  • Cloud sync — Optional encrypted backup of ledgers to cloud storage while preserving local-first philosophy
  • Tamper alerting — Real-time notifications when chain integrity violations are detected
  • Block explorer — Enhanced dashboard with search, analytics, and agent behavior visualization
  • Signed blocks — Add public-key cryptography so each agent's identity is cryptographically verified, not just self-reported

Built With

Share this project:

Updates