agent-identity Python SDK
pip install datacules-agent-identity
Pure-Python client for the agent-identity sidecar. No Node.js required in your Python environment — the sidecar runs separately (Docker or npm run dev).
Install
pip install datacules-agent-identity
Usage
from agent_identity import AgentIdentityClient
from datetime import datetime, timezone
client = AgentIdentityClient(base_url="http://localhost:3001")
# Resolve a credential for a single agent request
resolved = client.resolve({
"userId": "user-abc",
"resourceId": "crm-db",
"resourceKind": "shared",
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"action": "read",
"traceId": "trace-xyz",
"requestedAt": datetime.now(timezone.utc).isoformat(),
})
print(resolved["resolvedFor"]) # 'service' or userId
# Resolve source + target credentials for a migration phase
pair = client.resolve_migration({
"migrationId": "migration-2026-q2",
"phase": "load",
"sourceResourceId": "crm-postgres-prod",
"targetResourceId": "crm-postgres-v2",
"userId": "svc-migration-bot",
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"traceId": "trace-abc123",
"dryRun": False,
})
print(pair["expiresAt"]) # ISO 8601 or None
Async client
import asyncio
from agent_identity import AsyncAgentIdentityClient
async def main():
async with AsyncAgentIdentityClient(base_url="http://localhost:3001") as client:
resolved = await client.resolve({...})
print(resolved["resolvedFor"])
asyncio.run(main())
LangChain integration
from langchain_anthropic import ChatAnthropic
from agent_identity import AgentIdentityClient
client = AgentIdentityClient()
resolved = client.resolve({...})
# resolved["resolvedFor"] is safe to log; the raw API key stays on the server
llm = ChatAnthropic(model="claude-sonnet-4-20250514")
# The sidecar injects the API key server-side when you call /api/resolve
Error handling
from agent_identity import AgentIdentityClient, NoCredentialError, ValidationError
try:
result = client.resolve(ctx)
except NoCredentialError:
# 403 — no routing rule matched this context
...
except ValidationError as e:
# 400 — bad request body
print(e)
Starting the sidecar
# Docker
docker pull datacules/agent-identity
docker run -p 3001:3001 datacules/agent-identity
# Or from source
git clone https://github.com/hvrcharon1/agent-identity.git
cd agent-identity && npm install --legacy-peer-deps && npm run dev
# Then point your Python client at http://localhost:3000 (dev) or :3001 (Docker)
Part of the agent-identity monorepo by Datacules LLC.
Release files for datacules-agent-identity 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datacules_agent_identity-0.13.0.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datacules_agent_identity-0.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / datacules_agent_identity-0.13.0.tar.gz
| Download URL | datacules_agent_identity-0.13.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6f04dcdccc30e38d2b8c8971610711cf4b0d0391ddcc4d78d7462d5dd4a84d3
|
|
BLAKE2b-256 checksum How to use checksums |
ac2ecfd1431513d9a28d8df034a8383790c4421b9f83404e56ab4c7c3c94a84b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / datacules_agent_identity-0.13.0-py3-none-any.whl
| Download URL | datacules_agent_identity-0.13.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
672fad85d9530c29c5071ca3f142bd1af55a982adbb8fa5c0b7ce605f7fc46d1
|
|
BLAKE2b-256 checksum How to use checksums |
474dad087b279daff7f66982df2370f8c630a3b97b41191a5572b8276599efe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|