# Bridgewater PAT - Compiling Research into Deterministic Agents
Bridgewater's "Pocket Analyst" (PAT), presented at Interrupt 2026, is the most complete public example I have seen of an agent system designed around ==correctness as an architectural property== rather than a prompting outcome. It does hours of expert macro research in minutes, and the interesting part is not the output. It is that they treated the analyst workflow as a compiler problem.
Three headline claims from the talk: isolate agents to get specialisation, automate *actual* user workflows rather than building generic "powerful" agents, and agentic coding loves compilers. Everything else is downstream of those.
## The architecture in one pass
```mermaid
graph LR
U[User] --> C[Chat Agent]
C --> DS[Data Series Search]
C --> US[Unstructured Search]
C --> CA[Coding Agent]
CA --> P[Analysis Plan]
P --> G[Codegen: N parallel LLMs]
G --> E[Execution Loop]
E --> R[Interactive Report]
R --> F[Teach PAT / Flywheel]
F --> C
```
A thin chat agent holds the conversation and owns nothing else. It dispatches to three tools: structured data-series search, unstructured search, and a coding agent. The coding agent is where the real machinery lives, and it has exactly three phases: **Analysis Plan → Codegen → Execution Loop**.
## Insight 1: the plan is a typed program, not a to-do list
This is the load-bearing idea. Their framing:
> [!quote] Analysis Plan takeaways
> - Plan specifies deterministic python semantics
> - Task == "function type signature"
> - Plan == "natural language python project"
> - Opens the door to compiler techniques
Most agent "planning" produces prose steps that the model reinterprets at execution time — which is why it drifts. Bridgewater's plan is a DAG of typed nodes. A node like `Calc Asset Price Moves` declares the dataframe it emits, its name, its description, and every column with a semantic description (`price_move: price move in the week after war event`). That is a function signature written in natural language.
Once your plan is a typed program, the entire compiler toolbox becomes available: static analysis, dependency analysis, value caching, optimisation passes, target code generation. See [[Compiler Phases]] — the mapping is almost one-to-one. The plan is the intermediate representation; the LLM is a very expensive code generator sitting in the middle of an otherwise deterministic pipeline.
**The generalisable rule:** move ambiguity as early in the pipeline as possible and freeze it into types. Every ambiguity you resolve at plan time is an ambiguity that cannot resurface as a hallucination at execution time.
## Insight 2: isolation buys specialisation and parallelism
The plan's nodes group into three tiers — Load Data, Transform Data, Visualisations — and each node is handed to its own LLM (`LLM 1..5`) which writes one code snippet. No shared context, no shared conversation.
Two things fall out of this. Speed: five nodes generate concurrently rather than one agent writing a 400-line script serially. Quality: each call has a tiny, unambiguous brief with a declared input and output type, so the surface area for error collapses. This is the opposite of the industry default of one big context-stuffed agent, and it is the same argument as [[Agent Skills as Codified Domain Expertise]] — narrow, well-specified units outperform general capability on real work.
## Insight 3: correctness is enforced by the harness, not the model
The Python Execution Harness runs **Static Analysis → Dependency Analysis → Python Caching Harness → Execution Harness**, wrapped in a loop of Execute → Validate → Edit Code, with a dedicated Validator Agent and a separate Debugger Agent.
> [!important] The number that matters
> **95% output determinism** in their test suite. Reproducible → much higher accuracy.
Determinism is treated as a *precondition* for accuracy, not a nice-to-have. The reasoning is sound: if the same prompt produces a different DAG-of-numbers each run, you cannot evaluate, cannot debug, cannot build trust, and cannot let a portfolio manager act on it. Non-determinism destroys the ability to accumulate improvements — every fix is unfalsifiable.
For anyone building in regulated or high-stakes domains, this is the line to steal: ==the model proposes, the harness disposes==. The validator and debugger are separate agents from the generator precisely so that no single context can talk itself into believing it succeeded. This is [[AI Verification]] implemented as runtime plumbing rather than as a post-hoc eval, and it makes [[Evals]] cheap because runs are comparable.
Caching in Python is the underrated piece. Value caching means an edit to node 4 does not re-run nodes 1-3. The debug loop becomes fast enough to be worth running many times, which is what actually makes self-correction work.
## Insight 4: the agent negotiates the question before answering it
Before execution, PAT surfaces a **Prompt Requires Clarifications** panel — a short set of structured multiple-choice questions, each with a RECOMMENDED option, a custom field, and a skip. Example: *"The four episodes had very different raw oil moves, so unscaled returns aren't directly comparable. Should I scale all returns to a common oil shock size?"*
Three things worth copying:
1. **The question is a methodology decision, not a clarification of intent.** It is exactly what a good junior analyst would raise with a PM. The agent is demonstrating domain judgement by knowing what is contestable.
2. **It is closed-form and pre-decided.** Multiple choice with a recommendation costs the user five seconds, not five minutes of typing. Skippable, so the expert user is never blocked.
3. **It happens at plan time.** The answer becomes a constraint compiled into the plan, so it cannot be quietly forgotten mid-run.
This is the practical answer to "how much human-in-the-loop?" — put the human at the point of *irreversible methodological choice*, and nowhere else.
## Insight 5: grounding on structured data is its own hard problem
The Structured Data Search phase shows sub-agents hunting the series catalog for "US output gap or slack measure", "US core CPI level index excluding food and energy", "US net goods trade balance" — and then *verifying* each candidate: frequency, date range, point count, units, annualisation factor, whether it is the raw reported series or the tax-adjusted extended one. Where no pre-computed series exists (net goods trade balance) it constructs one from components and states why.
This is the unglamorous 80% of any [[AI native hedge fund moc|AI-native investment]] system. The reasoning layer is commoditising; the ability to resolve "output gap" to the *correct* internal flatcode with the right vintage and units is proprietary and compounding. It is a [[Data Moat]] expressed as a retrieval-and-verification problem. See also [[Context Layers MOC]] — this is the context layer doing real work rather than dumping documents into a window.
## Insight 6: the flywheel is taught, not trained
The final step is **Teach PAT**. When the output is wrong, the user writes what PAT should have learned — and the example on screen is not a correction of a number, it is a correction of *method*:
> When looking at relationships across case studies of historical episodes, it's helpful to break the analysis out by asset class — not just an aggregate view... For future analyses of this kind, I should default to producing per-asset-class scatter panels alongside the aggregate view.
Note the guardrail: *"Only this text will be sent. No chat history, analysis plans, or data is included."* Learning is captured as portable, reviewable, non-sensitive methodology text. That is a design decision about institutional trust as much as about ML.
This is the Bridgewater research loop — Perception → Hypothesis → Investigation → Synthesis → Industrialisation, rotating around **Methodologies** and **Our Shared Memory** — being made machine-readable. The agent is being inducted into the firm's shared memory the same way a junior analyst is. See [[Data Flywheel]] and [[Persistent Memory]]; the artefact accumulating value here is a corpus of *methodological lessons*, which is far more defensible than a corpus of prompts.
## Insight 7: entitlements live in the system prompt
A small slide with big implications: PAT's system prompt is composed of a Baseline Context + Baseline Tools that everyone gets, and Secure Context + Secure Tools that only entitled users get. Same agent, different assembled capability surface per user.
The lesson: agent capability must be a function of the caller's entitlements, resolved at prompt-assembly time. Retrofitting this later is close to impossible, and for regulated firms it is the difference between a demo and production.
## What I'd carry into anything I build
> [!tip] Transferable principles
> 1. **Compile, don't converse.** Turn intent into a typed plan; let deterministic machinery do the rest.
> 2. **Types at the boundaries.** Every task declares its output schema with semantic column descriptions.
> 3. **One agent, one job.** Isolation for specialisation and parallelism, not one heroic generalist.
> 4. **Separate the generator, the validator, and the debugger.** Never let one context grade its own work.
> 5. **Determinism first.** Without reproducibility you have no evals, no debugging, no trust, no compounding.
> 6. **Cache aggressively** so the correction loop is cheap enough to run often.
> 7. **Ask about methodology, at plan time, in closed form, with a recommendation.**
> 8. **Automate a real workflow.** "Powerful generic agent" is a euphemism for unowned scope.
> 9. **Capture learning as portable method text**, scrubbed of data, reviewable by a human.
The strategic read: as base models converge, the moat moves to the *harness* — the plan representation, the type system, the verification loop, the data resolution layer, and the accumulated methodology memory. That is consistent with [[AI era Defensibility]] and [[Where Domain Evals Matter Most]]. Bridgewater is not betting on a better model. They are betting that the compiler around the model is the durable asset.
Links:
- [[AI Agents Stack]]
- [[How to build agents]]
- [[Autonomous Agents]]
- [[Embracing the Agentic Engineering Era]]
- [[Agent Skills as Codified Domain Expertise]]
- [[AI Verification]]
- [[Evals]]
- [[Where Domain Evals Matter Most]]
- [[Compiler Phases]]
- [[Context Layers MOC]]
- [[Data Flywheel]]
- [[Persistent Memory]]
- [[Data Moat]]
- [[AI era Defensibility]]
- [[AI native hedge fund moc]]
Source: *How Bridgewater Built an AI Analyst That Does Hours of Expert Research in Minutes* — Interrupt 2026 (LangChain), talk slides.