Spectron ships a harness adapter that records LangChain conversations into the substrate via POST /api/v1/{context_id}/facts/batch — without changing your chain prompts.
Package: spectron-langchain (PyPI). It depends on LangChain in your app, not bundled inside the adapter.
Installation
Environment
| Variable | Purpose |
|---|---|
SPECTRON_BASE_URL or SPECTRON_URL | Server URL |
SPECTRON_API_KEY | Context API key |
SPECTRON_CONTEXT or SPECTRON_CONTEXT_ID | Context id |
Auth uses header API-KEY. Idempotency keys are derived from the platform conversation identity (24h dedupe per context + principal).
Usage pattern
The adapter implements LangChain memory / callback hooks so each user and assistant message is batched to Spectron after the turn completes. Recall for prompt injection uses the same /query or /context endpoints as the REST API.
See the LangChain adapter package README for class names and constructor options.
When to use MCP instead
If the host is Claude Desktop, Cursor, or another MCP-native client, prefer spectron mcp — no Python adapter required.
When to use the SDK instead
If your application calls Spectron explicitly (not only through LangChain’s memory interface), use surrealdb-spectron directly. See Python SDK.
npm / TypeScript
There is no first-party @spectron/langchain package in the repo today. TypeScript agents should use @surrealdb/spectron-vercel-ai or the REST API.