A harnessed LLM agent, clearly explained!
Two agents can run the same model on the same task and finish as expected. But one of them can spend nearly 3x the tokens to complete the task.
The extra usage originates from the code wrapped around them, which decides what reaches the model's context on each call and how many calls there are.
For instance, consider a tool that returned 50k tokens of JSON at some step. If it stays in the context, the model will continue to read that payload again at every subsequent step.
Tool definitions behave the same way.
A server can expose 50 tools, each with a name, a description, and an input and output schema.
By default, all of them will stay in the prompt from the first call, whether the agent uses them or not.
However, an optimally built harness can avoid that unnecessary cognitive load on the model.
More specifically, one core design principle of harness engineering is to push things out of the model at the right time:
- Memory holds the state that weights and context shouldn't carry.
- Skills hold procedural knowledge. These cover the operating procedures and heuristics that specialize a general model.
- Protocols hold the interaction contracts for users, other agents, and tools.
Do note that the context never disappears permanently.
It is always loaded when needed, and the harness decides how much is loaded and when.
For instance, to manage a 50k token payload, a harness can write it to a file and keep a preview and a path in context, hand the work to a subagent whose context is discarded afterwards, or summarize the older messages once the conversation passes a threshold.
If you want to see this in practice, TrueForge is an open-source harness that already implements these practices.
Tool schemas are deferred unless preloading is switched on, large responses go to a sandbox file, and generated code calls tools back through the harness, so the sandbox never holds the credentials.
The two agents I talked about at the top are from DevRev's Enterprise-Bench. TrueForge solved the same number of tasks as Claude Managed Agents on the same model, using a bit over a third of the tokens and around 40% fewer tool calls.
Here's the GitHub repo: https://t.co/ZjePhhfKIh
(don't forget to star it ⭐ )
I also wrote a full breakdown of where agent tokens actually go inside a run, covering context accounting, the strategies above, and the benchmark in detail, and TrueForge worked with me to put this together.
Read it below.
Most people want to become AI Engineers
Very few know what to learn next
That's why I'm giving away one of the best Agentic AI Engineer Roadmaps for FREE to the first 4500 people only
Inside you'll learn
✅ Python Fundamentals
✅ LLM Fundamentals
✅ LangChain LangGraph CrewAI AutoGen
✅ LCEL Runnables & Workflows
✅ Memory Systems
✅ Tool Integrations
✅ RAG Systems
✅ Multi Agent Systems
✅ Real World AI Projects
✅ Interview Questions & Answers
72 Hours Only
How to get
Follow me (so I can DM you)
Like + RT
Comment "ROADMAP"
Once the limit is reached I'll stop sending it.
I have also added this book to the Algebrica bibliography, where you can find hundreds of free books and lecture notes covering mathematical analysis, algebra, probability and statistics, and many other areas of mathematics. I update this collection regularly, and I hope it can serve as a useful reference for anyone interested in exploring these topics further.
https://t.co/FvhYaRa4oA
"Mathematical Foundations of Deep Learning" is an excellent free book of almost 300 pages on the mathematics behind modern deep learning. It is a good continuation of the previous resources I shared on the mathematics of modern AI and deep learning systems.
The book has chapters on deep neural networks and function approximation, the Universal Approximation Theorem, network architectures, activation functions, optimisation and optimality conditions, automatic differentiation, deterministic and stochastic optimisation, optimal control, Euler–Lagrange equations, Hamiltonian dynamics, Hamilton–Jacobi–Bellman equations, Neural ODEs, reinforcement learning, Markov decision processes, Bellman equations, model-based and model-free algorithms, generative models, and much more.
The focus throughout the book is mathematical. It is well organized and the exposition is accessible, although some basic mathematical background is naturally required. For me, it is another useful reference for anyone interested in the mathematics behind these systems. I recommend downloading it and keeping it in your personal reference library.
https://t.co/7A75Ii3jv6
Hierarchical Latent Reasoning for LLM-based Recommendation
Organizes LLM latent reasoning states into a coarse-to-fine hierarchy of user preferences and optimizes them with layer-aware GRPO rewards for better recommendation.
📝 https://t.co/lnB8nYDooQ
👨🏽💻 https://t.co/MwPruVIMwO
Learning from the Future: Privileged Self-Distillation for Sequential Recommendation
Alibaba uses future interactions as training-only supervision to distill privileged knowledge into a causal student model.
📝 https://t.co/5FEuFse9lm
IMFuse: Instance-Aware Multi-Layer Fusion for LLM-Enhanced Sequential Recommendation
Adaptively fuses multiple LLM layers, not just the final one, using global and item-specific weights to enrich sequential recommendation.
📝 https://t.co/plr0UmWxso
UniRank: Benchmarking Ranking Models for Unified Sequential Modeling and Feature Interaction
Presents an open benchmark that unifies sequential modeling and feature interaction for ranking models, evaluating 15 architectures
📝 https://t.co/alnTuvrDre
👨🏽💻 https://t.co/QSyhnM7w3H
TSGR: Taobao Search Generative Retrieval
Alibaba presents a unified generative retrieval framework that embeds business value into both item representation and candidate ranking, letting a single model serve as retriever and pre-ranker for search.
📝 https://t.co/mGRp4tqFy7
Stanford professor just released the lecture that explains the math behind every reinforcement learning system.
83 minutes. Free. From Stanford.
Before agents learn to trade, optimize, or make decisions, they all start with the same problem:
How do you choose the best action when the future is uncertain?
This lecture breaks down the foundation:
• turning environments into Markov Decision Processes
• policy evaluation and why value functions matter
• Q-value recurrence equations behind modern RL
• value iteration and convergence limits
Every RL algorithm built today is just a variation of these ideas.
The math has been public for decades.
The hard part was never knowing the Bellman equation.
The hard part is knowing when your model actually understands the environment and when it is just fitting noise.
Bookmark this before it gets buried in your feed.
How can an LLM switch between low-, medium-, and high-effort reasoning? And how does an LLM learn to reason more or less?
I put together a “little” article explaining how these effort levels are implemented at inference time and during training.
Long-term User Engagement Optimization through Model-agnostic Downstream Rewards Learning
Pinterest introduces a model-agnostic downstream reward framework using proxy signals to optimize long-term user retention across multiple ranking surfaces.
📝 https://t.co/WUx8V07e3s
SlimPer: Make Personalization Model Slim and Smart
Meta presents a recommendation architecture that reformulates ranking as iterative refinement of a compact knowledge base instead of transformer-style sequence modeling, deployed on IG Reels and Feed.
📝 https://t.co/abiOrhTK1i
From Raw IDs to Semantic Planning: How Recommender Systems Utilize Information at Scale
Huawei traces how recommenders evolved from raw IDs to semantic IDs & proposes semantic planning, where the system first predicts what an exposure should accomplish
📝https://t.co/M34XtS1EMl
A Visual Introduction to Information Theory
(bookmark it)
Information Theory is such an beautiful and powerful subject.
In the era of AI, it's worth spending time learning about it.
Here is a highly-recommended read for anyone who wants real intuition for entropy and mutual information.
It's a visual, intuition-first guide to information theory.
It assumes only familiarity with basic probability, so it stays accessible while still reaching the fundamental limits of compression and transmission.
Paper: https://t.co/ydLqsF9ag8
Learn to build effective AI agents in our academy: https://t.co/1e8RZKs4uX
PEOPLE ARE PAYING FOR AI ENGINEERING BOOTCAMPS BUILT FROM THIS EXACT MATERIAL.
Andrew Ng gave 3 hours of it away free.
00:00 Building agentic AI systems
04:25 Where AI engineering is actually headed
23:38 The full prompting course
2:52:17 Building an app with AI in 30 minutes
The man who taught 8 million people AI just handed you the 2026 curriculum for free.
Watch it, then read the self improving system guide below.
Follow @cyrilXBT
GR2 Technical Report
Meta presents an LLM-based reasoning re-ranker combining semantic-ID mid-training, reasoning-trace distillation, and RL with verifiable rewards for recommendation re-ranking.
📝 https://t.co/yed8F0roPP
Anthropic engineer:
"You can build 5 assistants in one afternoon. Each one handles a task you've been doing manually every single day."
In 45 minutes he shows exactly how to do it from scratch, step by step.
Most people are still doing all of this by hand.
Watch the session, then save the guide below.
“Loop engineering” is a hot buzzphrase after mentions of it by Boris Cherny (Claude Code’s creator) and Peter Steinberger (OpenClaw's creator) went viral on social media. Loops are now a key part of how we get AI agents to iterate at length to build software. In this letter, I’d like to share my 3 key loops, shown in the image below, for building 0-to-1 products. These loops guide not just how I build software, but also how I decide what software to build.
Agentic coding loop: Given a product specification and optionally a set of evals (that is, a dataset against which to measure performance), we can have an AI agent write code, test its work, and keep iterating until the code is bug-free and meets its specification. This idea of closing the loop took off around the end of last year, and it has been a game changer in enabling coding agents to work longer productively without human intervention. For example, over the weekend, I was building an app for my daughter to practice typing, and my coding agent could easily work for around an hour, using a web browser to check what it had built multiple times before getting back to me, without needing my intervention.
The engineering loop executes quickly. Every few minutes, the coding agent might build and test a new version of the software. I hear frequently from developers who are finding new ways to engineer more effective engineering loops. This is an active area of invention!
Developer feedback loop: In this loop, a developer examines the current product and steers the coding agent to improve it. Last year, a lot of developers (including me) were acting as the QA (quality assurance) function for our coding agents, manually finding bugs and then asking the agent to fix them. But with coding agents much more able to test their own code, the amount of time we need to spend on this function has decreased significantly. This allows us to make higher-level product decisions, such as what key features to offer, where the UI needs improvement, and so on.
The developer-feedback loop operates over time intervals between tens of minutes and hours — that's how frequently a developer might review a product and give feedback. In the case of the typing app, I changed my mind a few times about the visual design, what cat costumes she can unlock as she learns (she loves cats), and the user flow for a grown-up to log in and steer the child's learning experience.
When a developer has a clear vision for what to build, it is still a lot of work to translate that vision into a specification for a coding agent to implement. Further, after the developer has seen an implementation, they might update (or perhaps clarify) the spec to steer it toward what they want. If you find that the system repeatedly runs into certain problems, building a set of evals for the agent becomes useful.
AI-native teams are increasingly using AI to help shape product direction, for example, automating the gathering and analysis of usage data, summarizing written and verbal customer feedback, or carrying out competitive analysis. However, for pretty much all the products I’m involved in, I see humans as having a significant context advantage over current AI systems — we know a lot more than the AI system about the users and the context the product has to operate in — and thus humans play a critical role. Many people describe this human contribution as “taste,” but I prefer to think of it as humans having a context advantage, since that gives us a clearer path to helping AI systems get better. This also speaks to why this step can’t be automated: So long as the human knows something the AI does not, human-in-the-loop is needed to to inject that knowledge into the system.
External feedback loop: This includes a wide range of tactics like asking a few friends for feedback, launching to alpha testers, or putting the code into production with A/B testing. These tactics are usually slow, rarely taking less than hours and sometimes taking days or even weeks. This data informs the developer vision, which in turn continues to drive the detailed product spec, which in turn drives the coding agent.
With coding agents speeding up software development, more engineers are starting to play a partial product management role. For many engineers who are growing into this role, the hardest part is shaping the product vision and striking a balance between building (bridging the gap between vision and spec) and getting user feedback to evolve the vision. It is important to do both!
I will write more about how to do this in future posts, but for now, I find it encouraging that engineers are playing an expanded role (just as product managers and designers now do more engineering).
[Original text: The Batch]