# How Bridgewater Built an AI Analyst That Does Hours of Expert Research in Minutes
<!--
ref: @content/youtube/langchain/2026-07-24-how-bridgewater-built-an-ai-analyst-that-does-hours-of-expert-research
version: 2
updated_at: 2026-10-31T19:05:06.639Z
-->
From LangChain, 2026-07-24: Bridgewater spent 50 years writing its investment logic down in rules that both people and machines can read. That gave it the context an AI analyst needs without starting from scratch.
**[Watch on YouTube](https://www.youtube.com/watch?v=lXZb21CfeIY)**
*Synthesized from Brandon McManus, Michael Wren, and Santi White on LangChain, 2026-07-24.*
Brandon McManus leads the Applied AI team at Bridgewater Associates, a systematic macro hedge fund. He presents with Michael Wren, the project's investor lead, and Santi White, its technical lead, who has a background in compiler theory and programming language design. Together they walk through PAT ("Pocket Analyst Tool"), the internal research agent they built.
## Core Thesis
Bridgewater spent 50 years writing its investment logic down in rules that both people and machines can read. That gave it the context an AI analyst needs without starting from scratch. PAT turns this context into a narrow, heavily benchmarked research agent. Its plan works like a natural-language Python project, which the coding agent "compiles" into code that is deterministic, validated, and cached. Santi White argues that coding agents should be built like compilers, not as open-ended agentic systems, and that specialized agents you can rely on beat general-purpose ones that only demo well.
## Key Insights
- **Fifty years of written-down rules.** Brandon McManus traces Bridgewater's approach back to its 1980 bond system, written on a yellow legal pad. Every trade had to come with its causal rules written out, so other investors could critique and improve them. Over decades these rules grew into an expert system that people and machines can both read. The firm "didn't have to go back and write down everything for agents."
- **Two ways the firm approaches AI.** (1) As investors, it has to understand AI as a force in markets: supply-demand mismatch and the build-out. (2) As practitioners, it is working toward a full "artificial investor."
- **The research circle as a set of sub-agents.** Human investors perceive, ask questions, investigate, synthesize, and feed what they learn back into shared memory. Bridgewater is building a separate sub-agent for each stage. PAT covers the *investigation* stage: analysis that takes human analysts days or weeks. PAT is for deep exploratory research, not for trading.
- **PAT's five requirements:** (1) search and read all internal data, structured (decades of time series such as stock prices) and unstructured (broker-dealer research, internal memos); (2) use every proprietary tool analysts use (visualization, diagnostics, indicator-quality evaluation); (3) produce analyses that both humans and background agents can fully diagnose by reading traces; (4) know the firm's processes and frameworks; (5) learn and compound across *every* investor, not just one.
- **In production.** PAT was deployed internally several months before the talk and hundreds of investors use it daily. Background agents scan these interactions, find failures, and build human-audited benchmarks. The fixes go into context and harness changes that improve PAT for everyone.
- **How a 50-year-old firm built it.** An internal applied-AI startup incubated inside the firm; teams that mix investors (domain context), technologists (architecture), and scientists (rigor); hundreds of expert internal users generating signal every day; and an existing ecosystem of data, tools, and methods to plug into.
- **Each user gets a PAT shaped by their permissions.** Michael Wren explains that investors have different access rights. For example, only some can see current positions across all markets. Claude Code gives every user the same system prompt and tools. PAT is different: each user's version gets only the context and tools that user is allowed to see, so restricted IP can't leak to analysts without access.
- **Unstructured search covers far more than the web.** Web search is table stakes. PAT also searches a store of *millions* of documents (broker pieces, earnings transcripts, internal emails), with *thousands* of new pieces arriving daily in near real time.
- **Time-series search: inspect data the way a person would.** The time-series database holds *tens of millions* of series modeled over 50 years. Some come from outside (oil prices), others are internal concepts (e.g., expected inflation 12 months out). Standard RAG and re-ranking weren't enough. Accuracy went from **~50% to ~90%** once the search agent checked series the way a human researcher does: frequency, currency, and whether the values match its priors, not just the series name.
- **"The plan really is the analysis."** PAT first asks clarifying questions and suggests additional angles. The team put a lot of effort into context and benchmarks that teach PAT what separates a good research question from a bad one, because humans tend to under-invest in planning.
- **What a plan contains.** Every data frame the analysis will produce, the schema of each one, and how they connect. Planning is the slowest phase, and the team accepts that cost on purpose because it enables the speedups during execution.
- **Parallel code generation.** Each sub-agent knows its input data frames, their schemas, and the schema of its own output. That means one data frame's code can be generated without waiting for its dependencies. An analysis with 3 data frames and one with 30 take about the same time to generate.
- **Outputs go back into the input database.** PAT's time-series outputs land in the same database as human-uploaded series and look no different. Any PAT output can feed a later analysis, so humans and agents build on each other's work.
- **Self-review before reporting.** Like a junior analyst checking their own work, PAT inspects its computed numbers and charts. It looks for values that don't make sense and charts that aren't clean, then diagnoses and refines before responding. The final report is interactive, built with Bridgewater's in-house charting library, and can be sent to the internal charting tool for further edits.
- **Two learning loops.** (1) Autonomous: agents review completed conversations. (2) Explicit: a **"teach" button** starts an agent that looks through the conversation for behavioral mistakes, context gaps, or user steering PAT could have anticipated. The user edits or submits the result. A back-end agent then writes a benchmark that is *expected to fail*, which proves the bad behavior can be reproduced. It iterates on the context repositories or harness until that benchmark passes, checks that the rest of the suite still passes, and posts a **pull request to Slack**.
- **Two separate agents: chat and coding.** Santi White explains that the chat agent runs on **LangGraph**, mainly for persistence and its built-in cancellations and continuations, which the team previously handled itself with worse results. Its tools include data-series search and unstructured search. Once it has the data it needs, it writes a plan and calls the coding sub-agent, which produces a **Python/Pandas** analysis.
- **Why separate them.** Investors aren't programmers, so the chat stays purely about investing and code is hidden as an implementation detail. Each agent's context stays clean and specialized. The chat agent is taught Bridgewater jargon so it talks like a coworker. Investors contribute context directly, like developers on the codebase, because "your user is better at writing context than you are."
- **Step-by-step workflows over loose context.** Raw context is information-dense but vague. Step-by-step guides for specific types of analysis make the agent behave like a dependable product.
- **The plan as a "natural-language Python project."** Each task maps to roughly one Python function producing one data frame. Each task has a name, a description, and structural and semantic schema information. The design goal is that two LLMs compiling the same task produce code that gives *exactly the same output values*.
- **Code-gen speed compared with Claude Code.** On the same context and plan, PAT is **about 4× faster** on average at generating code, and a **20-task plan takes the same time as a 3-task plan**.
- **Validation is enforced by the architecture.** Static analysis builds a DAG of the generated code, and validation agents run in parallel layer by layer. A 5-task plan validates in 3 layers; a 20-task plan in about 4–5. Each validator runs the code, compares it with its task, and edits until it is correct. Orchestration is plain Python, not agentic, so agents *cannot skip* validation.
- **Determinism makes evals reliable.** On the test suite, two different agents produce *exactly the same code 95% of the time* for a given plan. Hill-climbing and evals are therefore far more reliable than "vibes" or LLM-as-judge.
- **The harness runs the code, not the agent.** Instead of agents running their own code from a terminal (high tool-call latency, getting lost along the way), PAT runs a classic static-analysis pass that **injects caching annotations** into the Python, then executes it in a custom framework. This avoids loading data twice or re-running intermediate steps. The bigger gain is on reruns. In a benchmark that only renames the last chart, Claude Code reruns everything, while PAT's second execution is near-instant. Investors can make small tweaks without paying for a full iteration.
## Actionable Takeaways
1. **Write down your domain rules before building agents.** Store causal reasoning, methods, and processes in a form both people and machines can read, so agents inherit the context instead of you rebuilding it.
2. **Scope each user's agent to their permissions.** Set each user's context and tool set from their access rights, rather than sharing one system prompt and toolset as Claude Code does.
3. **Add human-style checks to data search.** On top of RAG and re-ranking, have the agent check a series' frequency, currency, and whether its values match its priors. That step took Bridgewater from ~50% to ~90% accuracy.
4. **Make the plan detailed enough to compile.** Before writing code, list every data frame, its schema (structural and semantic), and its dependencies. Benchmark the quality of clarifying questions so users are pushed to plan properly.
5. **Generate code for each task in parallel.** Give each sub-agent its input schemas and its output schema so generation time stays flat (3 vs. 20–30 tasks).
6. **Enforce validation in ordinary code.** Build a DAG by static analysis, validate one layer at a time in parallel, and loop run → compare-to-task → edit until correct. Don't leave orchestration or validation up to the LLM.
7. **Measure determinism.** Track how often independent agents produce identical code from the same plan (Bridgewater: 95%) and use it as the basis for reliable evals.
8. **Run agent code yourself, with caching.** Inject caching annotations through static analysis so reruns after small edits (e.g., renaming a chart) are near-instant.
9. **Keep chat and coding agents separate.** Use LangGraph for the chat agent's persistence and cancellation/continuation. Keep chat in the user's domain language and hide code entirely.
10. **Build a "teach" loop that ends in a PR.** Have the agent find the gap → write a failing benchmark → iterate on context/harness until it passes → check for regressions across the full suite → open a pull request (posted to Slack) for human review.
11. **Feed agent outputs back into the shared data store** so later analyses, human or agent, can build on them.
12. **Start specialized, then combine.** Benchmark narrow workflows heavily and hill-climb them before combining agents. Going from generic to reliable is much harder.
## Notable Quotes
> "We didn't have to go back and write down everything for agents. It was already there for us to draw upon." — Brandon McManus
> "During Pat development, we came to the view that the plan really is the analysis." — Michael Wren
> "Your user is better writing context than you are, most likely." — Santi White
> "We enforce correctness in the architecture... the agents cannot forget to validate. They are forced to validate." — Santi White
> "We don't really believe in generic powerful agents. They make really cool demos." — Santi White
> "Thinking of agentic coding as a compiler problem, not as an agentic problem." — Santi White
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*