Skip to main content

countersig

Python client for the Countersig API: agent identity, A2A tokens, policy checks and the org audit log.

pip install countersig

Python 3.11 or later.

Configuration

The client reads these environment variables when it is imported:

Variable Default
COUNTERSIG_API_URL https://api.countersig.com Base URL of the API
COUNTERSIG_API_KEY none API key, sent as a bearer token
COUNTERSIG_ORG_ID none Organization ID, needed by the org-scoped calls
COUNTERSIG_TIMEOUT 10 HTTP timeout in seconds

Use

import countersig

# Verify an A2A token another agent presented. No API key needed.
try:
    result = countersig.verify_a2a_token(token)  # {"valid": True, "payload": {...}}
except countersig.CountersigError as e:
    print(e.status_code, e)  # 401 "Invalid or expired token"

# Calls that need an API key go through a session.
cs = countersig.init_session()  # uses COUNTERSIG_API_KEY and COUNTERSIG_ORG_ID
agents = cs.list_agents()
decision, reason = cs.evaluate_policy(agent_id, "send_email")  # "allow", "hold" or "deny"
chain = cs.verify_chain()

Every call raises CountersigError (with status_code) when the API answers 400 or above.

append_audit posts to /orgs/{org_id}/audit, which the API does not serve yet, so it raises a 404 for now. Reading, exporting and verifying the audit log work.

Documentation

The API reference and developer guide are in Countersig-Public.

License

MIT

Metadata

Release files for countersig 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for countersig 1.0.3
File Size Uploaded Provenance Actions
countersig-1.0.3.tar.gz 6.4 kB Without provenance Details for countersig-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for countersig 1.0.3
File Interpreter ABI Platform Actions
countersig-1.0.3-py3-none-any.whl Python 3 none any Details for countersig-1.0.3-py3-none-any.whl

Total release size: 13.6 kB

Release files / countersig-1.0.3.tar.gz

Download URL countersig-1.0.3.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
493de1c4d0c3dd0288541ee8d17bae11c5ff1f5ae4d1063fd1ab245483c83367
BLAKE2b-256 checksum
How to use checksums
484faa44e7c020c7b9447739b2c0899d6688dc252cc45ebd99c4aa6109050e07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / countersig-1.0.3-py3-none-any.whl

Download URL countersig-1.0.3-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66a0d56813c74702f25c75155f188f7c4984c495350e0301dde54044f60dd174
BLAKE2b-256 checksum
How to use checksums
304124c5d2612869a8017cf5f7c12aa2527e015c94d1eef0304948b281ebce50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for countersig 1.0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files No provenance

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