Skip to main content
You run LangChain agents or LangGraph workflows. You want tool calls and graph node executions tracked inside Apie runs without wrapping every tool manually. Pass ApieCallbackHandler to your agent’s callbacks inside a run:
import { ApieCallbackHandler } from "@apie-sh/sdk/integrations";
import apie from "./apie.config";

const handler = new ApieCallbackHandler(apie, {
  defaultEnvironment: "production",
});

await apie.withRun({ inputSummary: "LangChain agent run" }, async () => {
  const result = await agent.invoke(
    { input: "Summarize the incident" },
    { callbacks: [handler] },
  );
});
The handler tracks tool start/end events and infers action/resource metadata from tool names.

LangGraph node wrapper

Wrap individual graph nodes for step-level telemetry:
import { withLangGraphNode } from "@apie-sh/sdk/integrations";

await withLangGraphNode(
  apie,
  {
    runId: run.id,
    nodeName: "triage",
    stepKey: "triage-node",
    stepIndex: 1,
  },
  async () => triageNode(state),
);

LangChain tool step

For individual tool steps with explicit metadata:
import { withLangChainToolStep } from "@apie-sh/sdk/integrations";

await withLangChainToolStep(
  apie,
  {
    runId: run.id,
    toolName: "search",
    actionType: "read",
    resourceType: "knowledge_base",
  },
  async () => searchTool.invoke("query"),
);

What you’ll see

Tool calls and workflow steps in the run timeline. In monitor mode, guard evaluations appear for tools with inferred or explicit metadata.

Example

See the LangChain example in the SDK repos:

Next steps

Choose how to instrument

Framework plugin tier overview.

Monitor mode

Observe guard evaluations first.