Installation
TypeScript only; use Node.js 22+ and AI SDK 6 or 7. Install Reflect together with the framework and model provider used below.- npm
- yarn
- pnpm
Credentials
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 suppliesreflect_bash automatically.
TypeScript
How the integration behaves
wrapVercelAgent records agent, model-step, and actual tool execution as CHAIN → AGENT → LLM → TOOL. Model middleware enriches those same model spans; middleware by itself records only model-level activity. See Vercel tracing.
Conversations and replay
Reflect constructs a native agent per invocation and preserves yourprepareCall / prepareStep hooks. It composes current memory and restricts reflection to its tool and step budget. Reflection continues completed response messages; fresh validation starts without prior history.
For ordinary multi-turn tasks, pass native conversation messages or use your own history store. A Reflect session ID groups evidence but is not a Vercel conversation store.
Streaming
For an interactive UI, consume the entire stream inside an explicit boundary. The nativeinvokeOptions: { stream: true } convenience consumes supported streams and returns the completed result. Complete or cancel streams explicitly; abandoning a consumer is not a completion signal.
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.

