Observed since 20 Oct, 22:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
agenticontrol
AGENTICONTROL V0 MVP - Control plane for AI agents with synchronous blocking and asynchronous logging
Control plane for AI agents with synchronous blocking and asynchronous logging.
AGENTICONTROL provides:
richpip install agenticontrol
pip install agenticontrol
from langchain.agents import initialize_agent, AgentType
from langchain.llms import OpenAI
from agenticontrol.hooks.langchain_handler import AgenticontrolCallbackHandler
# Initialize the callback handler
handler = AgenticontrolCallbackHandler(
api_url="http://localhost:8000/api/v1/ingest/trace", # Your backend URL
api_key=None, # Optional API key
enable_blocking=True, # Enable Policy V0 and Loop Detection
enable_logging=True, # Enable async trace logging
)
# Use with LangChain agent
agent = initialize_agent(
tools=tools,
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
callbacks=[handler],
verbose=True
)
# Run agent - blocking checks happen automatically
try:
result = agent.run("Your query here")
print(f"Result: {result}")
except PolicyViolationError as e:
print(f"Agent blocked: {e}")
# Cleanup
import asyncio
asyncio.run(handler.flush())
asyncio.run(handler.close())
from agenticontrol.hooks.langchain_handler import AgenticontrolCallbackHandler
# Local-only mode: blocking checks work, but no cloud logging
handler = AgenticontrolCallbackHandler(
api_url=None, # Local-only mode
enable_blocking=True,
enable_logging=False
)
The terminal viewer provides real-time trace visualization:
from agenticontrol.local.viewer import TraceViewer, get_viewer
# Get the viewer instance
viewer = get_viewer()
# Events are automatically displayed when using the callback handler
# The viewer shows:
# - 💭 LLM prompts and responses
# - 🛠 Tool calls and outputs
# - 🛑 Blocked operations (Policy V0, Loop Detection)
# - 💰 Cost tracking
See the examples/ directory for complete examples:
basic_usage.py - Basic LangChain integrationloop_detection_demo.py - Loop detection demonstrationpolicy_v0_demo.py - Policy V0 checks demonstrationBlocks dangerous operations synchronously (zero latency):
DROP TABLE, DELETE FROMrm -rf, dangerous paths# Automatically blocks dangerous operations
agent.run("DROP TABLE users") # Raises PolicyV0ViolationError
Detects and halts infinite loops (Rule A & B):
# Blocks after 5 identical tool calls
for i in range(10):
agent.run("search for 'test'") # Blocks on 6th identical call
Tracks token usage and estimated costs:
Beautiful real-time trace visualization:
Async trace ingestion to Supabase:
PolicyViolationError to halt execution immediatelyMain callback handler for LangChain integration.
Parameters:
api_url (str, optional): Backend API URL for trace ingestionapi_key (str, optional): API key for authenticationrun_id (UUID, optional): Unique identifier for this run (auto-generated)risk_engine (RiskEngine, optional): Custom risk engine instanceenable_blocking (bool): Enable synchronous blocking checks (default: True)enable_logging (bool): Enable async trace logging (default: True)Methods:
flush(): Flush pending events to cloud (async)close(): Close client connections (async)PolicyViolationError: Base exception for all policy violationsPolicyV0ViolationError: Raised when Policy V0 check failsLoopDetectedError: Raised when loop detection triggersCostThresholdExceededError: Raised when cost threshold exceeded# Clone repository
git clone https://github.com/yourorg/agenticontrol.git
cd agenticontrol
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=src/agenticontrol --cov-report=html
# Format code
black src tests examples
# Lint code
ruff check src tests examples
# Type checking
mypy src
# Basic usage
python examples/basic_usage.py
# Loop detection demo
python examples/loop_detection_demo.py
# Policy V0 demo
python examples/policy_v0_demo.py
cd backend
python run_server.py
# Or: python -m uvicorn backend.app.main:app --reload
src/agenticontrol/
├── models.py # Pydantic models (TraceEvent, RunMetadata, RiskResult)
├── risk_engine.py # Synchronous blocking checks
├── client.py # Async HTTP client
├── exceptions.py # PolicyViolationError hierarchy
└── hooks/
└── langchain_handler.py # LangChain integration
local/
└── viewer.py # Terminal trace viewer
backend/
└── app/ # FastAPI backend (separate repo)
The TraceEvent model includes a schema_version field for backward compatibility.
Current version: 1.0.0
MIT
See CONTRIBUTING.md (coming soon)
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
pydanticEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pydantic>=2.0.0 | runtime |
langchainEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langchain>=0.1.0 | runtime |
aiohttpEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | aiohttp>=3.9.0 | runtime |
richEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | rich>=13.0.0 | runtime |
pytestEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pytest>=7.4.0; extra == "dev" | runtime |
pytest-asyncioEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pytest-asyncio>=0.21.0; extra == "dev" | runtime |
pytest-mockEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | pytest-mock>=3.11.0; extra == "dev" | runtime |
blackEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | black>=23.0.0; extra == "dev" | runtime |
ruffEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | ruff>=0.1.0; extra == "dev" | runtime |
mypyEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | mypy>=1.5.0; extra == "dev" | runtime |
types-aiofilesEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | types-aiofiles>=23.0.0; extra == "dev" | runtime |
bdist_wheel · 22.1 KB · Python py3
sdist · 33.46 KB · Python source
Shared repository data · GitHub
Observed since 20 Oct, 22:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:65cee5c2777af440588483d06c3dccda42192e18cd95cb5730c8ad8d1a01dc8a