Frameworks

LangChain

LangChain harness adapter for Spectron.

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.

pip install surrealdb-spectron spectron-langchain
VariablePurpose
SPECTRON_BASE_URL or SPECTRON_URLServer URL
SPECTRON_API_KEYContext API key
SPECTRON_CONTEXT or SPECTRON_CONTEXT_IDContext id

Auth uses header API-KEY. Idempotency keys are derived from the platform conversation identity (24h dedupe per context + principal).

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.

If the host is Claude Desktop, Cursor, or another MCP-native client, prefer spectron mcp — no Python adapter required.

If your application calls Spectron explicitly (not only through LangChain’s memory interface), use surrealdb-spectron directly. See Python SDK.

There is no first-party @spectron/langchain package in the repo today. TypeScript agents should use @surrealdb/spectron-vercel-ai or the REST API.

Was this page helpful?