Zing Forum

Reading

Portfolio Builder: An Automated Portfolio Construction System Based on Multi-Agent Workflow

Portfolio Builder is a multi-agent workflow system built with LangGraph. It collaborates through three agents—risk analysis, direct index screening, and mathematical optimization—to construct passive, low-cost customized portfolios for the European market.

Portfolio Builder多智能体LangGraph投资组合被动投资直接指数化数学优化风险管理欧洲市场GitHub
Published 2026-05-24 14:45Recent activity 2026-05-24 14:54Estimated read 7 min
Portfolio Builder: An Automated Portfolio Construction System Based on Multi-Agent Workflow
1

Section 01

Portfolio Builder Project Introduction

Portfolio Builder is an open-source automated portfolio construction system developed by aneeshcheriank and hosted on GitHub (License: Apache License 2.0). Built on LangGraph, this system uses a multi-agent workflow where three agents—risk analysis, direct index screening, and mathematical optimization—collaborate to provide passive, low-cost customized portfolio services for users in the European market. Its core highlight is the integration of LangGraph's feedback loop mechanism with mathematical optimization algorithms to achieve a self-adjusting investment decision system.

2

Section 02

Project Background and Investment Philosophy

Project Overview

Portfolio Builder is an intelligent investment tool designed for the European market, following a passive investment strategy to help users achieve their investment goals with low management costs.

Investment Philosophy

  • Passive Investment Philosophy: Obtain average returns by tracking market indices, with advantages including low cost, diversification, high transparency, and long-term effectiveness.
  • Direct Indexing Strategy: Directly purchase index constituent stocks instead of ETFs, supporting personalized customization, tax optimization (tax loss harvesting), and ESG screening.
3

Section 03

Multi-Agent Collaboration Architecture and Review Mechanism

Multi-Agent Architecture

The system includes three core agents:

  1. Risk and Index Matcher: Analyze user risk preferences and goals, convert them into target volatility (e.g., 12%), and match a benchmark index (e.g., STOXX 600).
  2. Direct Index Screener: Screen eligible individual stocks from the benchmark index constituents (positive Alpha, Beta control, valuation screening) and output a list of approximately 100 stocks.
  3. Rebalancing and Optimizer: Apply mathematical optimization algorithms to match target volatility, maximize diversification, and enforce constraints on weight (single stock ≤5%) and industry concentration (≤20%).

Internal Review Loop

  • Review Criteria: Mark as failed if tracking error >3% or the portfolio is overly concentrated.
  • Feedback Loop: When failed, pass adjustment suggestions to the screener (e.g., relax P/E conditions) and re-execute the process until constraints are met.
4

Section 04

Technical Implementation Details

LangGraph Framework

  • State Management: Maintain shared memory across agents.
  • Conditional Routing: Determine the flow direction based on review results.
  • Loop Support: Natively supports feedback loops and iterative optimization.

Mathematical Optimization

  • Mean-Variance Optimization (core of Modern Portfolio Theory).
  • Risk Parity (balance risk contribution of each asset).
  • Constraint Solving (handle weight and industry restrictions).

Tech Stack

Python, LangGraph, DeepSeek API, GitHub Actions (CI/CD automated testing).

5

Section 05

Usage and Test Validation

Usage

  1. Environment Setup: Install dependencies (pip install -r requirements.txt), set DeepSeek API key, run python main.py.
  2. Input Example: Describe requirements in natural language (e.g., "Medium risk, €10,000, growth-oriented").
  3. Output Result: Customized portfolio (including selected stocks, weight configuration, meeting concentration and tracking error constraints).

Test Validation

  • Unit Tests: Test independent functions of each agent.
  • Integration Tests: Validate end-to-end workflow.
  • GitHub Actions: Automated continuous integration. Run test commands: pytest or test specific modules.
6

Section 06

Project Significance and Future Outlook

Project Significance

  • Lower Investment Threshold: Ordinary investors can access institutional-level services without deep financial knowledge or high costs.
  • AI-Driven Decision Making: Demonstrate the application potential of multi-agent collaboration in the financial field.

Future Outlook

  • Scalability: Currently supports STOXX 600 for the European market; can be adapted to US (S&P500), global (MSCI World), and emerging market indices.
7

Section 07

Project Summary

Portfolio Builder combines AI technology with traditional financial theory through multi-agent collaboration, mathematical optimization, and feedback loop mechanisms, providing an innovative automated investment solution for the personal finance field. This project is of reference value to developers exploring AI financial applications and individual investors seeking automated investment.