Skip to main content

Brutor Agent Control — Runtime Hooks for Python (Enterprise)

Governed runtime hooks for agents that run outside the gateway.

Edition: Enterprise

What it is

Runtime hooks for Brutor Agent Control. Your agent calls tools, reads prompts and writes answers in its own process, out of the gateway's sight. With this package each of those steps is decided by the gateway, under the same grants, argument policies, data scope, run policies, guardrails and approvals as its own traffic. The decision travels as an Agent Hooks 0.1 interceptor call.

The package is a client of the Enterprise Edition gateway and is licensed under the Brutor Enterprise SDK Licence (see License below). You can install it and evaluate it against any gateway, including an Enterprise trial. Production use needs an Enterprise licence on the gateway.

Documentation: https://docs.brutor.ai/runtime-hooks/

Requirements

Python 3.11 or later (CI runs 3.11 to 3.15). Dependencies: brutor-agent-auth (>=0.2,<0.3) and httpx.

Install

pip install brutor-runtime-hooks                      # the interceptor and HookSession
pip install 'brutor-runtime-hooks[agent-framework]'   # Microsoft Agent Framework
pip install 'brutor-runtime-hooks[claude-agent-sdk]'  # Claude Agent SDK (Python)
pip install 'brutor-runtime-hooks[openai-agents]'     # OpenAI Agents SDK
pip install 'brutor-runtime-hooks[langgraph]'         # LangGraph
pip install 'brutor-runtime-hooks[bundle]'            # the local bundle cache

The agent authenticates with brutor-agent-auth (a dependency): a short-lived workload token from the platform it runs on, so no secret is stored in the agent.

Quick start

from brutor.runtime_hooks import BrutorApprovalResolver, BrutorInterceptor, HookSession

interceptor = BrutorInterceptor()  # BRUTOR_GATEWAY_URL; credential from brutor.auth.WorkloadAuth()
resolver = BrutorApprovalResolver(interceptor)

async with HookSession(
    interceptor, agent_id="loan-screening", framework="langgraph", tools=["write_file"], resolver=resolver
) as hooks:
    pre = await hooks.pre_tool_call("call_1", "write_file", {"path": "/letters/APP-1042.md"})
    if pre.proceeds:  # pre.target: the arguments as allowed, or as the gateway transformed them
        result = write_file(**pre.target)
        await hooks.post_tool_call("call_1", "write_file", pre.target, result)

Each step returns a HookOutcome (verdict, proceeds, target, transformed): act only when proceeds, and always with target, which is the redacted or rewritten value after a transform.

Turn runtime hooks on for the AI System first (Admin Console, the AI System's Runtime hooks tab): observe shows what enforce would decide and blocks nothing; enforce applies the decisions.

  • Microsoft Agent Framework: middleware=[brutor_middleware(interceptor)] from brutor.runtime_hooks.adapters.agent_framework. The framework is the Agent Hooks host for all eight interception points.
  • Claude Agent SDK: async with BrutorClaudeSession(interceptor, options, agent_id=...) as client: from brutor.runtime_hooks.adapters.claude_agent_sdk. It covers prompts, tool calls and answers; model calls are governed by pointing the SDK at the gateway.
  • OpenAI Agents SDK: await BrutorRunner(interceptor).run(agent, prompt) from brutor.runtime_hooks.adapters.openai_agents, in place of Runner.run. Brutor's guardrails are added to copies of your agents; tools the SDK's guardrails cannot see (hosted tools, built-in execution tools, agents used as tools) are refused unless you name them in allow_uncovered.
  • LangGraph: brutor_tool_node(tools, interceptor) in place of ToolNode(tools), and await governed_invoke(graph, inputs, config, interceptor, agent_id=...) to run the graph. A hold interrupts the graph; resuming it re-evaluates the same decision with the approval. Add BrutorState to a checkpointed graph's state so the session survives checkpoints.

The local bundle cache

BrutorInterceptor(bundle=True) evaluates Brutor's stateless tool rules in the agent's process (the agent's export, fetched after agent_startup). A definite local deny is answered at once and still recorded by the gateway; everything else, a local allow included, is decided by the gateway. It is off by default.

An agent reached as a delegate

An agent that another agent calls through the gateway receives the delegation in x-brutor-delegation-* headers. Start its session with them, and send the run handle (never the delegation headers) on its own gateway calls:

from brutor.runtime_hooks import HookSession, delegation_from_headers

async with HookSession(
    interceptor, agent_id="fraud-screener", framework="custom", delegation=delegation_from_headers(request.headers)
) as hooks:
    headers = hooks.outbound_headers({"Content-Type": "application/json"})  # X-Brutor-Run-Id

The adapters take the same delegation= argument.

Failing closed

When the gateway gives no usable decision (an error, a timeout, an answer that is not a valid verdict), BrutorInterceptor raises DecisionUnavailable and the host denies the step. HookSession and the adapters do this for you. The SDK never logs a credential, a run handle, an approval token or the content of a step. Content that the gateway's checks do not read is replaced by its hash before it is sent.

Development

From sdk/enterprise/python/brutor-runtime-hooks in the Brutor Agent Control repository (tools pinned in requirements-dev.txt). The sdk-enterprise.yml workflow runs these gates:

python -m pip install -r requirements-dev.txt -e ../../../python/brutor-agent-auth -e '.[agent-framework,claude-agent-sdk,openai-agents,langgraph,bundle]'
ruff check . && ruff format --check .
mypy --strict src
python scripts/env_registry.py --check
python -m pytest        # fails below 95% coverage

Documentation

https://docs.brutor.ai/runtime-hooks/

Security

See SECURITY.md at the repository root.

License

Proprietary: the Brutor Enterprise SDK Licence (see LICENSE). It is not an open-source license.

Metadata

Release files for brutor-runtime-hooks 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brutor-runtime-hooks 0.2.0
File Size Uploaded Provenance Actions
brutor_runtime_hooks-0.2.0.tar.gz 53.7 kB With provenance Details for brutor_runtime_hooks-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for brutor-runtime-hooks 0.2.0
File Interpreter ABI Platform Actions
brutor_runtime_hooks-0.2.0-py3-none-any.whl Python 3 none any Details for brutor_runtime_hooks-0.2.0-py3-none-any.whl

Total release size: 121.0 kB

Release files / brutor_runtime_hooks-0.2.0.tar.gz

Download URL brutor_runtime_hooks-0.2.0.tar.gz
Size 53.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab26fca93768576f57b5f09b44fb1f2438b2f5e08928cdcc2b78794fa514c610
BLAKE2b-256 checksum
How to use checksums
122e52a7f7a6d236d888c6e6407f54d78859b6785d59fa56808a3412c023427e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / brutor_runtime_hooks-0.2.0-py3-none-any.whl

Download URL brutor_runtime_hooks-0.2.0-py3-none-any.whl
Size 67.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dffd2e179913c8536216b4f876022cf1eb05d803854bda7271966aaa16ef353
BLAKE2b-256 checksum
How to use checksums
8fcbb25c48cab0b0dd6042c5c291da0a8f7a256dc5b46ecb9fd3c41267d20dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for brutor-runtime-hooks 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for brutor_runtime_hooks-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page