How Pinterest Improved Analytics Agent Compliance with Loop Engineering
Pinterest replaced trial-and-error prompt editing of its Analytics Agent with "loop engineering": an automated cycle that proposes small edits to the system prompt, skills, context layer or tools, then tests them against labeled real chats. Each compliance rule gets paired required and skip suites, which reward following a step when it is needed and penalize unnecessary actions, plus a larger regression suite and a final holdout set. Iterations start from a fresh context but read a structured handoff recording scores, failing cases, the best change so far and approaches not to repeat. Up to four candidate edits are raced on a small sample, and the winner must pass repair/break, anti-overfitting critic and regression gates. A 10.3% run-to-run verdict flip rate showed that aggregate scores hide noise, so the loop tracks per-case flips instead of trusting small score gains.
Related posts
- The Art of Loop Engineering
LangChain easyNoviceAgent systems can be structured as four stacked loops: the basic agent loop (model calls tools until done), a verification loop where a deterministic or LLM grader checks output against a rubric and retries with feedback, an event-driven loop where crons, webhooks or Slack channels trigger background runs, and a hill-climbing loop where an analysis agent mines production traces to rewrite prompts, tools or graders. Each level maps to a LangChain primitive (create_agent, RubricMiddleware, LangSmith Deployment triggers or Fleet channels, LangSmith Engine), illustrated with an internal docs-writing agent. Verification trades extra latency and cost for quality, and human-in-the-loop checkpoints are recommended at every level for sensitive actions. The argument is that compounding value lies in the outer event and improvement loops.
- Your Agent Aced the Task. Will It Do It Again?
Hugging Face mediumAdeptLLM agents that score well on average often fail to repeat their successes: a GPT-4.1 ReAct agent on AppWorld reaches 77.4% Mean@5 but only 53.0% Pass^5 (success on all five runs), a 24.4-point consistency gap, even at temperature 0. The gap comes from flat next-token distributions at certain decision points, where near-ties flip under platform noise and the flips compound across a trajectory. IBM's Consistency Analyzer in ALTK-Evolve finds these flip-prone steps from a single recorded trace by resampling k completions per step, with no ground truth or replay needed, and turns them into injected guidelines. The guidelines cut the gap to 12.0pp (Pass^5 53.0% to 69.0%) without lowering mean accuracy, and they transfer to similar tasks. The authors recommend reporting Pass^k next to Mean@k.
- How we used DSPy to turn AI evaluations into better responses in Dash chat
Dropbox Tech mediumAdeptDropbox improved its Dash chat agent with a two-stage DSPy loop. First, LLM-as-judge evaluators were calibrated against a small set of human-labeled chat traces scored on five dimensions, with reasoning notes and failure codes. The calibrated judges then drove GEPA-based optimization of the agent's system prompt, using offline counterfactual replay of historical internal chats. Launch results included 26% fewer incomplete answers, 13% fewer missed key aspects, 5.4% lower token usage and 9.8% shorter completions. The team stresses guardrails: small targeted prompt edits plus automated checks on prompt structure, caching behavior and size.
- Building production-ready agentic systems: Lessons from Shopify Sidekick
Shopify Engineering mediumAdeptShopify's Sidekick merchant assistant outgrew a monolithic system prompt once its tool count passed ~50, so the team moved to just-in-time instructions returned alongside tool results, which kept prompt caches intact and improved maintainability and metrics. For evaluation they replaced curated golden datasets with ground truth sets sampled from real conversations, labeled by multiple experts and validated with Cohen's Kappa, Kendall Tau and Pearson correlation. LLM judges were calibrated from a Kappa of 0.02 to 0.61 against a human baseline of 0.69, and an LLM merchant simulator replays conversations against candidate systems before release. GRPO fine-tuning with gated procedural and semantic rewards exposed reward hacking such as opting out of tasks and misusing customer tags, and fixing the validators and judges raised syntax accuracy from ~93% to ~99%.
- Improving the academic workflow: Introducing two AI agents for better figures and peer review
Google Research easyNoviceGoogle Research presents two multi-agent research prototypes for academic workflows. PaperVizAgent (formerly PaperBanana) turns a paper's method section and a figure caption into publication-ready diagrams or Python-plotted charts using retriever, planner, stylist, visualizer and critic agents with an iterative critique loop. Judged by a calibrated LLM against a human baseline of 50, it scored 60.2 overall, beating GPT-Image-1.5, Nano-Banana-Pro and Paper2Any. ScholarPeer produces literature-grounded peer reviews using a sub-domain historian agent with web search, an adversarial baseline scout that looks for missing comparisons, and a multi-aspect Q&A engine that checks claims, and it wins side-by-side comparisons against existing automated reviewers.