Skip to main content

gate-sdk

status tests license

Developer SDK for Gatekeeper — tool access control for AI agents.

GateClient is the thing you import. Register tools with execution classes, set a mode (or wire a signal source), call filter() before every agent turn, and the visible manifest shrinks as threat rises. Ships adapters for OpenAI and Anthropic tool formats.

Install

pip install gate-sdk  # once published
# or from source:
pip install -e .[dev]

# framework extras:
pip install gate-sdk[openai]
pip install gate-sdk[anthropic]

Quick example

from gate_sdk import GateClient

client = GateClient(mode=0.0)
client.add_tool("read_file", "read_only")
client.add_tool("deploy",    "high_impact")

result = client.filter()
# mode 0.0 -> both visible

client.mode = 0.85
result = client.filter()
# -> visible=['read_file'], suppressed=['deploy']

Framework adapters

from gate_sdk.adapters.openai import from_openai_tools, to_openai_tools

gate_tools = from_openai_tools(openai_schema, class_map={"deploy": "high_impact"})
client = GateClient(mode=current_threat_level)
client.add_tools(gate_tools)
safe_openai_tools = to_openai_tools(client.filter().visible)

Anthropic adapter mirrors the same API (from_anthropic_tools / to_anthropic_tools).

Mode sources

Pull mode from env, files, callables, or custom signals:

from gate_sdk.signals import StaticSignal, EnvSignal

client = GateClient(mode_source=EnvSignal("GATE_MODE"))
# GATE_MODE=0.8 python agent.py

Middleware and callbacks

client.use(lambda mode, result: log_filter(mode, result) or result)
client.on_suppress(lambda tool, mode: alert(f"{tool.name} suppressed at {mode}"))
client.on_mode_change(lambda old, new: audit_mode_change(old, new))

Envelope signing

env = client.authorize("read_file", signing_key="hmac-key", context_id="sess1")
# env.signature is HMAC-SHA256 over canonical form
assert client.verify(env, "hmac-key")

authorize() raises ValueError on suppressed tools — you can't sign what the gate has hidden.

Export back to framework tools

client.export_openai()     # only visible tools, ready for client.chat.completions
client.export_anthropic()  # only visible tools, ready for messages.create

Tests

pytest tests/

48 tests across client, adapters, signals, middleware, envelope flows, and failure injection.

How it fits

Layer 1 (transport) in Gatekeeper. Depends on gate-keeper (Layer 0). Feeds gate-policy (Layer 2) and gate-compliance (Layer 2) via middleware hooks.

License

Apache-2.0.

Release files for sdkgate 0.1.1

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

Source distribution (sdist)

Source distribution for sdkgate 0.1.1
File Size Uploaded
sdkgate-0.1.1.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sdkgate 0.1.1
File Interpreter ABI Platform
sdkgate-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.2 kB

Release files / sdkgate-0.1.1.tar.gz

Download URL sdkgate-0.1.1.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04b7892a4f8f67c1fa50302fd2daaa9030c5375eadade5e72fb5ac9dc49e56c0
BLAKE2b-256 checksum
How to use checksums
df2ee5bed29750d82ad311a0e13c6551bb84c88faa6f3dd62dad2822d3511bc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / sdkgate-0.1.1-py3-none-any.whl

Download URL sdkgate-0.1.1-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a19db48678a8cb1ae8c4de9934763f874e9151c5115405e931ce40ef5524918
BLAKE2b-256 checksum
How to use checksums
bd870cacdc0a8be97870ebc6d71e988cef4e2def764ed625f07e6679cf14b399
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

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