Ever wish you could test your AI agent changes in a safe sandbox before they hit production? LangSmith’s preview builds let you do exactly that.
The Simple Version
Think of a preview build as a disposable test lab that appears whenever you open a PR. It runs your agent, shows you results, and disappears when you’re done.
How It Actually Works
Create Preview Deployment
When you push a branch, LangSmith watches the GitHub PR and creates a unique URL.
Test Agent Locally
Use langgraph dev to run the agent on your machine and point it at the preview endpoint.
Validate in Studio
Open the preview URL in LangSmith Studio to inspect logs, traces, and performance metrics.
Trigger New Revision
Commit another change, and LangSmith automatically rebuilds the preview with the new code.
Merge and Cleanup
When the PR merges, LangSmith tears down the preview automatically.
Technical Deep Dive
The system uses a GitHub webhook to detect PR events and triggers a CI step that spins up a Docker container with a unique subdomain.
LangSmith injects environment variables that point the agent client to the preview endpoint, enabling seamless local testing with langgraph dev.
All traces are tagged with the PR number, making it easy to correlate performance with code changes.
Why This Matters
Preview builds let teams catch bugs early, reduce production rollbacks, and accelerate iteration on AI components.
By providing isolated, disposable environments, they eliminate the “works on my machine” problem that plagues LLM pipelines.
Faster feedback loops mean you can ship smarter agents with confidence, saving both time and costly outages.
Key Takeaways
- Preview builds create temporary LangSmith deployments for each PR.
- They let you test LangChain agents locally with
langgraph dev. - You can validate changes in LangSmith Studio before merging.
- Each commit triggers a new preview revision automatically.
- Merging cleans up the preview, keeping your environment tidy.
- This workflow cuts debugging time and boosts release confidence.