AdmissibleAI

LangChain Quickstart

Run a short LangChain example against the Admissible API using your Sandbox API key. The example shows one allowed action, one denied action, and the runtime decision that explains the difference.

Wrap a short LangChain tool flow against the Admissible API and see one allowed action, one denied action, and the runtime decision that explains the difference.

Ready to integrate this into a real app? Read the full docs.

Prerequisites

  • Node.js 18 or later and npm
  • Admissible API URL
  • ADMISSIBLE_API_KEY

Need an API key? Create a Sandbox account.

Quickstart

  1. Create a project directory and install dependencies

    Note: The LangChain adapter package currently publishes under the @baseline-labs npm namespace. It is the official LangChain adapter package for using Admissible AI.

    Command

    mkdir admissible-langchain-quickstartcd admissible-langchain-quickstartnpm init -ynpm install @baseline-labs/adapter-langchain tsx
  2. Set the required environment variables

    Command

    export ADMISSIBLE_BASE_URL="https://api.admissible.io"export ADMISSIBLE_API_KEY="your-admissible-api-key"
  3. Run the example

    Command

    npx tsx langchain-sandbox-quickstart.ts

What this run does

This example sends a short LangChain tool flow through Admissible so you can see how Admissible evaluates wrapped tool actions before they run.

  • The script wraps two LangChain tools with @baseline-labs/adapter-langchain.
  • The first action is an allowed read-only tool call. The second is an irreversible production-style change.
  • Admissible allows the read, blocks the irreversible action, and returns decision details through the same wrapped tool flow.

LangChain integration surface

const integration = createBaselineLangChain({ baseline, agentId, sessionId });const [readFile] = integration.wrapTools([  defineBaselineTool({ name: "read.file", authority: authorityPresets.readOnly, execute }),]);await readFile.invoke({ path: "README.md" });

What you should see

A successful first run should make the allowed path and the runtime decision easy to spot.

  • one allowed wrapped tool invocation
  • one denied irreversible action
  • LangChain-side tool history from Admissible
  • machine-readable decision fields such as code and reason
  • a Sandbox usage summary before and after the run