Home

Social learning

I've been thinking about a concept for a multi-agent system for a few weeks now, and it starts with chimpanzees.

In 2025 Nodé-Langlois et al. published a study in Nature that documented ~2,300 "peering" events among 35 wild juvenile chimpanzees learning to crack nuts, a task that requires 10 to 15 years for chimpanzees to master. They found that after a failed attempt, the probability that it subsequently observed a skilled individual roughly doubled. 20 minutes into struggling and failing, the odds of a juvenile stopping and watching an expert was around 60%, and after 40 minutes it was 75%. Failure caused them to switch from first-hand trial and error to a social approach.

Young chimps don't over-index on a single individual either, they observe around 12 different role models while they're learning. Early on they watch their mothers almost exclusively (over 80% in their first year), but by year nine, less than 20% of their observations target a caregiver. They basically build their own curriculum by watching the varied approaches of a curated peer group. They learn from a local community.

If you think about how we build agents, this isn't really a paradigm yet.

A lot of agent frameworks/patterns like GEPA, ACE, AGoT etc, are fundamentally self referential. Agents learn from their execution traces and when they fail a tool-use task, they may reflect on their own reasoning, tool calls, errors, and adjust. But they don't actually look at how other agents succeeded and learn from their solutions.

Millions of agents are solving problems, but they lack any way to learn from each other.

Failure-Triggered Social Learning

As of late I've been thinking about a pattern or architecture for this concept of failure-triggered social learning, something biomimetic with primates as the reference.

Imagine for a moment a system operating thousands of programming agents. When an agent fails to solve a bug, write executable scripts, or even fails to call a function properly, the agent calls a tool that lets it find traces of similar tasks that have run before in the agent network. It requests by providing the current situation, and similar traces are provided with a brief description of the issue and solution, ranked by quality via an eval system. The agent recovering from its failure then calls a few more tools to inspect the traces, reasoning, toolcalls, and solutions of the higher-scoring agents that tackled a similar problem. In doing so, they find approaches that've already been solved by different parts of the system, connected by this central registry of evaluated traces that are available to any agent in the network. Successful patterns emerge over time, and any agent can benefit from the work of the entire network.

Following the ~12 role model principle from the Nodé-Langlois research, the agent retrieves a dozen varied successful demonstrations. Not just the single best performer, but a range of approaches. Different agents may have solved the same problem through different reasoning paths, and that variety is what enables robust pattern extraction.

01Failure is the trigger, the commons is the teacher
Shared trace commonsEvaluated runs fromevery agentAttempt: Work alone firstAttemptWork alone firstSearch: Similar tasks, ranked by eval scoreSearchSimilar tasks, ranked by evalscoreWatch: About 12 varied successes, not oneWatchAbout 12 varied successes, notoneRevise: Resubmit with what changedReviseResubmit with what changedFail: The trigger to lookFailThe trigger to lookContribute: A pass joins the commonsContributeA pass joins the commons
One agent's recovery. The last step is what makes it social rather than retrieval: a solved run is written back, ranked, and becomes a demonstration for the next agent that fails.

Why Biomimicry

Animal intelligence is a deeply underutilized source of architectural inspiration for AI systems. We tend to look at neural architecture (neural networks, attention mechanisms) and occasionally at evolutionary dynamics (genetic algorithms, population-based training). But the behavioral ecology of social learning has been largely ignored.

Primates solved the problem of transmitting complex, multi-step tool-use skills across populations millions of years before we started building agents. It was selective, failure-driven, socially-mediated observational learning distributed across diverse role models within tolerant communities. The architecture is elegant because it was refined by evolutionary pressure over deep time.

The key insight from the primatology research is that some skills are individually uninnovatable. Van Leeuwen and colleagues (2024, Nature Human Behaviour) tested this directly, asking whether chimpanzees could use social learning to acquire know-how they had demonstrably failed to innovate on their own, which is actually a capacity previously claimed to be uniquely human. They exposed 66 chimpanzees across two groups to a puzzle box and all materials needed to solve it for three months, and none figured it out independently. Then one chimpanzee per group was taught the solution and returned to the group. Within weeks, 14 naive chimpanzees had learned to operate the box through social observation alone. When we build autotelic agents that can only learn from themselves, we are architecturally guaranteeing that certain classes of tool-use skill will remain out of reach, no matter how many individual attempts an agent makes.

Making It Work

First, you need a shared execution trace repository, a commons where agent sessions are stored in structured, machine-readable formats. This includes reasoning steps, context states, tool calls, parameters, and outcomes. Something like traces.io is a great demonstration of what this should probably look like.

Traces is a CLI tool and network for sharing execution histories from coding agents (Cursor, Claude, Codex, Gemini CLI, and others). It makes agent sessions shareable, discoverable, and browsable. People are already attaching trace links to pull requests, providing context on how problems were approached.

Right now, Traces is designed for human collaboration, developers learning from each other's agent sessions. But the infrastructure it provides is remarkably close to what social peering would require: a searchable network of structured agent execution histories with discoverability. If agents could query that network autonomously after failures, you'd have the foundation for a social learning commons.

Second, you need query infrastructure so that agents can search this repository after failures, filtering for successful demonstrations of the same or similar tasks. Semantic/vector search could be useful in finding similar situations.

Third, you need an evaluation system to measure and rank the quality of solutions, so that high-quality, successful traces surface above failing or low-quality solutions.

02Three pieces under the agents
AgentsAgentsFail, then queryCoding agentsTool callersScript writersQueryQueryFind similar situationsSemantic searchKeyword searchFilter to successesEvaluationEvaluationRank what surfacesScore each runSuccesses above failuresTrace commonsTrace commonsStructured,machine-readableReasoning stepsContext statesTool calls and parametersOutcomesSharedinfrastructure
What a network needs before any agent can peer. In the proof of concept each layer is one choice: SQLite with FTS5 for the store, BM25 plus success and score for the query, and a pass or fail on exact output for the eval.

A Proof of Concept

To test whether failure-triggered social peering actually works in practice, I built a minimal implementation. The setup is deliberately constrained: a single coding task, a local SQLite trace store, and a handful of models ranging from frontier to small open-weight.

The task is a Rust bytecode VM with branching. The agent must write a complete standalone Rust program, from scratch, that parses a small expression language supporting let bindings, integer arithmetic with correct precedence (including right-associative exponentiation), comparisons, unary minus, nested if-expressions, and built-in max/min functions, then compiles it to bytecode and executes it on a stack VM. The program must produce exact expected output. This is a multi-step systems programming problem that requires coordinating a parser, a compiler, and a virtual machine in a single file.

The architecture has three components. First, a trace store: a SQLite database with full-text search (FTS5) across task descriptions, trace titles, summaries, and tags. Every agent run is recorded step by step: system prompt, user message, each assistant response, every tool call with its input and output. Second, three tools exposed to the agent: compile_code (compile and execute Rust), search_traces (keyword search over prior runs, ranked by success, score, and BM25 relevance), and view_trace (retrieve the complete step-by-step reasoning of a prior run, including the source code that was submitted). Third, a system prompt addendum that instructs the social agent to compile first, search on failure, inspect a successful trace, then revise and resubmit.

The experimental protocol seeds the trace store with successful runs from a strong model (gpt-5.4), which solves the task reliably in a single compile attempt without social tools. Then a weaker model attempts the same task with social tools enabled.

Qwen3.5-9b, a 9-billion-parameter open-weight model, fails at this task when working alone. The run in the trace store scored 0/100, meaning compilation totally failed. But with search_traces and view_trace available, the run tells a different story. The agent submits code, compilation fails, it calls search_traces with relevant keywords, finds five prior successful traces, calls view_trace on a previous run (a successful qwen3.5-27b solution), and on its second compile attempt produces correct output. The sequence of tool calls in that run is exactly the pattern the architecture predicts: compile_code (fail), search_traces, view_trace, compile_code (pass).

03Compile, fail, search, watch, pass
Failure triggers the lookupRevise and resubmit1. Qwen3.5-9b → compile_code: Submit program1Submit program2. compile_code → Qwen3.5-9b: Does not compile2Does not compile3. Qwen3.5-9b → Trace store: search_traces3search_traces4. Trace store → Qwen3.5-9b: Five prior passes, 27b first4Five prior passes, 27b first5. Qwen3.5-9b → Trace store: view_trace, run 185view_trace, run 186. Trace store → Qwen3.5-9b: Reasoning, tool calls, source6Reasoning, tool calls, source7. Qwen3.5-9b → compile_code: Submit revised program7Submit revised program8. compile_code → Qwen3.5-9b: Exact output, 1008Exact output, 100Qwen3.5-9bSocial tools oncompile_codeRust compiler and runnerTrace storeSQLite, FTS5
Run 30, Qwen3.5-9b with social tools. It searched the store, opened run 18, a Qwen3.5-27b solution that passed on its first compile, and passed on its own second compile.

This is a small model doing what the chimps do. It tries, it fails, and then instead of trying harder, it watches smarter. It finds a successful demonstration, studies the full reasoning trace including the actual source code that worked, identifies what it needs to change, and succeeds on the next attempt. The failure triggered the social lookup. The social lookup provided the missing knowledge. The knowledge closed the gap.

That run was not a fluke, but it was not the rule either. I went back through the trace store. Alone, Qwen3.5-9b passed 0 of 24 attempts. With the social tools it passed 4 of 10. Ten runs is too few to call a rate, but zero was not the ceiling. The split inside those ten matters more: the agents that opened a trace and recompiled passed 4 of 7, and the three that never opened one passed none.

04Alone it never passed; watching, it sometimes did
Qwen3.5-9b
Alone0 of 24Up to four compiles each
With social tools4 of 10from 0
Social runs, by what the agent did
Watched, then recompiled4 of 7
Never watched0 of 3Two searched only, one never searched
Qwen3.5-9b on the bytecode VM task, March 25. Runs 31 to 54 had no social tools; runs 55 to 64 had search_traces and view_trace. The bottom row splits the ten social runs by whether the agent opened a trace and recompiled after it. Ten runs is too few for a rate; it is enough to say zero is not the ceiling.

The store also records which trace each agent opened, so I can see where the skill came from. It did not come from the strong model. Search ranked a Qwen3.5-27b run first, and the 9b agents that passed learned from it, or from each other. Run 58 watched run 30, run 59 watched run 58, and run 61 watched run 60, which had watched the 27b run. The one 9b run that opened a gpt-5.4 trace failed. One run that knew how to do it, and then the skill passed along second and third hand, is a small version of what the puzzle box chimpanzees did.

05The skill spread through small models
Run 18, 27b — Passed aloneRun 18, 27bPassed aloneRun 27 — Watched, never recompiledRun 27Watched, never recompiledRun 30 — PassedRun 30PassedRun 60 — PassedRun 60PassedRun 55 — FailedRun 55FailedRun 58 — PassedRun 58PassedRun 59 — PassedRun 59PassedRun 61 — PassedRun 61PassedRun 63 — FailedRun 63Failed
Who watched whom, from the view_trace calls in the store. Run 18 is Qwen3.5-27b; every other run is Qwen3.5-9b. Three of the five 9b passes learned from another 9b run that had itself learned by watching. The one 9b run that opened a gpt-5.4 trace, run 56, failed.

The POC is narrow by design. But it answers a core question: can an agent that cannot solve a problem alone solve it by observing another agent's successful execution trace?

There are really more questions than answers at this point though. What's the optimal latency between failure and peering? Should agents attempt self-recovery first, or peer immediately? How do you calibrate the threshold between persisting and seeking social references? These are questions worth exploring.

References Nodé-Langlois, M., et al. (2025). Social tolerance and role model diversity increase tool use learning opportunities across chimpanzee ontogeny. Communications Biology (Nature). https://www.nature.com/articles/s42003-025-07885-4

van Leeuwen, E. J. C., DeTroy, S. E., Haun, D. B. M., & Call, J. (2024). Chimpanzees use social information to acquire a skill they fail to innovate. Nature Human Behaviour. https://doi.org/10.1038/s41562-024-01836-5