← Back to Learn
sdktutorialdeployment

How to install the Authensor SDK

Authensor

Authensor provides SDKs for TypeScript and Python. Both SDKs wrap the same core policy engine and provide the same guard API. Choose the one that matches your agent's runtime.

TypeScript SDK

The TypeScript SDK is published as @authensor/sdk on npm. It requires Node.js 18 or later and runs as ESM only.

With pnpm:

pnpm add @authensor/sdk

With npm:

npm install @authensor/sdk

With yarn:

yarn add @authensor/sdk

Python SDK

The Python SDK is published as authensor on PyPI. It requires Python 3.10 or later.

pip install authensor

Or with a virtual environment:

python -m venv .venv
source .venv/bin/activate
pip install authensor

Optional packages

The core SDK handles policy evaluation and receipt generation. For additional capabilities, install the optional packages:

| Package | Purpose | |---------|---------| | @authensor/aegis | Content safety scanning (prompt injection, PII, credentials) | | @authensor/sentinel | Behavioral monitoring and anomaly detection | | @authensor/mcp-server | MCP gateway with built-in policy enforcement |

pnpm add @authensor/aegis @authensor/sentinel

Verify the installation

import { createGuard } from '@authensor/sdk';

const guard = createGuard({
  policy: {
    version: '1',
    rules: [{ tool: '*', action: 'allow' }]
  }
});

const result = guard('test.tool', { key: 'value' });
console.log(result.action); // 'allow'

If this prints allow, the SDK is installed correctly.

Self-hosted control plane

If you need centralized policy management, multi-tenant support, or a REST API, install the control plane:

git clone https://github.com/authensor/authensor
cd authensor
pnpm install
pnpm build

The control plane runs as a standalone HTTP server and connects to PostgreSQL for policy storage and receipt persistence. See the self-hosting guide for Docker deployment.

Version compatibility

The SDK follows semantic versioning. All packages in the Authensor monorepo share the same version number. Always use matching versions across packages to avoid compatibility issues.

Keep learning

Explore more guides on AI agent safety, prompt injection, and building secure systems.

View All Guides