gate-sdk
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.
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sdkgate-0.1.1.tar.gz | 22.5 kB | Without provenance | Details for sdkgate-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sdkgate-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for sdkgate-0.1.1-py3-none-any.whl |
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
|
Security for sdkgate 0.1.1
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.