Agent Auth is in Beta and under active development. To provide feedback or use this feature, reach out to the LangChain team.
Installation
Install the Agent Auth client library from PyPI:Quickstart
1. Initialize the client
2. Set up OAuth providers
Before agents can authenticate, you need to configure an OAuth provider using the following process:- Select a unique identifier for your OAuth provider to use in LangChainâs platform (e.g., âgithub-local-devâ, âgoogle-workspace-prodâ).
- Go to your OAuth providerâs developer console and create a new OAuth application.
-
Set LangChainâs API as an available callback URL using this structure:
For example, if your provider_id is âgithub-local-devâ, use:
-
Use
client.create_oauth_provider()with the credentials from your OAuth app:
3. Authenticate from an agent
The clientauthenticate() API is used to get OAuth tokens from pre-configured providers. On the first call, it takes the caller through an OAuth 2.0 auth flow.
In LangGraph context
By default, tokens are scoped to the calling agent using the Assistant ID parameter.

Outside LangGraph context
Provide theauth_url to the user for out-of-band OAuth flows.