Skip to main content

AuthSec identity, delegation, and CIBA approval for LangChain agents

Project description

authsec-langchain

AuthSec identity, delegation, and human-in-the-loop approval for LangChain agents.

What this gives you

  • Delegation tokens — short-lived JWTs scoped to a single agent run, fetched from AuthSec
  • Cloud credential exchange — trade the delegation JWT for AWS STS / Azure AD / GCP IAM credentials, so the agent never holds long-lived cloud keys
  • CIBA approval — pause the agent and require a human tap-to-approve before a high-risk tool runs
  • LangChain callback — drop-in handler that surfaces the current delegation token to every tool invocation

The SDK only consumes the AuthSec HTTP API. No AuthSec server changes are required.

Install

pip install authsec-langchain

Quick start

from authsec_langchain import AuthsecClient, AuthsecConfig, AuthsecCallbackHandler

client = AuthsecClient(AuthsecConfig(
    base_url="https://auth.example.com",
    api_token="<agent-bootstrap-jwt>",
    tenant_id="tenant-123",
))

# Get a delegation JWT
token = client.get_delegation_token()

# Trade it for AWS credentials
aws_creds = client.exchange_cloud_credentials(
    "aws",
    audience="sts.amazonaws.com",
    role_arn="arn:aws:iam::123456789012:role/my-agent-role",
)

# Ask the user to approve a high-risk action
approved_jwt = client.request_approval(
    login_hint="user@example.com",
    binding_message="Allow agent to delete production resources?",
)

See examples/aws_s3_agent.py for an end-to-end LangChain agent.

What's in v0.1

Feature Status
Delegation-token fetch + cache
AWS / Azure / GCP cloud exchange
CIBA initiate + poll
LangChain callback handler
Async client ⏳ v0.2
LangGraph node helpers ⏳ v0.2
Streaming approval (webhook) ⏳ v0.3

Development

pip install -e ".[dev]"
pytest

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

authsec_langchain_sdk-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

authsec_langchain_sdk-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authsec_langchain_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for authsec_langchain_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd9d451c592c777fa147eb63818a6147fa46f029c48136e767e8baf426a89ac7
MD5 17b1fecf23aa9adbefce2d8d0e0a120b
BLAKE2b-256 e0028f115682bd0d1453ad6be5010f659f0272538b2040cd29dfc89efd6676a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for authsec_langchain_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b1da19ccf5a6922182cb8c2334bffe35a6425d2e9a70d6346efc6274bdeb91b
MD5 27a3123f980f5e1aeb3f817d0d82a70d
BLAKE2b-256 635200c2eefdbc5285375a86f1ef951969b18fd258e51a921938c171bcd2382e

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