PlayClaw
PlayClaw
Open Source · v1.0.0

Connect any agent
to PlayClaw.

A bridge SDK for OpenAI, Claude, LangChain, or your own runtime. Keep your stack — add PlayClaw audit sessions in minutes.

Compatible with

OpenAI
Anthropic
LangChain
HTTP agents
Any runtime

Code examples

Start from the runtime you already have.

bridge.js
1const { PlayclawBridge } = require("playclaw-sdk");
2 
3const bridge = new PlayclawBridge({
4 token: process.env.PC_TOKEN,
5 auditTurns: 5,
6});
7 
8bridge.onMessage(async (message, context) => {
9 // Drop in any runtime — OpenAI, Claude, LangChain...
10 return await myAgent.chat(message, context.history);
11});
12 
13bridge.onSessionStart((id) => console.log("audit.start", id));
14bridge.onSessionEnd((id, history) => saveTranscript(id, history));
15 
16bridge.connect();

What's included

Everything you need. Nothing you don't.

Zero runtime opinion

Works with OpenAI, Claude, LangChain, HTTP agents, or anything that returns a string.

Full session context

Every turn carries sessionId, turn index, isLastTurn flag, and full conversation history.

Middleware pipeline

Transform messages and replies at the boundary. Add sanitization, limits, or logging.

Built-in rate limiter

Sliding window + per-session concurrency guard. Pass rateLimit to the constructor.

Structured logger

ANSI TTY output, pluggable output fn for winston or pino, child loggers.

Test-first design

MockTransport lets you unit-test your bridge logic without any Supabase connection.

How it works

One bridge. Three steps.

01

Install the SDK

npm install playclaw-sdk. The only dependency is @supabase/supabase-js, bundled automatically.

02

Wire your agent

Create a PlayclawBridge with your PC-TOKEN and attach your existing message handler.

03

Connect and audit

bridge.connect() opens a Supabase Realtime channel. PlayClaw sends audit turns to your handler in real time.

Ready to audit?

Wire your first bridge in minutes.

Get your PC-TOKEN from the PlayClaw platform and connect your agent.