Skip to content

Snowbase-Studio/Halt.rs

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘ Halt.rs - Multi-Agent Proxy for Swarm Control

Halt.rs License Rust Stars

Prevent runaway AI agent costs before they happen.

Features β€’ Quick Start β€’ Documentation β€’ Contributing


🎯 The Problem

Building multi-agent AI systems? You've probably faced these nightmares:

  • $500 API Bills: Agent A calls Agent B, which calls Agent A again... infinite loops that drain your wallet
  • Priority Chaos: Your "Boss Agent" gets stuck behind hundreds of low-priority logging tasks
  • Debugging Hell: Which agent started the loop? Who's spamming the system? Good luck finding out

πŸš€ The Solution

Halt.rs is a production-grade Rust-based proxy that prevents these disasters before they happen:

πŸ›‘οΈ Circuit Breaker

  • Monitors inter-agent call frequency
  • Trips automatically when Agent A triggers Agent B >5 times in 30 seconds without a terminal state
  • Returns "Cooling Down" error to save you from API bills
  • Configurable thresholds and time windows

πŸ“Š Backpressure Queue

  • Priority-based task queuing (High/Medium/Low)
  • Your "Boss Agent" always gets priority over worker agents
  • Automatic throttling during traffic spikes
  • Configurable capacity limits

πŸ—ΊοΈ Audit-Log Transparency

  • Real-time swarm topology mapping
  • Tracks every "Token Path" so you can see exactly which agent started the loop
  • Visual debugging of multi-agent systems
  • JSON export for integration with monitoring tools

🌐 Multi-Language Support

  • Rust Core: High-performance, memory-safe implementation
  • Python Bindings: Full async client with Pydantic models
  • Java Bindings: JNI-based proxy with comprehensive API
  • TypeScript/JavaScript: WASM integration + REST client
  • Go Bindings: High-performance fasthttp client

πŸ”Œ Model Context Protocol (MCP)

  • Native MCP server for IDE integration
  • Instant installation in Cursor, VSCode, Zed, JetBrains
  • Real-time topology updates via WebSocket
  • Comprehensive tool and resource definitions

🐳 Enterprise Features

  • Docker: Multi-stage containerization
  • CI/CD: GitHub Actions with cross-platform builds
  • REST API: Full HTTP server for remote control
  • WebSocket: Real-time monitoring and updates
  • SQLite: Persistent storage for audit logs and tasks
  • CLI Tool: Command-line interface for management
  • Plugin System: Extensible architecture for custom strategies

✨ Features

Core Capabilities

Feature Description
Circuit Breaker Prevents infinite loops between agents with configurable thresholds
Backpressure Queue Priority-based task queuing with automatic throttling
Audit Logging Real-time swarm topology mapping with token path tracking
REST API Full HTTP server for remote control and monitoring
WebSocket Real-time updates for topology changes
CLI Tool Command-line interface for management operations
MCP Server Model Context Protocol for IDE integration
Plugin System Extensible architecture for custom implementations

Language Bindings

Language Package Status
Rust halt βœ… Core
Python halt-py βœ… Stable
Java halt-java βœ… Stable
TypeScript halt-js βœ… Stable
Go halt-go βœ… Stable

Infrastructure

Component Description
Docker Multi-stage containerization
CI/CD GitHub Actions with cross-platform builds
Build Scripts Comprehensive bash scripts for all platforms
Tests Jest (TS), pytest (Python), cargo test (Rust)
Benchmarks Criterion.rs performance benchmarks
Documentation Comprehensive docs and examples

πŸš€ Quick Start

Installation

# Rust
cargo install halt

# Python
pip install halt-py

# Java
# Add to pom.xml or download JAR

# TypeScript/JavaScript
npm install halt-js

Run Server

halt serve --port 8080

Basic Usage

Rust

use halt::{CircuitBreaker, BackpressureQueue, AuditLogger};

let breaker = CircuitBreaker::new(5, 30); // 5 calls per 30 seconds
let queue = BackpressureQueue::new(1000);
let logger = AuditLogger::new();

// Register a call
if let Err(err) = breaker.register_call("AgentA", "AgentB", false) {
    println!("Circuit tripped: {}", err);
}

Python

from halt import HaltClient, Priority

client = HaltClient()
client.push_task("Reasoning", Priority.HIGH, '{"model": "gpt-4"}')
topology = client.get_topology()

TypeScript

import { HaltRestClient } from 'halt-js';

const client = new HaltRestClient('http://localhost:8080');
await client.registerCall('AgentA', 'AgentB', false);

Java

HaltProxy proxy = new HaltProxy();
String status = proxy.checkBreaker("AgentA", "AgentB");

Go

client := halt.NewClient("http://localhost:8080")
resp, err := client.PushTask("Reasoning", halt.PriorityHigh, `{"model": "gpt-4"}`)

πŸ“š Documentation

API Reference

Examples

Architecture


πŸ”§ Configuration

Halt.rs can be configured via environment variables:

export HALT_CIRCUIT_THRESHOLD=5
export HALT_CIRCUIT_WINDOW_SECONDS=30
export HALT_QUEUE_CAPACITY=1000
export HALT_DATABASE_PATH=./halt.db

See config/default.env for all options.


πŸ§ͺ Testing

# Run all tests
./scripts/build/build.sh test

# Run specific test suites
cargo test                    # Rust tests
cd mcp-server && npm test     # MCP server tests
cd bindings/python && pytest  # Python tests

🐳 Docker

# Build
docker build -t halt-rs:latest -f docker/Dockerfile .

# Run
docker run -d --name halt -p 8080:8080 halt-rs:latest

πŸ“– Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Development Setup

# Clone
git clone https://github.com/halt-rs/halt.git
cd halt

# Build
./scripts/build/build.sh all

# Test
./scripts/build/build.sh test

# Run dev server
cargo run -- serve

πŸŽ“ Use Cases

1. Multi-Agent Orchestration

Prevent runaway loops in complex agent systems

2. API Cost Management

Stop infinite recursive calls before they drain your budget

3. Priority-Based Task Processing

Ensure critical reasoning tasks aren't blocked by logging

4. System Debugging

Visual topology maps for understanding agent interactions

5. Production Monitoring

Real-time metrics and audit logs for observability


πŸ—οΈ Architecture

halt-rs/
β”œβ”€β”€ src/                    # Core Rust implementation
β”‚   β”œβ”€β”€ core/              # Circuit breaker, queue, audit logger
β”‚   β”œβ”€β”€ api/               # REST API and WebSocket
β”‚   β”œβ”€β”€ cli/               # Command-line interface
β”‚   └── mcp/               # Model Context Protocol
β”œβ”€β”€ bindings/              # Language bindings
β”‚   β”œβ”€β”€ python/            # Python bindings
β”‚   β”œβ”€β”€ java/              # Java bindings
β”‚   β”œβ”€β”€ typescript/        # TypeScript bindings
β”‚   └── go/                # Go bindings
β”œβ”€β”€ mcp-server/            # MCP TypeScript server
β”œβ”€β”€ docker/                 # Docker containerization
β”œβ”€β”€ docs/                   # Documentation
β”œβ”€β”€ examples/              # Code examples
β”œβ”€β”€ scripts/                # Build and deployment
└── tests/                  # Integration tests

πŸ“Š Performance

  • Circuit Breaker: <1ΞΌs per call
  • Queue Operations: <100ΞΌs push/pop
  • Audit Logging: <500ΞΌs per interaction
  • Memory Usage: <50MB idle, <200MB with 10k tasks
  • Throughput: 10k+ operations/second

See benches/performance.rs for benchmarks.


πŸ”’ Security

  • Input validation on all API endpoints
  • SQL injection protection
  • Rate limiting support
  • No authentication by default (configure for production)

πŸ“ License

MIT License - see LICENSE for details


πŸ™ Acknowledgments

Built with:

  • Rust: Core implementation
  • Actix-web: HTTP server
  • Model Context Protocol: IDE integration
  • Tokio: Async runtime
  • SQLite: Persistent storage

🌟 Star History

Star History Chart


πŸ“ž Support


⬆ Back to Top

Made with ❀️ by the Halt.rs Team

About

Prevent runaway AI agent costs with circuit breaker, backpressure queue, and audit logging.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 38.7%
  • JavaScript 13.2%
  • Python 12.6%
  • Go 11.1%
  • Java 8.2%
  • Shell 8.0%
  • Other 8.2%