Skip to main content
Permit is an access control platform that provides fine-grained, real-time permission management using various models such as RBAC, ABAC, and ReBAC. It enables organizations to enforce dynamic policies across their applications, ensuring that only authorized users can access specific resources.

Overview

This package provides two LangChain tools for JWT validation and permission checking using Permit:
  • LangchainJWTValidationTool: Validates JWT tokens against a JWKS endpoint
  • LangchainPermissionsCheckTool: Checks user permissions using Permit

Setup

Set up the following environment variables:
Make sure your PDP (Policy Decision Point) is running at PERMIT_PDP_URL. See Permit docs for details on policy setup and how to launch the PDP container.

Credentials

It’s also helpful (but not needed) to set up LangSmith for best-in-class observability:

Instantiation

JWT Validation Tool

The JWT Validation tool verifies JWT tokens against a JWKS (JSON Web Key Set) endpoint.

Configuration Options

You can initialize the tool with either:
  • A JWKS URL
  • Direct JWKS JSON data
  • Environment variable (JWKS_URL)

Permissions Check Tool

The Permissions Check tool integrates with Permit.io to verify user permissions against resources.
This documentation demonstrates the key features and usage patterns of both tools.

Invocation

Invoke directly with args

JWT Validation Tool

Permissions Check Tool

Input Formats

The permissions checker accepts different input formats:
  1. Simple string for user (converts to user key):
  1. Full user object:

Invoke with ToolCall

(TODO)

Chaining

  • TODO: Add user question and run cells
We can use our tool in a chain by first binding it to a tool-calling model and then calling it:

Additional Demo Scripts

For fully runnable demos, check out the /langchain_permit/examples/demo_scripts folder in this repository. You’ll find:
  • demo_jwt_validation.py – A quick script showing how to validate JWTs using LangchainJWTValidationTool.
  • demo_permissions_check.py – A script that performs Permit.io permission checks using LangchainPermissionsCheckTool.
Just run python demo_jwt_validation.py or python demo_permissions_check.py (after setting your environment variables) to see these tools in action.

API reference

For detailed documentation of all Permit features and configurations head to the API reference: docs.permit.io/