Metadata-Version: 2.4
Name: hexr-sdk
Version: 0.5.23
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: System :: Distributed Computing
Requires-Dist: psutil>=5.9.0,<6.0.0
Requires-Dist: pydantic>=2.5.0,<3.0.0
Requires-Dist: spiffe>=0.3.1,<1.0.0
Requires-Dist: cryptography>=50.0.1
Requires-Dist: pyjwt>=2.13.0
Requires-Dist: pyasn1>=0.6.4
Requires-Dist: idna>=3.19
Requires-Dist: protobuf>=6.31.1,<7.0.0
Requires-Dist: requests>=2.31.0,<3.0.0
Requires-Dist: redis[hiredis]>=5.0.0,<6.0.0
Requires-Dist: httpx>=0.25.0,<1.0.0
Requires-Dist: pyyaml>=6.0.0,<7.0.0
Requires-Dist: structlog>=23.2.0,<24.0.0
Requires-Dist: hexr-sdk[aws,gcp,azure,observability,cli] ; extra == 'all'
Requires-Dist: pip-audit>=2.7.0,<3.0.0 ; extra == 'audit'
Requires-Dist: cyclonedx-bom>=4.0.0,<8.0.0 ; extra == 'audit'
Requires-Dist: reportlab>=4.0.0,<6.0.0 ; extra == 'audit-pack'
Requires-Dist: psycopg2-binary>=2.9.0,<3.0.0 ; extra == 'audit-pack'
Requires-Dist: boto3>=1.34.0,<2.0.0 ; extra == 'aws'
Requires-Dist: azure-identity>=1.15.0,<2.0.0 ; extra == 'azure'
Requires-Dist: click>=8.1.0,<9.0.0 ; extra == 'cli'
Requires-Dist: rich>=13.0.0,<16.0.0 ; extra == 'cli'
Requires-Dist: hexr-sdk[all] ; extra == 'dev'
Requires-Dist: pytest>=7.4.0 ; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0 ; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0 ; extra == 'dev'
Requires-Dist: pytest-mock>=3.12.0 ; extra == 'dev'
Requires-Dist: black>=23.9.0 ; extra == 'dev'
Requires-Dist: ruff>=0.1.0 ; extra == 'dev'
Requires-Dist: mypy>=1.7.0 ; extra == 'dev'
Requires-Dist: pre-commit>=3.5.0 ; extra == 'dev'
Requires-Dist: onnxruntime>=1.20,<2.0 ; extra == 'enterprise'
Requires-Dist: hexr-sdk-models>=0.1.0,<1.0 ; extra == 'enterprise'
Requires-Dist: crewai>=0.28.0 ; extra == 'frameworks'
Requires-Dist: langchain>=0.1.0 ; extra == 'frameworks'
Requires-Dist: pyautogen>=0.2.0 ; extra == 'frameworks'
Requires-Dist: google-cloud-core>=2.4.0,<3.0.0 ; extra == 'gcp'
Requires-Dist: google-auth>=2.23.0,<3.0.0 ; extra == 'gcp'
Requires-Dist: opentelemetry-api>=1.41.0,<2.0.0 ; extra == 'observability'
Requires-Dist: opentelemetry-sdk>=1.41.0,<2.0.0 ; extra == 'observability'
Requires-Dist: opentelemetry-propagator-b3>=1.41.0,<2.0.0 ; extra == 'observability'
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.41.0,<2.0.0 ; extra == 'observability'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.41.0,<2.0.0 ; extra == 'observability'
Requires-Dist: sigstore>=4.5.0,<5.0.0 ; extra == 'ops'
Requires-Dist: bandit>=1.7.5 ; extra == 'security'
Requires-Dist: safety>=2.3.0 ; extra == 'security'
Requires-Dist: semgrep>=1.45.0 ; extra == 'security'
Requires-Dist: pytest>=8.0.0 ; extra == 'test'
Requires-Dist: pytest-asyncio>=1.0.0 ; extra == 'test'
Requires-Dist: pytest-httpx>=0.35.0 ; extra == 'test'
Requires-Dist: pytest-mock>=3.14.0 ; extra == 'test'
Requires-Dist: boto3>=1.34.0,<2.0.0 ; extra == 'test'
Provides-Extra: all
Provides-Extra: audit
Provides-Extra: audit-pack
Provides-Extra: aws
Provides-Extra: azure
Provides-Extra: cli
Provides-Extra: dev
Provides-Extra: enterprise
Provides-Extra: frameworks
Provides-Extra: gcp
Provides-Extra: observability
Provides-Extra: ops
Provides-Extra: security
Provides-Extra: test
License-File: LICENSE
Summary: Per-process identity, signed evidence and short-lived cloud credentials for AI agents, in your own cluster
Keywords: ai,agents,spiffe,identity,evidence,audit,soc2,hipaa,zero-trust,crewai,langchain,langgraph,autogen
Author-email: Hexr Team <sdk@hexr.dev>
Maintainer-email: Hexr Team <sdk@hexr.dev>
License: Proprietary - Source Available
Requires-Python: >=3.11, <3.14
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/hexrdev/hexr/blob/main/sdk/python/CHANGELOG.md
Project-URL: Documentation, https://docs.hexr.dev/sdk/overview
Project-URL: Homepage, https://github.com/hexrdev/hexr
Project-URL: Issues, https://github.com/hexrdev/hexr/issues
Project-URL: Repository, https://github.com/hexrdev/hexr

# hexr-sdk

**Per-process identity, signed evidence, and short-lived cloud credentials for AI agents — in your own cluster.**

Hexr gives every agent process its own cryptographic identity, records every model call and tool call as a signed evidence row that stays in your environment, and exchanges that identity for short-lived cloud credentials so agents carry no keys. Auditors get a report mapped to the controls they already use.

- Docs: <https://docs.hexr.dev> · Demo on real data: <https://demo.hexr.dev> · Site: <https://hexr.dev>
- Licence: proprietary, source-available. Read every line; do not redistribute. See `LICENSE`.

## Install

```bash
pip install hexr-sdk
```

Python 3.11+. Linux wheels for x86_64 and aarch64 ship a native analyzer (Rust, via PyO3); other platforms build from the sdist. Enterprise mirrors: the same wheels are published to a private index for air-gapped installs — ask us.

## The whole user-facing surface

Three symbols and one config object. Nothing is monkey-patched; you mark what you want governed.

```python
from hexr import hexr_agent, hexr_tool, hexr_llm, HexrConfig
from openai import OpenAI

@hexr_agent(name="resume-ranker", tenant="globex")
def rank(applications):
    llm = hexr_llm(OpenAI())                 # every call becomes signed evidence
    store = hexr_tool("gcp_storage")         # the real google-cloud client, short-lived creds, no key
    ...
```

| Symbol | What it does |
|---|---|
| `@hexr_agent` | Registers **this process** with the identity plane and gives it a SPIFFE ID of its own. Child processes get their own; a process nobody decorated gets nothing — and that absence is a finding. |
| `hexr_llm(client)` | Wraps an OpenAI, Anthropic, Google GenAI, Cohere, Mistral or LiteLLM client. Intercepts the known call paths, emits a signed evidence row per call, keeps streaming intact. Your business logic is never touched. |
| `hexr_tool(service)` | Exchanges the process's identity for short-lived credentials and returns the native client. AWS (`aws_s3`, `aws_sts`, `aws_kms`, `aws_dynamodb`) and GCP (`gcp_storage`, `gcp_bigquery`) today. Every call — allowed or denied — is a signed row mapped to a control (SOC 2 CC6.1, HIPAA 164.312). |
| `HexrConfig` | Optional; otherwise read from environment or `hexr.yaml`. |

## The CLI

```
hexr init          tenant bootstrap, writes hexr.yaml
hexr analyze       read-only: framework, agentic pattern, spawn graph, where identity will attach
hexr build         container image + Kubernetes manifests (agent, PID mapper, Envoy mTLS sidecar, policy, RBAC)
hexr push          to your registry
hexr deploy        to your cluster
hexr delete        tear an agent down cleanly
hexr audit         signed audit pack — --framework soc2 | hipaa | iso42001
hexr cluster       register a runtime cluster with the control plane
hexr trust-policy  cross-cloud federation policy
hexr update        upgrade a running agent
hexr login/logout  control-plane session
```

### `hexr analyze`

A Rust analyzer parses your code (no execution) and identifies the framework and the agentic pattern, so `hexr build` knows where identity attaches and what to wrap. Detection is pack-driven — YAML rules the analyzer ships with, so a new framework is a pack, not a release.

**Frameworks (15):** CrewAI, LangChain, LangGraph, AutoGen, Google ADK, Strands, LlamaIndex, OpenAI Agents, Claude Agent SDK, Pydantic AI, smolagents, DSPy, Agno, MCP servers, and bespoke Python loops with no framework at all.

**Agentic patterns (7):** prompt chain, routing, parallelization, orchestrator–workers, evaluator–optimizer, ReAct, reflection.

Measured on unmodified files from each framework's own repository: 15/15 correct, 17 files, 715 ms total. The evaluation and its sources ship in the repository (`_hexr_analyzer/EVAL_REPORT_REAL.md`).

## What runs where

- **Your cluster** runs the agents, a per-cluster identity server chained to Hexr's control plane, a policy engine, a credential injector, and the evidence store (Postgres). Evidence never leaves.
- **Hexr's control plane** issues the per-tenant trust root, licences, and receives a 60-second heartbeat that says whether identity is still being issued and whether evidence is still being signed — not a pod count.
- Isolation between tenants is cryptographic: each tenant has its own root; a credential from one tenant is not *denied* by another, it is *unverifiable*. Re-checked hourly, and you can check it yourself on the demo.

## Verify a release

Wheels are published from a tag by GitHub Actions through PyPI trusted publishing (no API token exists) and carry Sigstore attestations. Compare the wheel's SHA-256 with the attestation on the release's workflow run before you trust it.

## Support

Design partners and enterprise: <https://hexr.dev/#cta>. Issues with the SDK: <https://github.com/hexrdev/hexr/issues>.

