Skip to main content

CortexHub Python SDK — Runtime governance for AI systems. One decorator, any tool, any framework.

Project description

CortexHub Python SDK

Runtime governance for AI systems. One decorator. Any tool. Any framework.

pip install cortexhub

Python 3.10–3.12.

Quick start

Identity comes from your agent key only — the control plane assigns the canonical agent id. Set CORTEXHUB_AGENT_KEY (or pass agent_key= to init()).

import cortexhub

cx = cortexhub.init()  # requires CORTEXHUB_AGENT_KEY (or pass agent_key=)

@cx.tool
def process_payment(customer_id: str, amount: str, reference: str) -> dict:
    """Process a payment."""
    return payment_service.charge(customer_id, amount, reference)

# Policies, approvals, and audit trail are configured in the control plane.

Configuration

Env var Description
CORTEXHUB_AGENT_KEY Agent identity secret (required for cloud enforcement)
CORTEXHUB_DEBUG Set to 1 or true for readable SDK logs: tool + arguments, policy name + condition, and decision
CORTEXHUB_LOG_LEVEL e.g. DEBUG, INFO (default INFO)

Debug logging

With CORTEXHUB_DEBUG=1 (or CORTEXHUB_DEBUG_POLICY=1), the SDK logs in real time:

  • Tool encountered — tool name and argument names/values (values redacted when privacy mode is on)
  • Policy evaluated — policy name, condition/reasoning, and decision (allow / deny / escalate)
  • Decision — final effect, policy, and reason for the current tool call

Useful for seeing exactly what CortexHub is evaluating and why a tool was allowed, blocked, or sent for approval.

OpenAI Agents SDK (llm.call telemetry)

If you use the OpenAI Agents SDK, initialise with framework="openai_agents" so each model turn is captured as llm.call spans (assistant reasoning text and tool-call intent), merged automatically with any hooks= you pass to Runner.run.

pip install cortexhub[openai-agents]
cx = cortexhub.init(framework="openai_agents")

Documentation · Control plane

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

cortexhub-0.5.18.tar.gz (12.9 MB view details)

Uploaded Source

Built Distribution

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

cortexhub-0.5.18-py3-none-any.whl (12.9 MB view details)

Uploaded Python 3

File details

Details for the file cortexhub-0.5.18.tar.gz.

File metadata

  • Download URL: cortexhub-0.5.18.tar.gz
  • Upload date:
  • Size: 12.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cortexhub-0.5.18.tar.gz
Algorithm Hash digest
SHA256 b15b211b54c6ca183aba6db6d1c3a854a3a4a3ba6a703b3bc373c9135cd2a0d1
MD5 a329d2993abf64369bb6b2b033b3b53a
BLAKE2b-256 e18a625c2829e7960c0b25db69d35de0553f4ff23ecce7c958f47593dab128c5

See more details on using hashes here.

File details

Details for the file cortexhub-0.5.18-py3-none-any.whl.

File metadata

  • Download URL: cortexhub-0.5.18-py3-none-any.whl
  • Upload date:
  • Size: 12.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cortexhub-0.5.18-py3-none-any.whl
Algorithm Hash digest
SHA256 bfe9923a79f494c067cac47be3d93143a3e36a411a66575c986a79eced3979e5
MD5 8a1d9578d38cd1a7c047df784aefed2d
BLAKE2b-256 a2ea17a0bb3a0edab60eceee6426dec62c3860dc6887f152d86f942932eb55d2

See more details on using hashes here.

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