Nomotic governance for AI agents. Works with Claude, LangChain, CrewAI, AutoGen, OpenAI, or any custom framework.
Project description
managed-agents
Nomotic governance for AI agents. Works with any framework.
Govern every tool call before it reaches execution. DENY verdicts block the action. ESCALATE routes to human review. Every evaluation is recorded in your Nomotic audit trail.
Install
pip install managed-agents
Quick Start
from managed_agents import NomoticHarness, GovernanceDenied
harness = NomoticHarness(
api_key="nm_live_...", # from amp.nomotic.ai/settings
agent_id="nmc-...", # from amp.nomotic.ai/identity
platform="langchain", # tags evaluations in your audit trail
)
async def execute_tool(tool_name: str, tool_input: dict) -> str:
await harness.govern(tool_name, tool_input)
return await your_runtime.execute(tool_name, tool_input)
try:
await execute_tool("write_file", {"path": "/etc/passwd", "content": "..."})
except GovernanceDenied as e:
print(f"Blocked: {e}")
With Prescreening
Block destructive patterns before they reach the governance API:
from managed_agents import NomoticHarness, StandardPrescreener
harness = NomoticHarness(
api_key="nm_live_...",
agent_id="nmc-...",
prescreener=StandardPrescreener(
block_destructive_shell=True, # rm -rf, DROP TABLE, mkfs, fork bombs
block_bulk_operations=True, # >10 emails, >20 files, >5 calendar items
escalate_credential_access=True, # .ssh/, .env, /etc/passwd
),
)
With Policy Presets
from managed_agents import NomoticHarness, ToolPolicy
harness = NomoticHarness(
api_key="nm_live_...",
agent_id="nmc-...",
policy=ToolPolicy.SHELL, # trust_threshold=0.85, veto: scope+ethics
# policy=ToolPolicy.FILESYSTEM # trust_threshold=0.75, veto: reversibility
# policy=ToolPolicy.EMAIL # trust_threshold=0.70, veto: data_sensitivity
)
Sync Usage
result = harness.govern_sync("bash", {"command": "ls -la"})
Without an API Key
No api_key → pass-through mode. Prescreener still blocks dangerous patterns. Verdicts logged locally to ~/.nomotic/managed-agents.log.
After 10 evaluations, a nudge suggests registering at amp.nomotic.ai for full governance, audit trail, trust scores, and fleet management.
harness = NomoticHarness(agent_id="local-agent") # no api_key
Framework Support
platform="claude" # Claude Managed Agents
platform="langchain" # LangChain / LangGraph
platform="crewai" # CrewAI
platform="autogen" # AutoGen
platform="openai" # OpenAI SDK / Assistants API
platform="custom" # Any other framework
Session Correlation
from managed_agents import NomoticHarness, GovernedSession
harness = NomoticHarness(api_key="...", agent_id="...")
session = GovernedSession(session_id="sess_abc123", harness=harness)
verdict = await session.govern_and_record("send_email", {"to": "user@example.com"})
print(session.governance_summary())
Configuration
| Parameter | Default | Description |
|---|---|---|
| api_key | None | Nomotic API key. None = pass-through mode |
| agent_id | required | Nomotic agent ID (nmc-...) |
| platform | "custom" | Framework tag for audit trail |
| fail_open | True | Allow on governance service error |
| block_on_escalate | False | Raise GovernanceEscalated on ESCALATE |
| timeout | 3.0 | HTTP timeout in seconds |
| prescreener | None | Pre-evaluation deterministic checks |
| policy | None | Governance policy preset |
| tool_name_map | None | Custom tool name → action verb overrides |
| circuit_breaker | None | CircuitBreaker for API resilience |
| local_log | True | Log verdicts to ~/.nomotic/managed-agents.log |
| suppress_nudge | False | Suppress amp.nomotic.ai registration nudge |
| on_verdict | None | Callback for every verdict |
| on_escalate | None | Callback for ESCALATE verdicts |
| on_deny | None | Callback for DENY verdicts |
| session_id | None | Session ID for multi-turn correlation |
| org_context | {} | Additional context injected into evaluations |
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file managed_agents-0.2.0.tar.gz.
File metadata
- Download URL: managed_agents-0.2.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c51cca0fcbec15d7163e2041a37fb9bc41a233b91f248ab2f2cacb1bc5d10daa
|
|
| MD5 |
812d6ec0fe770b594450bf54595247ed
|
|
| BLAKE2b-256 |
87ae064fe4aaf8922a78b9f7d052f74033b87ca5bde982d30f35502f131f027e
|
File details
Details for the file managed_agents-0.2.0-py3-none-any.whl.
File metadata
- Download URL: managed_agents-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d911d5fcf146343b42b8fcc165b7e3ff228041286aaf5420642fa93f82e134d0
|
|
| MD5 |
8f6cd255f631a13e1503a95d4d873979
|
|
| BLAKE2b-256 |
c2eab69133bc99bc145b68ecf4ee9f37c3d4a6ba8cdcde0f754e9b1c4035c37d
|