Scaling AI Agents: How Clay Monitors 300 Million Monthly Runs Using LangSmith
- Authors

- Name
- Nino
- Occupation
- Senior Tech Editor
In the rapidly evolving landscape of artificial intelligence, transitioning from a successful prototype to a production-grade system capable of handling hundreds of millions of requests is a monumental challenge. Clay, a creative tool for growth and Go-To-Market (GTM) teams, has achieved exactly that. By orchestrating over 300 million agent runs per month, Clay has set a benchmark for what it means to build reliable, scalable AI-driven workflows. At the heart of this success is a sophisticated tech stack that leverages LangSmith for observability and n1n.ai for robust API infrastructure.
The Challenge of Massive Scale
For most developers, managing a few thousand LLM calls is manageable with basic logging. However, when your platform powers the outbound sales and research engines for thousands of enterprises, the complexity scales non-linearly. Clay's agents are tasked with complex workflows: sourcing target accounts, enriching data from dozens of sources, and drafting personalized outreach.
At 300 million runs per month, even a 1% failure rate results in 3 million broken workflows. This scale demands absolute transparency into every step of the agent's reasoning process. Traditional logging falls short because LLM outputs are probabilistic and non-deterministic. Debugging a failed run requires seeing exactly what the prompt was, what the retrieved context looked like, and how the model responded at each step of a multi-turn conversation.
Observability: The LangSmith Breakthrough
Clay utilizes LangSmith to gain granular visibility into their agentic workflows. LangSmith provides a tracing layer that captures the entire lifecycle of an LLM request. For Clay, this means every single one of those 300 million runs is potentially traceable, allowing engineers to drill down into specific failures.
Key Features Utilized by Clay:
- Nested Tracing: Clay’s agents often call other agents or sub-tools. LangSmith’s ability to visualize these nested calls as a tree structure is critical for identifying whether a failure occurred in the high-level logic or a specific sub-task.
- Dataset Curation: By identifying high-quality outputs in production, Clay can quickly add those traces to a dataset. These datasets serve as the gold standard for future fine-tuning or few-shot prompting.
- Real-time Debugging: When a customer reports an issue, Clay’s support and engineering teams can use unique trace IDs to pull up the exact execution path, reducing the mean time to resolution (MTTR) significantly.
Systematic Evaluation (Evals)
Moving beyond simple debugging, Clay has implemented a rigorous evaluation framework. In the world of LLMs, "unit tests" are replaced by "evals." Clay uses a combination of heuristic-based checks and "LLM-as-a-judge" patterns.
For example, if an agent is tasked with summarizing a LinkedIn profile, a heuristic eval might check for the presence of specific keywords or the length of the output. An LLM-based eval (using a more powerful model like GPT-4o or Claude 3.5 Sonnet accessed via n1n.ai) would then score the summary on nuance, accuracy, and tone.
Optimizing the API Layer with n1n.ai
Running 300 million agent runs requires more than just good monitoring; it requires a rock-solid foundation for API access. Clay needs high throughput, low latency, and high rate limits that individual providers often struggle to provide consistently under extreme load.
By integrating with n1n.ai, developers can aggregate multiple LLM providers into a single interface. This ensures that if one provider experiences a localized outage or latency spike, the system can seamlessly failover to another model or provider. n1n.ai provides the high-speed infrastructure necessary to maintain the velocity that Clay's customers expect, while also offering a unified view of costs and usage across different models like DeepSeek-V3, GPT-4o, and Claude.
Implementation Guide: Integrating LangSmith and n1n.ai
To replicate Clay's success, developers should follow a structured implementation path. Below is a simplified example of how to wrap an agent call with LangSmith tracing while routing the request through a high-performance aggregator.
import os
from langsmith import traceable
from openai import OpenAI
# Configure LangSmith
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_API_KEY"] = "your_langsmith_key"
# Configure n1n.ai as the provider
client = OpenAI(
api_key="your_n1n_api_key",
base_url="https://api.n1n.ai/v1"
)
@traceable(name="Clay_Agent_Workflow")
def run_growth_agent(user_query):
# Step 1: Research
research_prompt = f"Find information about: {user_query}"
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": research_prompt}]
)
# Step 2: Analysis (Nested logic)
analysis = perform_analysis(response.choices[0].message.content)
return analysis
@traceable(name="Sub_Task_Analysis")
def perform_analysis(data):
# Additional LLM logic here
return f"Processed: {data[:50]}..."
# Execute
result = run_growth_agent("Top AI startups in San Francisco")
print(result)
Monitoring Performance at Scale
Once tracing is in place, the next step is monitoring. Clay doesn't just look at whether a run succeeded; they look at:
- Token Usage Efficiency: Are prompts getting unnecessarily long?
- Latency Per Step: Which specific tool in the agent's toolkit is slowing down the response?
- Cost Attribution: Which customers or features are consuming the most resources?
By using the analytics dashboard in LangSmith alongside the cost-management features of n1n.ai, Clay can maintain a healthy gross margin even at massive scale. This visibility allows them to make data-driven decisions about when to switch to a smaller, cheaper model (like GPT-4o-mini) for simple tasks and when to reserve the "heavy hitters" for complex reasoning.
Pro Tips for Enterprise AI Scaling
- Aggressive Caching: For 300M runs, many queries will be repetitive. Implement a semantic caching layer before the LLM call to save costs and reduce latency.
- Fallback Logic: Never rely on a single model. Use the unified API from n1n.ai to dynamically route traffic based on current provider health.
- Human-in-the-loop (HITL): Use LangSmith's annotation queues to have human experts review a random sample of traces. This feedback loop is essential for maintaining quality.
- Rate Limit Management: When hitting 300M runs, you will hit rate limits. Use a provider like n1n.ai that offers higher enterprise-grade ceilings and managed queues.
Conclusion
Clay's journey to 300 million monthly agent runs proves that with the right tools, LLMs can be deployed at an incredible scale without sacrificing reliability. By combining the deep observability of LangSmith with the high-performance API infrastructure of n1n.ai, Clay has built a moat around their product that is both technically impressive and commercially successful.
For developers looking to build the next generation of AI-native applications, the lesson is clear: focus on observability from day one and choose an API partner that can grow with your scale.
Get a free API key at n1n.ai