# How Clay’s agent writes code its own engineers wouldn’t

## Executive summary

Clay's new global agent emphasizes harness engineering over post-training, demonstrating that complex, outcome-oriented tasks can be achieved by building around a robust CLI and agent-friendly primitives. The system utilizes advanced techniques like isolated sandboxing (Firecracker/Daytona), high-durability orchestration (BullMQ), and a custom Knowledge Hub for memory, resulting in a highly expressive, though complex, agentic architecture.

## Key takeaways

- Shift from Task-Oriented to Outcome-Oriented Agents: The new Clay agent is designed to be comprehensive, handling end-to-end go-to-market tasks, contrasting with the previous, more granular, task-focused product, Sculptor (01:11).
- Harness Engineering Outperforms Post-Training: The company found that the most significant performance gains came from squeezing juice out of the harness engineering and primitives, rather than achieving step-function differences through model post-training (00:00).
- Complex Bash Commands and Security: The agent executes extremely complex, multi-line Bash commands (1:02:37). To ensure safety, the agent operates against a Firecracker isolated sandbox, with the agent running outside the sandbox (1:02:37).
- Memory Precedes the Agent: The team prioritized building the memory system (Knowledge Hub) before the agent itself, recognizing the critical need to share business insights across the go-to-market motion (41:16).
- Pricing Strategy: Tokens Over Outcomes: The company prefers charging for tokens (the unit of work) rather than outcomes, viewing tokens as a proxy for the work delivered, which is considered a more rational business model (56:57).

## Technical details

- Agent Architecture and Primitives: The agent is built around a coding agent that leverages a custom CLI (Command Line Interface) as a core primitive. This allows the agent to perform complex operations like generating artifacts (workflows, audience segments) and scheduling follow-ups (07:32).
- Orchestration and Durability: The agent relies on a robust orchestration layer, utilizing BullMQ to ensure high durability, allowing long-running tasks (30+ minutes) to continue even if a host fails (1:02:37).
- Search and Data Layer: The system includes a custom SQL-like search query language (DSL) to construct complex queries against large datasets (900 million contacts, 40 million companies), addressing the limitations of simple filtering (21:53).
- Memory and Context: Memory is managed through a two-tiered system: the company-level Knowledge Hub (a wiki-style understanding of the business) and agent-level memory (user-scoped, per thread). The Knowledge Hub is both auto-populated and self-updating (41:16).
- Model Routing and Control: The system uses a post-trained model router, which resides at the harness layer. This allows the company to deliver excess value by matching user expectations to specific models, often achieving cost savings (59:14).

## Practical implications

- For build engineers, the focus shifts from optimizing the LLM prompt to optimizing the surrounding infrastructure (harness, CLI, orchestration) to achieve reliable, long-running, and cost-effective outcomes.
- The necessity of robust, durable execution environments (like Firecracker sandboxes) is highlighted when dealing with complex, multi-step agentic workflows.
- The concept of 'agent OS' or 'mega harness' suggests that the future of agent development involves tightly coupling the model, the harness, and the infrastructure into a single, controlled system.

## Topics

Agent Engineering, LLM Orchestration, System Design, Data Enrichment, Security, Clay, BullMQ, Daytona

Source: https://www.youtube.com/watch?v=efBlbQahwng
