Skip to main content

Self-custody DID + capability VC profile for AI agents (Python port of @p-vbordei/agent-id)

Project description

agent-id (Python)

CI Spec v1.0 License

Idiomatic Python port of @p-vbordei/agent-id. Self-custody DID + capability Verifiable Credential profile for AI agents. Byte-deterministic-compatible with the TypeScript reference: passes the same C1 / C2 / C3 conformance vectors. 17 tests pass.

What's in the box

  • generate_key_pair() / did_key_from_public_key() — Ed25519 keys + did:key codec.
  • issue(opts) — sign a Capability VC with the eddsa-jcs-2022 cryptosuite.
  • verify(vc) — JSON-Schema → validity window → signature → DID resolution, accumulating errors.
  • resolve(did)did:key (offline) and did:web (HTTP, with timeout + response cap) resolution.

Install

pip install agent-id
# or
uv add agent-id

Quickstart

import asyncio
from agent_id import IssueOptions, did_key_from_public_key, generate_key_pair, issue, verify

async def main() -> None:
    principal = generate_key_pair()
    agent = generate_key_pair()

    vc = await issue(IssueOptions(
        principal=principal,
        subject={
            "id": did_key_from_public_key(agent.public_key),
            "type": "Agent",
            "principal": did_key_from_public_key(principal.public_key),
            "model": {"vendor": "anthropic", "id": "claude-opus-4-7"},
            "capability": {"action": "answer", "sla": {"latency_ms_p95": 2000}},
            "valid_from": "2026-04-24T00:00:00.000Z",
        },
    ))

    result = await verify(vc)
    print(f"issued VC for {vc['credentialSubject']['id']}")
    print(f"verified  = {result.verified}")

asyncio.run(main())

Run it:

python examples/quickstart.py

How it relates

Language Repo Notes
TypeScript (reference) agent-id canonical spec, conformance suite
Python agent-id-py this repo
Rust agent-id-rs sibling port

All three implementations produce byte-identical output for serialization-critical surfaces. See docs/architecture.md for details.

Conformance

uv run pytest -v          # runs the same C1 / C2 / C3 vectors as the TS reference

Vectors in vectors/ are copied verbatim from the TS conformance suite. Pass / fail behaviour matches byte-for-byte.

Architecture

See docs/architecture.md for the module layout, dependency choices, and byte-determinism invariants.

Development

git clone https://github.com/p-vbordei/agent-id-py
cd agent-id-py
uv venv -p 3.13
uv pip install -e ".[dev]"
uv run pytest -v
uv run ruff check .

Contributions welcome — see CONTRIBUTING.md.

License

Apache-2.0 — 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

kindred_agent_id-0.1.0.tar.gz (74.9 kB view details)

Uploaded Source

Built Distribution

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

kindred_agent_id-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file kindred_agent_id-0.1.0.tar.gz.

File metadata

  • Download URL: kindred_agent_id-0.1.0.tar.gz
  • Upload date:
  • Size: 74.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kindred_agent_id-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de6abfdca246731cc76818e3979ee9bf4204f623f09830b12b0bf0178ee2224d
MD5 ad3416c70562a43be72cca659f56fdfd
BLAKE2b-256 b4eff7dc8fc003bd6c0c745839b2a528019e0a0562d8010b6881574b1617d771

See more details on using hashes here.

Provenance

The following attestation bundles were made for kindred_agent_id-0.1.0.tar.gz:

Publisher: publish.yml on p-vbordei/agent-id-py

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

File details

Details for the file kindred_agent_id-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kindred_agent_id-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27bb5e0629f086383c4e0a53307dd70508694eac5a54495a288cbe4dbfd06eba
MD5 81112249a385664edc62f17c36e878be
BLAKE2b-256 b5a1553fca5c1b9462629145e2927f76ebd5faa07c290072c4f535af851ad454

See more details on using hashes here.

Provenance

The following attestation bundles were made for kindred_agent_id-0.1.0-py3-none-any.whl:

Publisher: publish.yml on p-vbordei/agent-id-py

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