Watch Every AI Agent Move: Trace Cursor in LangSmith

By LatestLLM Editorial ·

Watch Every AI Agent Move: Trace Cursor in LangSmith

Learn how to hook Cursor into LangSmith so every AI agent step is fully traced, with step‑by‑step plugin install, env var setup, and real trace inspection.

Ever wondered how to watch every move an AI agent makes, step by step?

⚡ TL;DR: Install the LangSmith plugin in Cursor, set three environment variables, and watch full traces of agent turns appear in LangSmith.

The Simple Version

Install the LangSmith plugin in Cursor, add three environment variables, and run a simple agent task. When it finishes, open LangSmith and you’ll see a full trace of the whole workflow.

How It Actually Works

Install the LangSmith plugin

Open Cursor’s extensions marketplace, search for “LangSmith”, click install, then restart Cursor.

🎯 Think of it this way: It’s like adding a secret camera that records every line of code the agent executes.

Set the three environment variables

You need LANGSMITH_TRACING, LANGSMITH_ENDPOINT, and LANGSMITH_PROJECT. Set them in Cursor’s terminal before you start the agent.

🎯 Think of it this way: These variables are the keys that unlock the tracing camera.

Run a Cursor agent task

Create a tiny agent that answers a question, then execute it. The plugin automatically sends each turn to LangSmith.

Technical Deep Dive

The plugin patches the agent’s run loop to emit trace events whenever it selects a tool or generates a response.

Trace structure

Each trace contains a unique ID, a list of child spans for every turn, and optional attachments like logs or images.

🎯 Think of it this way: A trace is a tree where each branch is a decision the agent made.

You can also attach files or screenshots by dropping them into the workspace; the plugin captures them as attachments.

Why This Matters

Seeing each agent turn in a trace turns opaque loops into transparent pipelines, making debugging much faster.

Developers can spot where a model hallucinated, where a tool failed, or where latency spiked, all without adding manual logs.

This visibility also builds trust, because stakeholders can literally watch the AI’s reasoning process.

Key Takeaways

  • Install the LangSmith extension in Cursor to enable automatic tracing.
  • Set three env vars: LANGSMITH_TRACING, LANGSMITH_ENDPOINT, LANGSMITH_PROJECT.
  • Run any Cursor agent; every turn appears as a span in LangSmith.
  • Traces include child spans, attachments, and a clear hierarchical view.
  • Debugging becomes visual, cutting down guesswork.
  • The same setup works for Claude Code and Codex, creating a unified trace format.
  • Start with a simple task, then explore advanced tracing features in LangSmith.

Source: “Watch Every AI Agent Move: Trace Cursor in LangSmith” on YouTube by LangChain

Tags: AI, LLM, LangSmith, Cursor, AgentTracing

Related articles