The Agent Lens TypeScript SDK is part of the CoreWeave Forge SDK package, @coreweave/forge-sdk. It records conversations, turns, LLM calls, tool calls, and sub-agent calls from a Node.js agent and sends them to Agent Lens.
The package requires Node.js 18.19 or later in the 18.x line, or Node.js 20.6 or later.
Install and import
Import the tracing and integrations namespaces from @coreweave/forge-sdk/agentlens:
The same APIs are also available from the @coreweave/forge-sdk/agentlens/tracing and @coreweave/forge-sdk/agentlens/integrations entry points.
Before you trace
-
tracing.init() takes an entity/project name and reads your API key from the WANDB_API_KEY environment variable unless you pass apiKey.
-
Wrap every request or agent run in
tracing.runIsolated(). Tracing state is scoped to that callback, including across await, and the start*() functions throw when no scope is active.
-
To trace OpenAI, Anthropic, or Google Gen AI calls automatically, start Node.js with the SDK’s preload, or wrap each client with a
wrap*() function from Integrations:
Functions
Classes
Conversation: A Conversation groups Turns under a single gen_ai.conversation.id.
LLM: An LLM call.
SubAgent
Tool: A tool invocation.
Turn: An agent invocation.
Interfaces
Type aliases
Integrations
Last modified on September 28, 2026