Skip to main content

Customer SDK for the Hawcx Agent Authentication Protocol (HAAP). Connects to a customer-deployed haap-supervisor and proxies tool calls through the Assembler per CS v7.2.5 Profile E.

Project description

hawcx-haap

Customer SDK for the Hawcx Agent Authentication Protocol (HAAP Canonical Specification v7.2.0, Profile E). Pure-Python, no native build.

Status: alpha (0.1.0a1). Public API may change. End-to-end testing against the real binary pipeline is pending alpha-2 closure of the RSV cascade adapter; the SDK is currently validated against a mock Assembler.

What it does

HawcxAgent connects to a customer-deployed haap-supervisor's Assembler-agent socket and proxies Profile E tool calls. The supervisor and its child processes are installed separately (via the hx_agentic_sdk release tarball or Docker image); this SDK is just the language-side client.

Per CS §39, all cryptographic operations happen in the Assembler / TQS / Authenticator processes. The Python process never holds session keys or token material — process isolation is enforced by OS boundaries (Unix Domain Sockets on Linux/macOS, Named Pipes with DACL on Windows per CS §39.12).

Install

pip install hawcx-haap

Single pure-Python wheel; supports Python 3.10–3.13 on Linux, macOS, and Windows.

Prerequisites

  • The haap-supervisor pipeline (Authenticator + TQS-precompute + TQS-jit + Assembler + External Identity Broker + Supervisor — per HAAP CS v7.2.0 §45.2) must be running locally, installed from the hx_agentic_sdk release.
  • The agent identity must be pre-provisioned via the Hawcx Admin Console (Console → CAA → Authenticator flow per CS §4.6.3).

Quickstart

from hawcx_haap import HawcxAgent

with HawcxAgent.connect("/var/run/haap/research-u1/agent-assembler-0.sock") as agent:
    response = agent.invoke(
        target_rs_url="https://api.example.com/search",
        http_method="POST",
        headers={"Content-Type": "application/json"},
        tool="search",
        action=["read"],
        body=b'{"query": "agents"}',
    )
    print(response.http_status, response.body[:200])

If you want the SDK to derive the socket path from an agent id:

with HawcxAgent.connect_by_agent_id("research-u1") as agent:
    ...

This uses the conventional path {XDG_RUNTIME_DIR or /tmp}/hawcx/{agent_id}/agent-assembler-0.sock on Unix and \\.\pipe\haap-{agent_id}-agent-assembler-0 on Windows.

API

HawcxAgent.connect(endpoint, *, timeout_secs=5.0) -> HawcxAgent

Open the agent IPC socket at endpoint and complete the version handshake.

HawcxAgent.connect_by_agent_id(agent_id, *, index=0, ipc_dir=None, timeout_secs=5.0)

Resolve the conventional path, then connect.

.invoke(...) -> ToolCallResponse

Argument Type Notes
target_rs_url str RS endpoint URL (required)
http_method str Default "POST"
headers dict[str, str] | None Extra HTTP headers
tool str Tool / endpoint identifier
action Iterable[str] | None Permitted operations (CS §39.7)
resource str Default "*"
constraints dict | None TBAC constraints
body bytes | None Request body (maps to plaintext_request_body)
claimed_intent_hash str | None For §39.4 intent verification
tool_arguments Any Structured arguments
content_type str | None Request content type
transport TokenTransport | None HTTP_HEADER (default) or MCP_META
request_id str | None Defaults to req-<uuid4-hex16>

Returns ToolCallResponse(request_id, http_status, headers, body). The body field is the decrypted RS response (bytes).

Raises RequestRejected(request_id, reason) if the Assembler rejects.

TokenTransport

class TokenTransport(str, Enum):
    HTTP_HEADER = "http_header"   # Authorization: HAAP <b64>
    MCP_META = "mcp_meta"         # MCP params._meta["haap/tbac"].token

Per CS v7.2.0 §34. Default per-call selector is omitted on the wire → the Assembler uses HttpHeader.

Wire protocol

The SDK speaks the same wire as the in-process Rust crates:

[msg_len: u32 BE][msg_type: u8][payload: msg_len-1 bytes]
  • 0x00IpcHandshake (binary; see crates/haap-ipc/src/handshake.rs)
  • 0x52ToolCallRequest (JSON)
  • 0x53ToolCallResponse (JSON; body is base64)
  • 0x54RequestRejected (JSON: {request_id, reason})
  • 0x61ClarificationAnswer (JSON; Profile E first hop)

Reference: crates/haap-ipc/src/messages/assembler.rs in hx_labs.

Threat model — runtime principal

HawcxAgent supports per-call principal switching via the acting_for_user field, which the Assembler projects into scope_json.user_principal_id on the minted token (CS v6.9.0 line 163). This lets one supervisor pipeline serve multiple end-users without re-enrolling the agent identity per user.

acting_for_user is sensitive: a value that came from an LLM (or any input the model can influence) MUST NOT be allowed to silently switch the effective user. As of 0.1.0a2 (H-3 hardening 2026-05-20):

  • HawcxAgent.connect(endpoint, principal_allowlist=[...]) is required. The allowlist is a closed set of permitted principal IDs sourced from operator config.
  • agent.invoke(acting_for_user=...) and agent.invoke_for(...) validate against the allowlist before any IPC bytes are written. Out-of-list principals raise HawcxError synchronously with a redacted SHA-256 fingerprint instead of echoing the rejected principal back in plaintext.
  • Pass principal_allowlist=[] to forbid runtime principal switching entirely.

Operator obligations:

  1. Source the allowlist from operator-controlled config — never derive from LLM output, request bodies, MCP tool arguments, or any input a model can influence.
  2. If the principal axis spans more than ~100 users, fan out to per-user agents rather than one agent with a wide allowlist; the Cedar policy on the gateway should still gate per-user access, but reducing the SDK-side allowlist closes the blast radius of a compromised supervisor.
  3. The previous code that accepted acting_for_user from any caller (without an allowlist) is deprecated. See ../CHANGELOG.md for the migration recipe.

Limitations / known gaps

  • End-to-end verification against real binaries is pending alpha-2 closure of the RSV cascade adapter. Tests use a mock Assembler over a Unix socket.
  • Framework adapters (CrewAI BaseTool, LangChain Tool) are deferred to a Priority 2a follow-up.
  • Windows Named Pipe support uses ctypes against kernel32; pytest fixtures exercise the Unix path only. Windows is exercised via unit tests of the framing layer.

License

Hawcx Proprietary License. See LICENSE.

Project details


Download files

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

Source Distribution

hawcx_haap-0.1.1.tar.gz (34.2 kB view details)

Uploaded Source

Built Distributions

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

hawcx_haap-0.1.1-py3-none-win_arm64.whl (8.4 MB view details)

Uploaded Python 3Windows ARM64

hawcx_haap-0.1.1-py3-none-win_amd64.whl (8.9 MB view details)

Uploaded Python 3Windows x86-64

hawcx_haap-0.1.1-py3-none-manylinux2014_x86_64.whl (11.5 MB view details)

Uploaded Python 3

hawcx_haap-0.1.1-py3-none-manylinux2014_aarch64.whl (11.2 MB view details)

Uploaded Python 3

hawcx_haap-0.1.1-py3-none-macosx_11_0_arm64.whl (10.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file hawcx_haap-0.1.1.tar.gz.

File metadata

  • Download URL: hawcx_haap-0.1.1.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for hawcx_haap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b42e8427125bc382f0819f51ace3eb0596478bf610f5c3404e8a7dce53a03c9b
MD5 d751095e42842a099dad67c5996165ca
BLAKE2b-256 f91d5eca5a8cd02e9afb9a002dc044d09058d2607e39d9d643d806ec676f3857

See more details on using hashes here.

Provenance

The following attestation bundles were made for hawcx_haap-0.1.1.tar.gz:

Publisher: release-python.yml on hawcx/hawcx_agentic_sdk

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

File details

Details for the file hawcx_haap-0.1.1-py3-none-win_arm64.whl.

File metadata

  • Download URL: hawcx_haap-0.1.1-py3-none-win_arm64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for hawcx_haap-0.1.1-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 aab5a4bda47b7ffcdff07543f3b327afa94fccc742dbea210c16e5b7ae9f5e2f
MD5 5487005c6e286fffb6f56e096b11da80
BLAKE2b-256 8b0ace4f80ac921dbe833a07cac9446d34985fb1ee8c648add260801ccf16af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hawcx_haap-0.1.1-py3-none-win_arm64.whl:

Publisher: release-python.yml on hawcx/hawcx_agentic_sdk

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

File details

Details for the file hawcx_haap-0.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: hawcx_haap-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for hawcx_haap-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0d6c04b08b9f712396d703acd3ba9482bf4457ce4de820f313e673076227f250
MD5 b4bcd98b1d8a6e85939d13f39d4720ce
BLAKE2b-256 039c00eda6ec9c01740d6144857420c1f0e1f2606e7f367a2802f7ab06d771da

See more details on using hashes here.

Provenance

The following attestation bundles were made for hawcx_haap-0.1.1-py3-none-win_amd64.whl:

Publisher: release-python.yml on hawcx/hawcx_agentic_sdk

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

File details

Details for the file hawcx_haap-0.1.1-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hawcx_haap-0.1.1-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b5d1f938b1a05510b12a103dc6a13eb6316bb331a1b443906807815710332119
MD5 33c9412b21a94bdc57f85a2fe0746308
BLAKE2b-256 2ffcb6d58d8997ec81ec339b7a9d5ff603ec08c277fc96965ba55f543f9497bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for hawcx_haap-0.1.1-py3-none-manylinux2014_x86_64.whl:

Publisher: release-python.yml on hawcx/hawcx_agentic_sdk

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

File details

Details for the file hawcx_haap-0.1.1-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hawcx_haap-0.1.1-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc9e380970c5e26597f24422a0614fb05343f06062b4040f7d767df479f0738f
MD5 21a10c293af21b4b88a76ec7e90184e3
BLAKE2b-256 c2db3026afe0780f0bcade6cbf6fcfd67152f92107d3a90592d7d05f432d5ebb

See more details on using hashes here.

Provenance

The following attestation bundles were made for hawcx_haap-0.1.1-py3-none-manylinux2014_aarch64.whl:

Publisher: release-python.yml on hawcx/hawcx_agentic_sdk

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

File details

Details for the file hawcx_haap-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hawcx_haap-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20628bd7075ac38d0f030a634955642b56d9b56d986782841dc44bad26ec2a55
MD5 757e6a29e685a7f76b51cc32262f6651
BLAKE2b-256 aebbe618e930e92535fe50b67ddc353cd73ec2b8d136a7dd129c110e79a79f0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hawcx_haap-0.1.1-py3-none-macosx_11_0_arm64.whl:

Publisher: release-python.yml on hawcx/hawcx_agentic_sdk

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