Building a Moat: Self Learning Agents (12 minute read)
Summary
The article discusses a method for building self-learning agents by combining agent traces with in-browser user activity, using the AG-UI protocol to capture and apply learnings, enabling products to improve through usage and create a business moat.
View Cached Full Text
Cached at: 07/09/26, 07:38 AM
Self-learning agents should combine agent traces with in-browser user activity to capture both AI failures and human corrections. CopilotKit uses the AG-UI protocol to turn these interactions into procedural and episodic memory, allowing agents to improve over time while keeping learning scoped by user, team, or application.
Building a Moat: Self Learning Agents
Self-improvement is the new moat, allowing product companies to go beyond wrapping LLM APIs.
There are two places to harvest this learning: **browser activity **(what users actually do in applications) and **agent traces **(what your agent actually did).
If done correctly, your product can improve simply by being used.
Your product might have hundreds, thousands, or millions of agent-user interactions every day. That is a goldmine of data.
Today, however, most of that value goes uncaptured.
Your users “teach” the agent and that “lesson” just disappears.
Capturing data signals is a compounding asset.
But capturing is not enough – the agent still has to use it without drowning in context. Models have a limited attention budget, and stuffing the context with everything is not the solution…
Article overview
We’ll walk through self-improving agents you can build a business moat around, including:
-
Learning from agent-traces & in-browser activity
-
Where learnings can be applied: model weights, the harness, and context
-
The** **different kinds of learnings: procedural, semantic, episodic
-
Data privacy: keep your users data safe
-
Data ownership: build a business moat
-
Practical tips for easily implementing self-learning for any agent, using AG-UI
We’re releasing our Self-Learning solution in the coming weeks.
Sign up here for early access and design partnership.
Your agent should learn from 2 places
Agents should learn from agent-traces, and from ambient in-browser activity.
Most approaches to learning only use one or the other, but products that leverage both will significantly outperform those who don’t.
1. Agent Traces
The agent runs and every step gets logged as a trace. What it was asked, which tools it called, what came back, where it failed.
Point another agent at those traces, and it finds the failure patterns and rewrites the prompts, tools, and instructions.
The missing half: Anything outside of the agent interaction, where most activity still takes place.
2. In-browser ambient user activity
Aka, watching the user.
Their clicks, edits, responses, and workflows.
Brex built their onboarding this way. They watched their analysts work and fed every human correction back as a training signal.
Each human fix creates a labeled data point that sharpens the next run.
The missing half: This method sees the human perfectly. But it knows nothing about what the agent tried or why it failed.
You should be capturing both signals
How? Or better yet, where?
There’s one place in almost every single product today that sees both simultaneously: the surface where the person and the agent work side by side.
Aka, the interface.
The how is via the Agent-User Interaction Protocol (AG-UI): an open standard that streams every event between your app, your users, and the agent. More on why that matters below.
Where the learning can be applied
There are three places, each with their own tradeoffs.
→ Model weights: Fine-tune the lesson into the model itself.
→ Harness: Everything around the model. The cycle it follows, the tools it’s allowed to call, the checks that catch it before it acts.
→ In-context: Add the new information straight into the prompt. The agent reads it on every call.
I covered all 10 approaches across these three layers in the first article ↓
Santiago@svpino·Jun 26How to build an agent that gets better over time:
There are 3 areas an agent can learn from:
-
The model: Only works for code and math, where a computer can score right vs. wrong. Leave this to the big labs.
-
The harness: These are the steps, tools, and safety checks youShow moreQuoteAtai Barkai@ataiiam·Jun 24 ArticleSelf Learning for Agents Clearly ExplainedThe self-learning agent that everyone’s talking about is not the one your product needs. The most useful signal of all is actually one that almost nobody captures: the people using your product. Your…343311.9K174K
The different kinds of learnings
There are three main types that will help your agents improve over time.
1. Procedural (workflows/how to do things)
Procedural memory is what many of us include in skills or agents.md files:
Learned workflows and rules for getting a task done.
For example: A manager approving an over-limit refund for a loyal customer. The agent learns this and does the same next time.
**Pro: **The agent handles the same case the same way every time. Consistent and independent. Con: If it learns the wrong workflow, it’ll do the wrong thing confidently, every time.
2. Episodic (things that happened)
A record of specific past events and interactions.
For example: “On January 5th, Joe Jonas’s refund bounced because his card had expired.”
Pro: A real past case beats an abstract rule. The agent sees how it played out and copies what worked. Con: Most past cases are useless noise. Someone has to go through and keep only the ones worth remembering or the useful one gets buried.
3. Semantic (the facts)
Stable facts the agent should know.
**For example: **“All credit card plans have some limit, but the limit varies by plan”
Pro: Reusable everywhere. A fact is a fact. Con: Goes stale without warning. The day the limit changes, the agent is confidently wrong and acts on it anyway.
Self-learning in action via CopilotKit Intelligence and AG-UI
Self-learning in action via CopilotKit Intelligence and AG-UI
Semantic keeps what’s true.
Episodic keeps the case that happened.
Procedural keeps the rule for handling it.
The flow journey from agent-user interaction to self-learning
The flow journey from agent-user interaction to self-learning
Owning the loop yourself & building a moat
The learning data is the most important part of your product, and it will become increasingly valuable as the cost of creating software from scratch goes down.
Owning the learning data allows you to become more than a wrapper of an LLM API.
The agent’s miss and the human’s fix usually end up in two different places. And nobody connects them.
The surface for doing so already exists inside your product: the interface.
Trace tools see only the agent.
Ambient tools, the kind that watch the browser, see only the human, and invade privacy to get it.
But CopilotKit sees both signals.
CopilotKit reads the events flowing through your app: every tool call, state change, approval, and edit, from both the agent and the person using it.
It does this through AG-UI (Agent-User Interaction Protocol) which carries every event between your app, your users, and the agent in real time.
Now the agent’s attempt and the human’s fix arrive in the same stream.
AG-UI works with any agent & any harness
AG-UI is an open standard that’s framework-agnostic.
It’s been adopted by AWS, Google, Microsoft, Oracle, LangChain, Mastra, Pydantic AI, CrewAI, LlamaIndex and more.
AG-UI sees the events and injects the learned context straight into the agent, whatever that agent’s own harness looks like underneath.
That means the same **learning applies to any agent **you bring on, today or next year, automatically, with no custom integration work for each new one.
One of our customers runs a UI that talks to CopilotKit’s agent + Google ADK + Microsoft Agent Framework, and all memories are shared across all three.
Memory detached from framework choice = portability
Everything runs on your infra so you own the learning
CopilotKit Intelligence self-hosts on your own Kubernetes cluster. Full data sovereignty, SOC 2 Type II, air-gapped deployment if you need it.
The data stays with you. So does everything the agent learns from it.
Everyone else’s approach either keeps your learning in their cloud or like Meta’s, takes surveillance to get it.
@CopilotKit Intelligence is live in production at Fortune 500s today, and open for early access. If you want your agent to get better the more people use it, reach out.
Learning Containers: deciding “who” gets the new learnings
As soon as you enable learning in your product, the question arises: how far does the learning extend? Sensitive facts from one user should not leak into another user’s agent context.
CopilotKit’s solution is Learning Containers: developer-friendly scopes that you can control, deciding how ‘far’ each lesson spreads.
CopilotKit allows you to easily define learning containers for different cohorts of users:
-
Per-user. Like specific preferences.
-
Per-team. Like approval procedures.
-
Per-app. Like company-wide rules.
Learning container are fully auditable. You can see exactly what was learned and which container it landed in.
There’s a lot more to this.
Recently, we held an in-depth livestream going over everything I just mentioned.
Watch the full recording here.
Summary in a nutshell
Share this graphic with your network as a TL;DR
Share this graphic with your network as a TL;DR
@CopilotKit Intelligence is already running this in production inside large enterprises, and it’s open for **early access. **
If you want an agent that gets better the more your users use it, reach out and we’ll get you in.
Follow @ataiiam for more.
Similar Articles
@ataiiam: Self-learning is the new moat There are two places to harvest learnings: 1/ browser activity (what users do) 2/ agent t…
The tweet discusses the concept of self-learning as a competitive moat, highlighting browser activity and agent traces as key data sources, and introduces AG-UI, an open standard for capturing user-agent interactions to improve products.
@svpino: How you can build a moat with self-learning agents: If you can build an agent that gets better every time people use it…
A Twitter thread offering strategic advice on building self-learning agents that improve with use, covering dual learning sources, memory types, and data ownership.
@qinzytech: https://x.com/qinzytech/status/2066585405479371092
A technical analysis of two approaches to building self-evolving AI agents: model-based (via architecture like SSMs or transformer with fast-weight updates, and training methods) and harness-based (via memory or meta harness that can rewrite itself). The author provides practical recommendations for different audiences.
Learning to Adapt: Self-Improving Web Agent via Cognitive-Aware Exploration
Proposes SCALE, a framework for self-improving web agents using cognitive-aware exploration with three adversarial roles and a graph exploration strategy. Also introduces a large-scale dataset SCALE-20k from real websites, showing significant improvements in MLLM-based web agents.
@DeRonin_: How to naturally build your own self-improving agents: a self-improving agent learns from its own mistakes and rewrites…
A practical guide explaining three levels of building self-improving AI agents, from manual loops to automated design, with recommended tools and frameworks.