Skip to main content

aidr-agent (Python)

Give an AI agent a verifiable AIDR identity from its first run. Apache-2.0.

pip install "aidr-agent[requests]"          # add ,langchain for the LangChain tools
from aidr_agent import Agent

agent = Agent.load_or_enroll("research-01", audiences=["https://shop.example"])
agent.session().get("https://shop.example/products")   # signed; other sites get anonymous requests
  1. An organisation admin issues an enrollment token in the console (Organisations → Enrollment tokens).
  2. Put it in AIDR_ENROLLMENT_TOKEN where the agent runs. The first run generates the key on that machine, enrolls, proves the key and saves the identity; later runs load it. The token is then no longer needed.
  3. Requests to the agent's allowed sites carry an RFC 9421 signature and a short-lived credential. Anything else goes out unsigned, or is refused with on_unlisted="refuse". Plain http is never signed, except to localhost.

Python 3.10+. Extras: requests (for agent.session() / agent.auth()), langchain (the tools, on langchain-core), langchain-community (the RequestsToolkit wrapper). It installs aidr-crypto and aidr-core, the same signing code the registry runs.

Where the identity is kept

Store Use it for How
FileKeyStore (default) laptops, VMs, persistent volumes ~/.aidr/agents/<name>/identity.json, mode 0600 (AIDR_AGENT_HOME moves it)
EnvKeyStore containers, serverless python -m aidr_agent enroll --name <name> --print-identity, then store the line as the secret AIDR_AGENT_IDENTITY

A container that starts with an empty disk would enroll a new agent on every start and spend a use of the token each time: use AIDR_AGENT_IDENTITY there.

HTTP clients

  • agent.session(): a requests.Session. agent.auth(): for requests.get(url, auth=…).
  • agent.httpx_auth(): for httpx.Client and httpx.AsyncClient.
  • agent.sign_headers(method, url): the headers themselves, for any other client.

LangChain

from aidr_agent.langchain import aidr_http_tools

tools = aidr_http_tools(agent)      # http_get, http_post: signed, and limited to the agent's sites

The tools reach only the origins they are given (by default the agent's allowed audiences). An LLM choosing URLs is how a prompt-injected agent would present its identity somewhere it should not, or reach internal addresses. For code still on langchain-community's RequestsToolkit, signed_requests_wrapper(agent) is a drop-in TextRequestsWrapper that signs, sync and async. langchain-community is being sunset, so new code should use the tools.

Command line

aidr-agent enroll --name research-01 --audience https://shop.example
aidr-agent whoami --name research-01

(python -m aidr_agent … is the same command.)

The token is read only from AIDR_ENROLLMENT_TOKEN, never from the command line.

Metadata

Release files for aidr-agent 0.1.2

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

Source distribution (sdist)

Source distribution for aidr-agent 0.1.2
File Size Uploaded
aidr_agent-0.1.2.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aidr-agent 0.1.2
File Interpreter ABI Platform
aidr_agent-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / aidr_agent-0.1.2.tar.gz

Download URL aidr_agent-0.1.2.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aee0339796cd566c596067778a5d077e336aae4c7d5ede52d3ac421614e5ed71
BLAKE2b-256 checksum
How to use checksums
4d8b48a98e30f735d5d0926ed12359fdbfb8f2fef0a6e090bce4d53b55d3260a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / aidr_agent-0.1.2-py3-none-any.whl

Download URL aidr_agent-0.1.2-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d44011edf2a717d1479a3301c4082be1b261dec4397273d5c7d581072a2b39e7
BLAKE2b-256 checksum
How to use checksums
0dd0e548faf2538b10ecb91a2800c3833b0b78252b066fc0825437f83ec9346c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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