import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatOpenAI } from "@langchain/openai";
import { MemorySaver } from "@langchain/langgraph";
import { LangGraphCallbackHandler } from "pandaprobe/integrations/langgraph";
import { Client } from "pandaprobe";
import { Reflect as ReflectRuntime } from "pandaprobe/reflect";
async function main() {
const client = new Client();
const reflect = new ReflectRuntime(client);
try {
const agent = await reflect.agent(createReactAgent, {
framework: "langgraph",
options: {
llm: new ChatOpenAI({ model: "gpt-6-luna", reasoning: { effort: "none" } }),
prompt: "For standard returns, refund merchandise paid and exclude outbound shipping. Explain the policy clearly.",
tools: [], // Your native business tools go here.
checkpointer: new MemorySaver(),
},
invokeOptions: { callbacks: [new LangGraphCallbackHandler({ client })] },
});
const result = await reflect.run(agent, "I paid $65 for an item and $7 for shipping. What is refundable?", { sessionId: "customer-42" });
console.log(result.messages.at(-1)?.content);
} finally {
await reflect.close();
await client.shutdown();
}
}
main().catch(error => { console.error(error); process.exitCode = 1; });