Skip to main content
Hexgate

Hexgate

Runtime authorization for AI agents. On every tool call, Hexgate decides whether this user, in this role, may run this tool with these arguments — allow, deny, or require approval. For OpenAI Agents, LangChain, Google ADK, Pydantic AI, or a native runtime.

Website · Docs
PyPI CI codecov Downloads License: MIT


Control what your agents do — not just what they say. Policy decisions streaming live from the PolicyEnforcer.

What is Hexgate?

Hexgate is two things that move together:

  • hexgate — the SDK. A Python runtime that gates every tool call through a typed Decision (allow / deny / approval-required), resolving the caller's role at call time to apply that role's rules. Wrap an existing agent without rewriting it, or build one natively — every decision is traced and audited with the caller's identity. See supported frameworks →
  • The Hexgate platform (optional) — a FastAPI control plane + React dashboard for editing policy in a browser, minting per-project tokens, watching live decisions stream from a serving agent, and shipping signed WASM policy bundles to production. Available as Hexgate Cloud (hosted — set one env var, no infra) or self-hosted.

You can use the SDK three ways: local (YAML/bundle on disk, no platform), Hexgate Cloud (remote enforcement + audit — just set HEXGATE_API_KEY), or self-hosted (run the control plane yourself). HEXGATE_API_URL defaults to https://app.hexgate.ai, so remote enforcement is one env var away.

End user and tool call merge into PolicyEnforcer.decide(), checked against policy on its right edge, resolving to allow, deny, or approval, always recorded to the audit log.

Quickstart

pip install hexgate

See it enforce — no API keys. Save a policy that gives two roles different limits on the same refund_order tool:

# policy.yaml
version: 1
roles:
  support:                                     # small USD refunds only
    default_policy: { mode: deny }
    tools:
      refund_order:
        mode: allow
        constraints:
          - args.amount <= 50
          - args.currency == "USD"
  billing:                                     # larger refunds, major currencies
    default_policy: { mode: deny }
    tools:
      refund_order:
        mode: allow
        constraints:
          - args.amount <= 500
          - args.currency in ["USD", "EUR"]

hexgate policy test decides the same $400 refund for each role offline — no model, no keys:

hexgate policy test policy.yaml --role support \
    --tool refund_order --args '{"amount": 400, "currency": "USD"}'
# ✗ DENY · support → refund_order({"amount": 400, "currency": "USD"})
#   reason: Policy on "refund_order" denied: constraint failed — args.amount <= 50

hexgate policy test policy.yaml --role billing \
    --tool refund_order --args '{"amount": 400, "currency": "USD"}'
# ✓ ALLOW · billing → refund_order({"amount": 400, "currency": "USD"})

Same tool, same request — the caller's role and the arguments decide, enforced outside the model. The full quickstart → puts this in front of a live agent.

Documentation

Full documentation lives at docs.hexgate.ai.

Build an agent Define tools directly with create_agent, or wrap an existing framework agent.
Framework adapters OpenAI Agents, LangChain/LangGraph, Google ADK, Pydantic AI.
Policy YAML shape, constraints, WASM bundles, signing, local override.
Caller context + roles Per-request identity, role resolution, biscuit attenuation via HexgateContext.
CLI chat, serve, register, policy.
MCP servers Wrap any Model Context Protocol server as policy-enforced tools.
Hexgate Cloud (hosted) Remote policy enforcement + audit with zero infra — get a key, set one env var.
Platform (self-hosted) Run the control plane, dashboard, ClickHouse audit, and Resend email yourself.

Development

Contributor setup, make targets, and the test suites are documented in Development & testing. The short version:

make install-dev     # uv sync --extra dev --extra evals (first time only)
make check           # lint + fmt-check + test (matches CI)

License

MIT — see LICENSE.


If Hexgate looks useful, give it a ⭐ on GitHub — it helps more than you'd think. Built by Hexamind.

Metadata

Release files for hexgate 0.3.3

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

Source distribution (sdist)

Source distribution for hexgate 0.3.3
File Size Uploaded
hexgate-0.3.3.tar.gz 426.3 kB Details

Built distribution (wheel)

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

Total release size: 928.5 kB

Release files / hexgate-0.3.3.tar.gz

Download URL hexgate-0.3.3.tar.gz
Size 426.3 kB
Tags Source
SHA-256 checksum
How to use checksums
06d7dbb6044c6e491f8d8739938e84b13e8cf0db5761c2a0475fb6b6075540db
BLAKE2b-256 checksum
How to use checksums
0cc56f9d78b0277d20568c924038be2bf9a369000eafcd287cd977b5758ca6d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

Release files / hexgate-0.3.3-py3-none-any.whl

Download URL hexgate-0.3.3-py3-none-any.whl
Size 502.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a06cce8900f581d89abf671a1f26d9b4fae127b6cb586549c934588ffd7c0796
BLAKE2b-256 checksum
How to use checksums
03b2b9f3fb6dd05ff8e8213f6c2492eaf83e72d72237252f6d750ce807da3150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.2

2 release files

0.1.1

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