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 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 (id + role)          tool call (name + args)
            └───────────────┬────────────────┘
                            ▼
              PolicyEnforcer.decide()  ◄──  policy (local YAML / bundle
                            ▼                or signed cloud bundle)
            allow  ·  deny  ·  approval
                            │
                            ▼
      audit log — who called what, and whether it was allowed

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 The two shapes — wrap an existing agent, or let the platform own the YAML.
Framework adapters OpenAI Agents, LangChain/LangGraph, Google ADK, Pydantic AI.
Policy YAML shape, constraints, WASM bundles, signing, local override.
User scope + roles Per-request identity, role resolution, biscuit attenuation.
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 (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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexgate-0.2.10.tar.gz (192.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hexgate-0.2.10-py3-none-any.whl (236.9 kB view details)

Uploaded Python 3

File details

Details for the file hexgate-0.2.10.tar.gz.

File metadata

  • Download URL: hexgate-0.2.10.tar.gz
  • Upload date:
  • Size: 192.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hexgate-0.2.10.tar.gz
Algorithm Hash digest
SHA256 8d3a655f02d41d8d2e282e821be000c9a78600804c77a14e3d5b2bf703a23040
MD5 836c78eb6a81aaaf03a2e144bd883252
BLAKE2b-256 721150ad766954bf319efe48253ecc131d509f60358ae2c628409c098e6790f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexgate-0.2.10.tar.gz:

Publisher: release.yml on HexamindOrganisation/hexgate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hexgate-0.2.10-py3-none-any.whl.

File metadata

  • Download URL: hexgate-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 236.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hexgate-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 9f24c05d8dc6e6b8e7137a0b49751a73c1ef69f7b6730b1a47fcdc54d6a67ff1
MD5 baef78dcaeda6101b702a5de00221a6b
BLAKE2b-256 51390d27caf8e55ad6cbce9f23be943249e7ab5c525616dabe8b5eef84b0857c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexgate-0.2.10-py3-none-any.whl:

Publisher: release.yml on HexamindOrganisation/hexgate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page