// Import necessary dependenciesimport { ChatAnthropic } from "@langchain/anthropic";import { MemorySaver } from "@langchain/langgraph";import { HumanMessage } from "@langchain/core/messages";import { createReactAgent } from "@langchain/langgraph/prebuilt";import { TavilySearchResults } from "@langchain/community/tools/tavily_search";// Define tools for the agentconst agentTools = [new TavilySearchResults({ maxResults: 3 })];// Initialize the Anthropic model with Helicone integrationconst agentModel = new ChatAnthropic({ temperature: 0, modelName: "claude-3-opus-20240229", anthropicApiKey: process.env.ANTHROPIC_API_KEY, clientOptions: { baseURL: "https://anthropic.helicone.ai", defaultHeaders: { "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`, "Helicone-Cache-Enabled": "true", }, },}).bindTools(agentTools);// Initialize memory to persist state between graph runsconst agentCheckpointer = new MemorySaver();// Create the agentconst agent = createReactAgent({ llm: agentModel, tools: agentTools, checkpointer: agentCheckpointer,});// Run the agent with custom Helicone propertiesconst result = await agent.invoke( { messages: [new HumanMessage("what is the current weather in sf")] }, { options: { headers: { "Helicone-Prompt-Id": "weather-query", "Helicone-Session-Id": uuidv4(), "Helicone-Session-Name": "weather-session", "Helicone-Session-Path": "/weather", }, }, });