Your agent has 2,000 tools.
Load the ones it will actually call.
Deja remembers, in a HydraDB graph, which tools past tasks actually needed: each task and the tools it used, which words led to which tools, and which tools get used together. A new task pulls the tools its most similar past tasks used; that memory is what beats tool search. Every task it serves makes the next loadout sharper. It learns only from tool calls that worked, says so when nothing in the catalog fits, and reads the live tool catalog from the graph, so a removed tool never comes back.
Gets sharper the more it is used
Share of tasks where every tool the agent ended up calling was already in its first loadout (2,000-token budget). Prequential: each task is scored before Deja learns from it. Buckets are log-spaced so the cold start is visible; band = 3 shuffles of the stream.
What does the work
This ablation learns from and scores every called tool. (The served model learns only from calls that worked; see the next section.) Memory of past tasks does most of the lifting. Deja keeps it in HydraDB as (:Task)-[:USED]->(:Tool): the 20 nearest past tasks to the task and to each of its steps vote for the tools they used. Votes only, that one-step lookup alone, already beats tool search by a wide margin. The full model adds two multi-step graph reads, a word hop and a co-use hop: about 0.5–1 point overall (shuffle 1: +0.8, 95% CI +0.5 to +1.2). In v4 the hops added 2.5 points; recalling each step of a task, which we gave the baseline too, now finds much of what the word hop used to. So the rest of the graph's job isn't ranking. It keeps the memory, every call's outcome, the quarantine and the live catalog in one store that the server, the learner and every planner read and write together. That is why loadouts rarely carry a broken tool and a removed tool is never served.
Learns only from calls that worked
12–15% of recorded tool calls returned an error (HTTP 4xx/5xx, missing API keys, crashes), and 21% of tasks contain a call that never succeeded. Counting those as "the tool this task needed" teaches Deja to recommend broken tools. The served model records each call's outcome as the edge type, (:Task)-[:USED]->(:Tool) for successes and (:Task)-[:FAILED]->(:Tool) for failures, and only successes vote. Scored on the tools that worked, it's as good or slightly better, and loadouts carrying a chronically broken tool (fails in ≥ 80% of the ≥ 10 tasks that call it) drop by more than half. It no longer loads tools whose calls failed, so the "every called tool" number falls; both are shown. Mean of 3 shuffles.
Knows when nothing fits
Toucan has no "no suitable tool" tasks, so we built them: hold out whole clusters of near-duplicate servers (3 seeds, ~37 servers each) and keep their tasks, but only where no remaining tool resembles any tool the task needed (a hand-checked substitute threshold). The abstain rule was fit on seed 1 and tested on seeds 2 and 3. Honest result: the signal is how close the nearest past task is. The graph signals we tried (vote agreement, server spread, co-use coherence) added nothing. What does help is remembering the tasks it couldn't serve: mostly when the same missing capability is asked for again, less for a brand-new gap. That needs a signal that a task went unserved, which the live demo doesn't have, so the page's abstain rule is the similarity one.
Tools come and go
The catalog itself is graph state: (:Catalog)-[:LISTS]->(:Tool). When a server drops a tool from tools/list, Deja deletes one edge, bumps the catalog's version so the server re-reads it, and every read stops returning that tool, whatever memory says.
Try it
Pick one of 200 tasks Deja never learned from (green = a tool that worked in the recorded run, red border = called but failed), click an example, or type your own. Left: Deja's loadout from HydraDB. Right: plain tool search, same budget.
The catalog is 2,236 tools from 367 community MCP servers: weather and time, calculators, Word documents, memory and note stores, image generation, research search (PubMed, Semantic Scholar, arXiv), Unity, Figma, games and trivia. No GitHub-issues or Slack servers, so tasks about those won't find much.
Use it with your agent
proxy.py is an MCP server in front of your real MCP servers. Your agent gets two tools: deja_load_tools(task) returns the loadout for the task, and deja_call(tool, arguments) forwards the call. Deja learns from the real calls into HydraDB: tools whose calls worked get USED edges, ones that only failed get FAILED and count toward quarantine, and the catalog is re-read from every server's tools/list at the start of each task. Tested end to end over stdio (learning, quarantine, a dropped tool, a restart) and in front of real servers; no real agent traffic has gone through it yet. Setup is in the README.
How it works
(:Task) -[:USED]-> (:Tool) every past task and the tools that worked for it
(:Task) -[:FAILED]-> (:Tool) calls that errored (recorded, never vote)
(:Catalog) -[:LISTS]-> (:Tool) the live tool catalog
(:Term {df}) -[:LED]-> (:Link {n}) -[:TO]-> (:Tool {uses}) a word in past tasks → the tool that solved them
(:Tool) -[:CO]-> (:CoLink {n}) -[:TO]-> (:Tool) tools used together in one task
- Query: embed the task. (1) Find the 20 most similar past tasks by embedding, then read their
USEDedges from HydraDB: they vote for tools. (2) Take the top 5 of that fused ranking and walkCOedges to the tools they're usually used with (about +1 point). (3) WalkLEDedges from the task's 8 rarest words. (4) Each step of a multi-step task ("…, then …") recalls its own 20 nearest past tasks, which vote the same way. Rank, with a small penalty for long tool definitions, and pack to the token budget. - Abstain: before ranking, a two-feature rule (closest past task, best tool match) decides: if nothing fits, load nothing and say why; otherwise Deja. Cold start: memory's weight ramps up over the first 400 tasks it learns, so a near-empty memory can't outvote plain tool search.
- Learning: after each task, a
Tasknode withUSED(worked) andFAILED(errored) edges is added, and the word and co-use counts update from the calls that worked. This per-task write path is checked against the in-memory twin too. - Store: counts live on reified Link nodes because HydraDB batch writes set node properties but not edge properties. The vote hop is an id-only batched read. Every loadout served here is checked identical to an in-memory twin on the 200 held-out tasks; the 8,612-task curves use that twin.
- Model choices (made on shuffle 1 only, not tuned per ordering): the base relevance is cosine + 0.15 × BM25 (0.05–0.35 tried); each of the 20 nearest past tasks votes with weight similarity⁸; word weight 0.5 and co-use weight 0.2 are unchanged from v1; step votes weigh 0.5 and the length penalty is 0.05 × ln(tokens). Votes only gets the same base, task and step votes, and the same length penalty; tool search gets the length penalty too.
- Data: Toucan-1.5M: real MCP servers, real executed tool calls. 8,612 unique prompts (one per prompt_id; only 36 duplicate question texts, 1.8% have an earlier task at cosine ≥ 0.95), 2,236 tools across 367 servers, pooled into one catalog.
With an agent in the loop
Under load
What we measured and threw away
- Shared entity memory ("reuse IDs other agents resolved") was our first headline. It failed its own kill test: binding precision 21%, and even a perfect binder saves only 6.3% of lookups beyond a plain (tool, args) cache.
- Synthetic questions, real execution: Toucan's questions were LLM-generated from each server's tools, so similar tasks recur by construction. That favours any past-task memory, ours and the baseline's; organic traffic may recur less. Deja is also not ahead of tool search for its first 100 tasks (the cold start: memory's weight ramps up over the first 400) and pulls ahead after that; see the curve.
- Graph signals for abstaining (how strongly the neighbours agree, how many servers their votes span, whether the top tools are linked by co-use) added nothing over plain similarity, so the abstain rule doesn't use them.
- Penalising unreliable tools on top of learning from successes cut broken tools to 3% of loadouts but cost 6 points; too blunt, dropped.
- Data-flow edges (a value from one tool's output reappearing in another's arguments) are real but rare: removing them changes the result by 0.1 points, so they aren't part of the claim.
- Our first shipped model (word and co-use edges only, 52%) lost to a plain past-task memory baseline (65%) once a reviewer added it. We rebuilt Deja around that memory; the v1 row stays on the chart.
- Tool chains in real traces are shallow: only 2.8% have 3+ calls linked by data flow, so one-hop traversals are enough.
- HydraDB's local-filesystem store can't publish index generations or hand a restarted node its write lease (no conditional PUT). Reads crawled until we moved it onto S3 (RustFS) with the indexer running.