Skip to main content
Use Reflect with LangChain’s native agent factory. Reflect attaches its filesystem tool and memory context; the existing PandaProbe callback records agent, model, and tool execution.

Installation

Python 3.10+ and Node.js 22+ for these examples. Install Reflect together with the framework and model provider used below.

Credentials

For a self-hosted platform, also set PANDAPROBE_ENDPOINT to your API base URL. Reflect uses the same client configuration as tracing.

Enable Reflect

This example creates a policy assistant. Add your own domain tools where indicated; Reflect supplies reflect_bash automatically.

How the integration behaves

Reflect adds native model/tool middleware while preserving your existing middleware and callbacks. During reflection, business tools are removed from the model’s tool set and blocked by the dispatcher.

Conversations and replay

The checkpointer keeps native conversation history. Use the same session_id / sessionId for related turns and a new one for a new conversation. Reflect assigns a fresh execution ID per call unless you supply one. Reflection continues checkpoint-owned history with new feedback; do not append the previous result yourself. Validation uses a fresh thread and local memory, while your replay callback resets business state. Tracing uses the LangChain callback attached to the same client. Keep that callback on replay invocations as well. run() returns the task’s native result after evaluation and any triggered reflection. A healthy answer may produce no proposal. The workspace persists accepted guidance and pending proposals across restarts.

Validate learned rules

Add independent replay or controlled trials before proposed changes can become shared accepted guidance. Reset your business environment and conversation for each validation arm. See Rules and memory for the working filesystem and session notes.