AWS Builder Center
Building a Multi-Agent Quant Backtesting System: Amazon Bedrock AgentCore + Strands Agents

Building a Multi-Agent Quant Backtesting System: Amazon Bedrock AgentCore + Strands Agents

Three AI agents turn a plain-English quantitative trading strategy into a full backtest report. Learn how they are built, orchestrated, and deployed on Amazon Bedrock AgentCore with Strands Agents—architecture walkthrough and series opener.

A hands-on walkthrough of building a multi-agent quantitative backtesting system on  Amazon Bedrock AgentCore  and the  Strands Agents SDK . Three specialized AI agents collaborate to turn a plain-English trading strategy into a full performance report. This post is the introduction to an  eight-lab, 90-minute workshop  and the first in a multi-part series. It covers the architecture, the three foundation models, and the lab progression—and kicks off follow-up posts on collaboration (A2A), safe execution (sandboxing), governed actions (guardrails), and compounding memory.

The Problem

The success or failure of quantitative trading depends, to a large degree, on backtesting. Before any real money goes into the market, a strategy has to prove itself on historical data: Does it make money? What's the worst-case loss? Is this much return worth that much risk?
The hard part is that going from a trading idea to a credible backtest report spans several domains at once: trading domain knowledge, data engineering, Python coding, and statistical analysis. That is precisely the kind of multi-step, multi-skill problem where AI agents shine. The hands-on workshop explored in this post builds exactly such a system: multiple specialized agents collaborating to go from a one-sentence strategy description to a full performance analysis—automatically.
This post gives you a quick tour of what the workshop covers and why its design decisions are worth adopting in your own projects.
Disclaimer: This content is for learning and discussion purposes only. It does not constitute investment advice, recommendations, or solicitation. Any investment decisions and resulting gains or losses are solely the responsibility of the individual.



About This Series

This post is the opener of a multi-part series. It gives you the big picture; the follow-up posts each zoom into one design decision that turns this system from a demo into something production-ready:
  • Part 1 (this post) — The big picture: the architecture, the models, and the eight-lab progression.
  • Part 2 — Collaboration (A2A protocol): how agents discover and invoke each other across accounts, clouds, and frameworks using an open standard rather than a proprietary API.
  • Part 3 — Safe execution (Code Interpreter sandbox): why you should not run LLM-generated code directly, and how a sandbox contains it.
  • Part 4 — Governed actions (Cedar guardrails): how to impose a deterministic guardrail on a probabilistic agent—a boundary it can never cross, no matter what it decides.
  • Part 5 — Compounding memory: how giving the agent memory turns one-off backtests into a research companion that accumulates context and converses.
The through-line: big picture → collaboration → safety → accumulation. If any of those resonate, follow along.



What You'll Build

This is a hands-on workshop—roughly 90 minutes—at an intermediate (300) level. By the end you will have:
  • Three specialized AI agents deployed to Amazon Bedrock AgentCore
  • The ability to connect agents to external market data through an AgentCore MCP Gateway
  • A full-stack backtesting application that runs all the way from strategy input to performance analysis
  • An understanding of multi-agent orchestration patterns for complex financial workflows.
The bar is not high: basic Python and command-line familiarity, plus a general grasp of trading concepts such as buy, sell, and technical indicators. No prior experience with AI agents or backtesting frameworks is required. The workshop environment ships with a browser-based code editor (Code-OSS/VS Code Open Source), so there is nothing to install locally.



Three Foundation Models

A core idea of the workshop is matching the right model to the task. Rather than having one large model do everything, each agent uses the model best suited to its job:
Model
Role
Responsibility
Anthropic Claude Opus 4
Strategy generator
Turn natural-language strategy into executable Backtrader Python code
Amazon Nova Lite 2.0
Result summarizer
Analyze performance metrics and write a professional report
Anthropic Claude Sonnet 4
Quant agent (orchestrator)
Coordinate the whole workflow and all sub-agents
Using a powerful model for code generation and a lighter, faster model for summarization is, in itself, a practical lesson in cost-and-latency optimization.



Why Backtesting, and Why Agents

Backtesting answers the questions that matter most before real capital is deployed: total and annualized return, maximum drawdown, Sharpe and Sortino ratios, win rate, profit/loss ratio, and how a strategy behaves in bull, bear, and sideways markets.
The traditional flow has five steps: define the strategy, gather historical data (OHLCV), implement it in code, run the simulation, and analyze the results. The problem is that each step demands a different skill.
The workshop uses Backtrader, a popular open-source Python backtesting framework with an event-driven engine, built-in technical indicators (SMA, EMA, RSI, MACD), order management, and performance analytics. In this system, the strategy generator writes the Backtrader code and the quant agent runs it against real market data—leaving the human free to focus on the strategy itself.



Why Multiple Agents Instead of One Big Agent

A single "do-everything" agent tends to struggle with complex, multi-step tasks. The workshop argues for a multi-agent architecture along four axes:
Why Multi-Agent Architecture

  • Specialization — each agent has a single responsibility, raising accuracy
  • Scalability — distributed processing scales elastically and independently
  • Cost efficiency — provision resources per agent, on demand
  • Maintainability — fine-grained control, independent health monitoring, isolated testing
Strands Agents supports four collaboration patterns:
Strands Agents multi-agent collaboration patterns

  • Agent as Tools (the orchestrator calls specialized agents)
  • Swarm (agents collaborate through shared memory)
  • Graph (agents as nodes connected by explicit edges)
  • Workflow (structured, sequential collaboration)
Use cases:
  • Loan approval processes — Sequential steps: identity verification → credit check → risk assessment → approval decision
  • CI/CD pipelines — Build → test → security scan → deploy, with defined dependencies between stages
  • Insurance claims — Document collection → damage assessment → policy validation → settlement calculation
The diagram below shows sample use cases for each pattern.
Sample use cases for each pattern

This workshop uses the Agent-as-Tool pattern, because a backtesting flow is naturally hierarchical:
User Request
↓
Quant Agent (Orchestrator)
├── call → Strategy Generator Agent → Backtrader code
├── call → Market Data MCP Tool → Historical OHLCV data
├── execute → Backtest (Backtrader engine)
└── call → Result Summarizer Agent → Performance analysis
↓
Consolidated Response → User
Because each specialized agent runs independently, it can use a different model and its own configuration, and it can be tested, scaled, and updated in isolation.



What AgentCore Brings

Amazon Bedrock AgentCore provides managed infrastructure for deploying, running, and scaling agents in production. The workshop uses five of its services:
  • Runtime — a serverless compute environment hosting each agent. No servers or containers to manage, auto-scaling with invocation load, secure environment variables, and agent-to-agent invocation. All three agents are deployed here.
  • Gateway — wraps a market-data Lambda into a  get_market_data  MCP tool that any agent can call, with semantic routing and Cognito-based OAuth.
  • Identity — secure authentication integrated with an existing identity provider (here, Amazon Cognito), ensuring only authorized agents can reach the market-data tool.
  • Memory — short- and long-term context, letting the quant agent handle follow-ups and iterative strategy refinement.
  • Observability — OpenTelemetry-compatible tracing of the full execution path, from orchestrator to sub-agents to Gateway tool calls, flowing into Amazon CloudWatch.
Deployment is straightforward: point the AgentCore CLI at your Python entry file, and it handles packaging, dependencies, container management, and scaling:
agentcore configure --entrypoint quant_agent.py --name quant_agent \
--requirements-file requirements.txt --idle-timeout 900

agentcore launch --auto-update-on-conflict \
--env AWS_REGION=$WORKSHOP_REGION \
--env STRATEGY_GENERATOR_RUNTIME_ARN=arn:... \
--env AGENTCORE_GATEWAY_URL=https://...




System architecture

 Overall system architecture

Overall system architecture. Source: the "Agentic Backtesting for Quants" workshop (AWS).
The system has three layers:
  • Frontend (Next.js) — a strategy input form, real-time workflow progress, and a results dashboard with metrics and AI analysis.
  • Orchestration layer (Bedrock AgentCore) — the quant agent receives the request, calls the strategy generator for code, fetches data through the market-data Gateway, runs the Backtrader simulation locally, then calls the result summarizer.
  • Data layer — S3 Tables (Apache Iceberg format) store historical daily OHLCV data, sourced from Yahoo Finance (educational use only); a Lambda function queries it via PyIceberg; the Gateway exposes that Lambda as the  get_market_data  tool.



The Hands-On Labs

The labs build progressively, each adding one new AgentCore capability on top of the last. You start with a prompt-only agent and evolve it, step by step, into a full multi-agent system with observability and guardrails:
  • Lab 1 — Deploy the strategy generator (AgentCore Runtime): get a simple, prompt-only agent up and running.
  • Lab 2 — Build the quant agent with market data (AgentCore Gateway & Identity): connect the agent to external tools.
  • Lab 3 — Multi-agent orchestration (Agent-as-Tool): transition from a single agent to an "orchestrator + experts" structure.
  • Lab 4 — Run your first backtest (AgentCore Observability): make the black box transparent with traces and spans.
  • Lab 5 — Backtest memory and chat (AgentCore Memory): transition from stateless to stateful, enabling the agent to remember context.
  • Lab 6 (bonus) — Add guardrails (AgentCore Policy): transition from unconstrained to governed execution.
  • Lab 7 (bonus) — Sandboxed execution (AgentCore Code Interpreter): run code in a secure sandbox rather than locally.
  • Lab 8 (bonus) — A2A protocol (Agent-to-Agent): replace a proprietary API with an open, interoperable standard.
This evolution path is itself the payoff: each lab corresponds to a real capability gap you will encounter when pushing an agent from "toy" toward "production."



What You've Built

Component
Technology
Purpose
Strategy Generator
Claude Opus 4 + AgentCore
Converts natural language to Backtrader code
Results Summarizer
Nova Lite 2.0 + AgentCore
Analyzes performance metrics
Quant Agent
Claude Sonnet 4 + AgentCore
Orchestrates the 4-step workflow
Market Data MCP
Lambda + S3 Tables + AgentCore Gateway
Serves historical OHLCV data
Frontend
Next.js + TypeScript
User interface for strategy input and results



Who It's For

This workshop is aimed at quant developers, data scientists, engineers, and engineering managers who are curious about how agentic AI can accelerate quantitative trading workflows. If you have been looking for a concrete demonstration of how multi-agent orchestration, MCP, and managed agent infrastructure fit together in an end-to-end project, this is a well-scoped place to start. It is free at AWS events; running it in your own account requires you to cover the cloud resource costs.
Finally, to repeat a reminder from the workshop itself: the market data here comes from Yahoo Finance, for educational use only, and is not investment advice. What is truly worth taking away is the overall architecture of this quant backtesting system and the multi-agent design patterns you can internalize and apply to your own systems.



References

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article