Skip to main content

hallpass-client

The Python client for hallpass: before your AI agent acts for a user, ask the system that owns the resource whether that user may do it.

pip install hallpass-client

It is on PyPI, and every hallpass release also carries it as a download. Its version matches the hallpass release, so pin the one you run, e.g. hallpass-client==0.4.0.

It needs a running hallpass service. The client has no dependencies beyond the standard library.

from contextvars import ContextVar
from hallpass_client import Hallpass, guarded

hp = Hallpass()  # HALLPASS_URL and HALLPASS_API_KEY from the environment
current_user: ContextVar[str] = ContextVar("current_user")

@tool  # LangChain, Strands, MCP, the Claude Agent SDK...
@guarded(hp, "jira-main", "DELETE_ISSUES", "issue:{key}", user=current_user, fresh=True)
def delete_issue(key: str) -> str:
    jira.delete_issue(key)  # the agent's own credential, only after hallpass said allow
    return f"deleted {key}"

current_user.set(request.user.email)  # from your auth, per request or session
  • The model never picks the user. It comes from user=: a string, a zero-argument callable, or a ContextVar your application sets. A user key in the tool's arguments is ignored.
  • It fails closed. deny, unknown and hallpass being unreachable all raise PermissionDenied before the body runs. Pass deny= to return a message to the model instead.
  • One package covers every framework. guarded handles plain functions, async def, and the Claude Agent SDK's async def f(args: dict) handler shape.

For Strands Agents, pip install "hallpass-client[strands]" adds an intervention handler that checks every tool call with a rule, with the user from invocation_state:

from hallpass_client.strands import HallpassAuthorization

hallpass = HallpassAuthorization(hp, {"delete_issue": ("jira-main", "DELETE_ISSUES", "issue:{key}")})
agent = Agent(tools=tools, interventions=[hallpass])
agent(prompt, invocation_state={"user_id": request.user.email})

Without a decorator:

d = hp.check("dana@example.com", "jira-main", "DELETE_ISSUES", "issue:PAY-123")
d.decision, d.reason        # "deny", "denied: ..."
hp.require(...)             # raises PermissionDenied unless allow

Framework examples: examples/agent. The guide: docs/guides/agent-tools.md.

Release files for hallpass-client 0.5.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 hallpass-client 0.5.0
File Size Uploaded
hallpass_client-0.5.0.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hallpass-client 0.5.0
File Interpreter ABI Platform
hallpass_client-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.8 kB

Release files / hallpass_client-0.5.0.tar.gz

Download URL hallpass_client-0.5.0.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8884a94c2a4784f29c5a20b6312d74cce5525a2f97cb0411af76004676e632b8
BLAKE2b-256 checksum
How to use checksums
53d35c775aac057e1cbc79d9a723aa8b20076eebb6e4ad89dee50f39ca564379
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 Sep 26, 2026.

Transparency log

Release files / hallpass_client-0.5.0-py3-none-any.whl

Download URL hallpass_client-0.5.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5d250168037d146d6e29cfe8b9e9cab8b4a5338e0cba542375dd593d23222d8
BLAKE2b-256 checksum
How to use checksums
faca4c9947ae1bb7f7170bde3f8f4711d178544ad273a005f334cef87cfcd7f1
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 Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

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