Ever wondered how to watch every move an AI agent makes, step by step?
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.
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.
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.
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.