Halt Core
Halt Core is a zero-trust, sub-millisecond security middleware and execution guardrail for autonomous AI agents. It intercepts, parses, and validates agent-generated system commands and database queries locally before they are executed.
Key Capabilities
- Python AST Shield: Parses dynamic Python scripts to block unsafe imports (
subprocess,sys), calls (eval,exec), and dunder sandbox escapes (__class__,__subclasses__). - Deep Shell Parser: Tokenizes and parses chained terminal commands (separators:
&&,||,|,;). Unwraps execution wrappers (sudo,env) and blocks dynamic command execution (e.g.$(echo rm)). - File Payload Analyzer: Scans files created by agents (e.g.
.py,.sh,.bat) at write-time. Inspects script code and flags obfuscated payload signatures (Fork bombs, Base64 decodes). - REST API Service: Can be run as a standalone language-agnostic HTTP microservice.
- Structured Logging: Formats intercept logs as JSON lines for SIEM/telemetry tools.
- External Configuration: Customize block lists and settings dynamically using a local
halt_config.json.
Installation
Ensure you have Python 3.9+ installed.
pip install halt-core
Optional: Local Semantic Engine (Phi-4-mini)
If the static rules pass but the command is structurally complex, Halt Core can route it to a local Small Language Model (SLM) for intent verification. Install Ollama and pull the model:
ollama run phi4-mini
Quick Start
1. Python Library Usage
Integrate Halt Core directly into your execution pipelines:
from halt_core import evaluate
# Intercept and validate agent command
decision = evaluate(
action_type="shell",
command="rm -rf /",
agent_id="agent_worker_01"
)
if not decision["approved"]:
print(f"Action blocked: {decision['reason']}")
print(f"Suggested remediation: {decision['remediation']}")
else:
# Safe to execute
pass
2. Standalone REST API Service
Run the service:
uvicorn halt_core.main:app --host 0.0.0.0 --port 8000
Query the gateway from any programming language (Node.js, Go, Java):
- Endpoint:
POST http://localhost:8000/intercept - Payload:
{"action_type": "shell", "command": "rm -rf /", "agent_id": "agent_01"}
External Configuration (halt_config.json)
To customize security parameters without modifying code, create a halt_config.json file in your working directory:
{
"deny_commands": ["rm", "sudo", "chmod", "wget", "curl"],
"blocked_modules": ["subprocess", "importlib", "pdb"],
"blocked_functions": ["eval", "exec"]
}
Integration Example: LangChain Secured Tool
To secure LangChain agents, wrap your execution tools with Halt Core. If a command is blocked, the remediation feedback is returned to the agent so it can self-correct:
from langchain.tools import tool
from halt_core import evaluate
import subprocess
@tool
def secured_shell(command: str) -> str:
"""Executes a system shell command, validated by Halt Core."""
# 1. Intercept command
decision = evaluate(action_type="shell", command=command, agent_id="agent_01")
# 2. Block if unsafe
if not decision["approved"]:
return (
f"ERROR: Action Blocked by Halt Core Security.\n"
f"Reason: {decision['reason']}\n"
f"Remediation: {decision['remediation']}"
)
# 3. Execute safely if approved
try:
res = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=10)
return res.stdout if res.returncode == 0 else res.stderr
except Exception as e:
return str(e)
Metadata
Release files for halt-core 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| halt_core-0.3.2.tar.gz | 24.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| halt_core-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.2 kB
Release files / halt_core-0.3.2.tar.gz
| Download URL | halt_core-0.3.2.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa47ad3f733703f8884cdd2222c367cc65dda43ae0209d396220618cae5f3467
|
|
BLAKE2b-256 checksum How to use checksums |
23607c1fd4b49184ec60dddef80bb3808573744bf5e2292d594d79670e0c5019
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Release files / halt_core-0.3.2-py3-none-any.whl
| Download URL | halt_core-0.3.2-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da8b8d08559a0418253c6b3e7fcad1c8d4309fb0d46ee58146512e0441868ae1
|
|
BLAKE2b-256 checksum How to use checksums |
20aa01861ebf482ce64cb401cdaa51c6b0102a39a0078bb6f38424cdf6d66a7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Security for halt-core 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.