Skip to content

kztJames01/Haltchain

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HaltChain

Circuit breaker protocol for autonomous AI economies. Prevents goal drift, velocity attacks, and agent conflicts in real-time.

Status: Experimental

This is the reference implementation. Not production ready.

Quick Start

cargo run -p haltchain-api

Running Tests

Run unit tests for the workspace (policy, validator, API stubs):

cargo test --workspace

You can also build all crates:

cargo build --workspace

Running the Validator API (local)

Start the HTTP server (listens on port 3000):

cargo run -p haltchain-api

Health probe:

curl http://localhost:3000/health

Validate an action (allowed example):

curl -s -X POST http://localhost:3000/validate \
  -H 'Content-Type: application/json' \
  -d '{"agent_id":"trader_bot_01","api_key":"dev-key","action":{"type":"transfer","amount":500,"currency":"USD","recipient":"acct_abc"}}'

Validate an action that violates the hard-coded policy (denied):

curl -s -X POST http://localhost:3000/validate \
  -H 'Content-Type: application/json' \
  -d '{"agent_id":"trader_bot_01","api_key":"dev-key","action":{"type":"transfer","amount":1500,"currency":"USD","recipient":"acct_abc"}}'

Rate-limit / circuit-breaker behavior (10 actions per minute): send 11 rapid requests to trip the breaker:

for i in $(seq 1 11); do
  curl -s -X POST http://localhost:3000/validate \
    -H 'Content-Type: application/json' \
    -d '{"agent_id":"rater","api_key":"dev","action":{"type":"generic"}}'
  echo
done

Check agent status (circuit-breaker + rate usage):

curl http://localhost:3000/status/rater

Python SDK (quick start)

Install the SDK (dev path):

pip install ./sdk/python

Example usage:

import haltchain

agent = haltchain.Client(agent_id="trader_bot_01", api_key="dev-key")

@agent.validate
def execute_trade(order):
    # This function runs only if HaltChain returns ALLOW
    print("executing", order)

execute_trade({"type": "transfer", "amount": 100, "currency": "USD", "recipient": "acct_x"})

About

When AI agents trade with each other (negotiating supply chains, financial contracts, content moderation), errors cascade in milliseconds. Anthropic's concern isn't hypothetical—trading firms already lose millions to runaway algorithms. We need "financial circuit breakers" but for general-purpose agent interaction.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

No contributors

Languages

  • Rust 100.0%