Borsacı: Six Agents, One Collective Intelligence — Autonomous System Analyzing Turkish Finance

Introduction
Artificial intelligence technology has evolved beyond simple assistants that execute commands, transforming into systems capable of autonomously analyzing and solving complex problems. Borsacı is a product of this next-generation approach: an autonomous financial analysis platform built on a multi-agent AI architecture, designed to deeply analyze Turkish financial markets.
In this article, we will examine in detail Borsacı's architectural structure, task distribution and coordination mechanisms between agents, and the system's parallel task execution capabilities that improve performance by 50% to 70%.
Table of Contents
- Limitations of Single-Agent Approach and Reasons for Transitioning to Multi-Agent Architecture
- Overall System Architecture
- Agent Architecture and Responsibilities
- Performance Gains Through Parallel Task Execution
- BuffettAgent: Value Investing Focused Expert Analysis
- MCP Protocol: Access to 43+ Financial Data Tools
- Practical Use Case Scenarios
- Technical Infrastructure and Code Examples
- Evaluation and Future Vision
1. Limitations of Single-Agent Approach and Reasons for Transitioning to Multi-Agent Architecture
Traditional (Monolithic) Approach
In traditional AI systems, all tasks are managed by a single large language model.
User Request: "Get the latest prices for ASELS, THYAO, and GARAN stocks."
Processing: A single large agent processes these three requests sequentially, one after another.
The fundamental problems inherent in this approach are:
- Inefficiency: All analytical load is concentrated on a single model, slowing down the system.
- Fragility: If an error occurs at any step in the process, the entire operation fails and must be restarted from scratch.
- Performance Loss: Since tasks cannot be processed in parallel, a query about three stocks takes three times as long as a single stock query.
- Lack of Specialization: The system performs each task with average competence but cannot specialize in any.
Borsacı's Multi-Agent Approach
Borsacı adopts an architecture that distributes tasks among specialized agents to address these issues.
User Request
- Router Agent: Analyzes the nature of the request.
- Planner Agent: Breaks down the request into three independent tasks (fetching ASELS, THYAO, GARAN data).
- Action Agents: Execute the three tasks simultaneously in parallel.
- Validator Agent: Verifies the accuracy and consistency of each task's results.
- Synthesizer Agent: Transforms validated data into a meaningful and comprehensive response.
Final Response
The advantages of this modular structure are clear:
- Specialization: Each agent specializes in a specific task, increasing the system's overall efficiency and accuracy.
- Parallel Processing: Independent tasks are executed simultaneously, significantly reducing total processing time.
- Resilience: An error in one agent's task does not affect the work of other agents; the entire system does not experience interruption.
- Resource Optimization: Powerful models are used for complex planning steps, while faster and more cost-effective models handle simple and repetitive tasks.
2. Overall System Architecture
Borsacı has a modular structure consisting of six specialized agents working in harmony. The system's primary goal is to analyze incoming user requests most efficiently, routing them to relevant agents to produce accurate and fast results.
Model Selection Strategy
The system strategically uses Google Gemini series language models to balance performance and cost:
This strategy optimizes the system's overall performance by leveraging the Pro model's analytical power in the planning phase and the Flash model's speed in the execution phase.
System Flow Diagram
3. Agent Architecture and Responsibilities
3.1 Router Agent
The system's first point of contact. It analyzes incoming user requests to determine the request's nature: responds directly to simple interactions like "Hello," routes special requests like "Buffett analysis" to BuffettAgent, and transfers complex multi-step requests to the main planning flow.
3.2 Planner Agent
The system's strategist that breaks down complex requests into logically smaller and manageable steps. This agent creates a work plan by defining each task and its dependencies on other tasks. This plan specifies which tasks can be executed in what order and which can run in parallel.
3.3 Action Agent
The unit that executes tasks created by the Planner Agent. It accesses over 43 financial tools via the MCP protocol, performing operations like data collection and calculations. It decides which tool to use for which task through the language model's natural language understanding capability.
3.4 Validator Agent
The quality control mechanism that reviews the results of each task completed by the Action Agent. It verifies whether the obtained data is in the expected format and consistent. For example, if a stock price is requested and a response like "data not found" is received, it detects the task has failed and triggers a retry.
3.5 Synthesizer and Answer Agent
The agent that combines raw data (numbers, tables, text) collected from different execution steps to create a meaningful, fluent, and comprehensive response for the user. This agent synthesizes technical data into language everyone can understand.
3.6 Chart Generator
Handles user "chart" requests. Creates text-based charts (viewable in terminal) using collected numerical data (such as opening, highest, lowest, and closing prices). This process is performed by code completely independent from the model to eliminate the risk of language models generating erroneous data (hallucination).
4. Performance Gains Through Parallel Task Execution
One of the most significant improvements in system performance is the simultaneous execution of independent tasks.
- Sequential Processing Scenario: Fetching data for three different stocks, assuming each takes an average of 5 seconds, takes a total of 15 seconds.
- Parallel Processing Scenario: Borsacı recognizes these three tasks are independent and starts all of them simultaneously. The process completes in 5 seconds—the completion time of the longest-running task.
This capability is made possible by the Topological Sort algorithm. Tasks created by the Planner Agent and their dependencies are modeled as a graph. This algorithm analyzes the graph to produce an execution plan that determines which tasks should run simultaneously and which should run in a specific order. This plan is efficiently implemented using Python's asyncio library.
5. BuffettAgent: Value Investing Focused Expert Analysis
A Warren Buffett-style valuation analysis is a much more complex, multi-stage process than a standard financial query. Therefore, a specialized agent has been developed for this task.
BuffettAgent works with a two-stage architecture:
- Data Collection Stage: Collects all necessary financial data (balance sheet, market value, etc.) with a single atomic tool call. This approach speeds up data collection by 3 to 4 times by consolidating operations that previously required multiple calls.
- Analysis Stage: Analyzes the collected data using a system prompt specially designed to mimic Warren Buffett's investment philosophy and analytical framework. This analysis produces a comprehensive report including the company's business model, competitive advantages (economic moat), real cash power (owner earnings), and how discounted it trades relative to its intrinsic value (margin of safety).
Inflation-Adjusted Valuation: Fisher Effect
In high-inflation economies like Turkey, traditional valuation models can be misleading. BuffettAgent addresses this issue by using the Fisher Effect principle to strip nominal interest rates of expected inflation, obtaining a real discount rate. This way, the present value of the company's future cash flows is calculated on a more realistic basis, free from inflation's distorting effect.
6. MCP Protocol: Access to 43+ Financial Data Tools
Borsacı's access to external data sources is provided through a standard protocol called Model Context Protocol (MCP). MCP is a layer that enables AI agents to communicate securely, standardly, and efficiently with different data sources and tools.
Thanks to this approach, instead of writing separate code for each data source, it's sufficient to introduce a single MCP address to the system. The Action Agent determines which tool it needs (for example, get_bilanco or get_fund_performance) and the parameters required to use that tool by analyzing the task definition. This flexible structure ensures no code changes are required when new tools are added to the system.
7. Practical Use Case Scenarios
- Simple Price Query: A question like "What is the Bitcoin price?" is executed directly, skipping the planning step, and answered in approximately 2 seconds.
- Comparative Analysis: The request "Compare the P/E ratios of ASELS and THYAO" is completed in approximately 7 seconds thanks to parallel execution. This time could reach 15 seconds in a sequential system.
- In-Depth Buffett Analysis: The request "Do a Buffett analysis for Garanti Bank" is handled by the specialized
BuffettAgentand produces a comprehensive report in approximately 12 seconds. - Follow-up Questions: A follow-up question like "What do you think about its debt situation?" after "How are ASELS's financials?" is answered quickly (in approximately 3 seconds) in context, thanks to the system's memory of conversation history.
8. Technical Infrastructure and Code Examples
Borsacı is developed in Python 3.11+ using libraries such as PydanticAI and plotext. The project's source code, installation instructions, and more detailed technical explanations are available in the GitHub repository.
GitHub: https://github.com/saidsurucu/Borsacı
9. Evaluation and Future Vision
Borsacı presents significant potential in automating and accelerating financial analysis processes with its modular architecture, parallel processing capabilities, and specialized agent structure.
Future Developments:
- Short-term: Plans include adding "streaming" support to enable real-time response flow and a cache layer for frequently used data.
- Medium-term: Goals include developing a web interface for easier system use and establishing comprehensive test infrastructure to increase system reliability.
- Long-term: Work will focus on adding advanced agents with new capabilities like sentiment analysis from news and portfolio optimization, and voice command interface integration.
Contributing to the Project
Borsacı is an open-source project. It welcomes contributions from all developers interested in financial technology and artificial intelligence.
Legal Disclaimer
This software is developed solely for informational and educational purposes. No content, analysis, or data produced by Borsacı should be interpreted as investment advice. Investing in financial markets involves risk, and you should make your decisions in consultation with a licensed financial advisor, based on your own research.
Interactive System Flow Diagram
You can zoom, pan, and drag nodes in the diagram below:

