AI Agent session management SDK
Project description
AgentAuth
Persistent auth for AI agents. Works on any site, today.
No website integration required. No OAuth adoption needed. Just secure session management that works.
Quick Start • LangChain • n8n • Chrome Extension • Roadmap
The Problem
# What every agent developer does today
cookies = {"session_id": "abc123..."} # Hardcoded. Breaks constantly. Security nightmare.
Sessions expire. Cookies leak into git history. No audit trail. No access control.
The Solution
from agent_auth import Vault
vault = Vault()
vault.unlock("password")
cookies = vault.get_session("linkedin.com") # Encrypted. Scoped. Audited.
pip install agentauth-py
Works on sites as they exist today. No website changes. No OAuth adoption. No waiting for the ecosystem.
See It In Action
Agent automatically authenticates using stored session—no manual login, no hardcoded cookies.
How It Works
- Export cookies with the Chrome extension while logged into any site
- Store them in an encrypted vault (
agent-auth add linkedin.com) - Your agent retrieves them securely on-demand
Quick Start
1. Initialize your vault
agent-auth init
2. Create an agent with scoped access
agent-auth create-agent sales-bot --scopes linkedin.com,gmail.com
3. Store a session
Export cookies with the Chrome extension, then:
agent-auth add linkedin.com
# Paste exported cookies
4. Use in your agent
from agent_auth import Agent, AgentAuthClient
agent = Agent.load("sales-bot")
client = AgentAuthClient(agent)
session = client.get_session("linkedin.com")
import requests
response = requests.get("https://linkedin.com/feed", cookies=session)
Why AgentAuth?
| Without AgentAuth | With AgentAuth |
|---|---|
| Hardcoded cookies in code | Encrypted vault storage |
| Sessions in git history | Secrets separate from code |
| Any code can access anything | Scoped access per agent |
| No idea what accessed what | Full audit logging |
| Sessions break silently | Expiration notifications |
LangChain Integration
from langchain_openai import ChatOpenAI
from langchain.agents import initialize_agent, AgentType
from agent_auth.langchain import get_agentauth_tools
tools = get_agentauth_tools(
agent_name="sales-bot",
vault_password="your-vault-password"
)
llm = ChatOpenAI(model="gpt-4", temperature=0)
agent = initialize_agent(
tools=tools,
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
# Agent automatically uses stored sessions
response = agent.run("Get my LinkedIn notifications")
Available tools:
authenticated_request— Make HTTP requests with stored session cookiesget_session_cookies— Retrieve cookies for custom requests
n8n Integration
Use AgentAuth in your n8n workflows with our community node.
npm install n8n-nodes-agentauth
The node lets you:
- Store and retrieve session cookies in n8n workflows
- Use authenticated sessions with HTTP Request nodes
- Build automation flows that require login
📦 View on npm | GitHub
Playwright Integration
from playwright.sync_api import sync_playwright
from agent_auth import Vault
vault = Vault()
vault.unlock("password")
cookies = vault.get_session("github.com")
with sync_playwright() as p:
browser = p.chromium.launch()
context = browser.new_context()
context.add_cookies(cookies)
page = context.new_page()
page.goto("https://github.com/notifications")
# Already authenticated!
CLI Reference
| Command | Description |
|---|---|
agent-auth init |
Initialize encrypted vault |
agent-auth add <domain> |
Add session for a domain |
agent-auth list |
List stored sessions |
agent-auth create-agent <n> --scopes <domains> |
Create scoped agent |
agent-auth agents |
List registered agents |
Security
- AES-256 encryption with PBKDF2 key derivation (100k iterations)
- Ed25519 keypairs for agent identity
- Scoped access — agents only access approved domains
- Audit logging — every access logged with timestamp
- SQLite storage — encrypted database at
~/.agent-auth/vault.db
Roadmap
- Chrome extension for cookie export
- Encrypted local vault
- Playwright integration
- LangChain integration
- n8n integration — n8n-nodes-agentauth
- Firefox extension
- Selenium examples
- Cloud vault sync
Examples
Working demos available in the examples/ folder.
GitHub Agent Demo
Setup:
# 1. Create the agent
agent-auth create-agent github-agent --scopes github.com
# 2. Export cookies from github.com using Chrome extension
# 3. Add the session
agent-auth add github.com
Run:
PYTHONPATH=. python examples/github_agent.py
Contributing
PRs welcome. Check out the issues for feature requests.
License
MIT
⭐ Star us if AgentAuth helps your agents authenticate!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentauth_py-0.2.0.tar.gz.
File metadata
- Download URL: agentauth_py-0.2.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9da73a3e0db9ad88474224c807361bb8add174689da20f578ccd8e419034af5d
|
|
| MD5 |
fdd7ba5f7c404f757245d7743b8d3883
|
|
| BLAKE2b-256 |
93f8ca31d1aa2336b8dd496dcae6ab14262ca073218c2f868fffed1f7780dbcf
|
File details
Details for the file agentauth_py-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentauth_py-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c6edb9597ffadba06929b391c14216096062392acc7e3ab0ea0e54844195844
|
|
| MD5 |
738bbaebb3f680562778e8c0ad7170cd
|
|
| BLAKE2b-256 |
7737c64c0cbca034c84c0d66acb4db0c56688ff79d6f66ec5c7379b469a90851
|