DEV Community

AskPaul
AskPaul

Posted on

Building a Prediction Market App with MiroFlow: A Technical Deep Dive

As we develop https://askpaul.ai, a cutting-edge prediction market application, we've integrated MiroMindAI's MiroFlow framework to power our market outcome predictions. This powerful open-source research agent framework has proven instrumental in handling the complex, multi-step internet research tasks that underpin accurate forecasting. In this technical blog post, we'll explore the architecture of MiroFlow (available at https://github.com/MiroMindAI/MiroFlow) and examine how its design enables robust predictive capabilities.

MiroFlow Architecture Analysis

Architectural Overview

MiroFlow is a high-performance open-source research agent framework specifically engineered for executing complex multi-step internet research tasks, such as future event prediction. The project employs a modular design that supports multiple LLM providers and tool integrations, making it highly adaptable to diverse research scenarios.

Core Directory Structure

MiroFlow/
├── src/                    # Core source code
│   ├── core/              # Core orchestration logic
│   ├── llm/               # LLM client implementations
│   ├── tool/              # Tool management
│   ├── logging/           # Logging and tracing
│   └── utils/             # Utility functions
├── config/                # Configuration files
├── data/                  # Data files
├── logs/                  # Log files
├── utils/                  # Utility scripts
└── docs/                  # Documentation
Enter fullscreen mode Exit fullscreen mode

Core Architectural Components

1. Core Orchestration Layer

  • src/core/orchestrator.py: Primary orchestrator responsible for coordinating main and sub-agents
  • src/core/pipeline.py: Task execution pipeline handling end-to-end task flows

2. LLM Client Layer

  • src/llm/client.py: LLM client factory
  • src/llm/provider_client_base.py: Abstract base class defining LLM client interface
  • src/llm/providers/: Concrete LLM provider implementations
    • claude_anthropic_client.py
    • gpt_openai_client.py
    • mirothinker_sglang_client.py
    • qwen_sglang_client.py
    • And more

3. Tool Management Layer

  • src/tool/manager.py: Tool manager with MCP protocol support
  • src/tool/mcp_servers/: MCP server implementations
    • audio_mcp_server.py: Audio processing
    • browser_session.py: Browser sessions
    • python_server.py: Python code execution
    • reading_mcp_server.py: File reading
    • reasoning_mcp_server.py: Reasoning tools
    • searching_mcp_server.py: Search tools
    • vision_mcp_server.py: Visual processing

4. Logging & Tracing Layer

  • src/logging/logger.py: Logging system
  • src/logging/task_tracer.py: Task tracer recording execution steps

5. Configuration Management

  • config/: Configuration file directory
    • agent_*.yaml: Agent configurations
    • benchmark/: Benchmarking configurations
    • tool/: Tool configurations

6. Utilities Layer

  • src/utils/: Core utility functions
  • utils/: Evaluation and statistical tools

Execution Flow Architecture

Main Execution Flow:

  1. Initialization Phase

    • Loading configuration files
    • Initializing LLM clients
    • Creating tool managers
    • Setting up logging and tracing
  2. Task Execution Phase

    • Main agent receiving tasks
    • Tool invocation and sub-agent coordination
    • Result aggregation and formatting
  3. Result Output Phase

    • Generating final answers
    • Saving execution logs
    • Returning formatted results

Key Features

1. Multi-Agent Architecture

  • Main Agent: Responsible for overall task coordination
  • Sub Agents: Execute specific subtasks
  • Tool Agents: Integrate various tools via MCP protocol

2. LLM Provider Support

  • OpenAI GPT series
  • Anthropic Claude series
  • MiroThinker (proprietary model)
  • Qwen series
  • DeepSeek series

3. Tool Ecosystem

  • Search Tools: Google search, web scraping
  • Code Execution: Python code running
  • File Processing: Document reading, audio transcription
  • Browser Automation: Playwright integration
  • Reasoning Tools: Logical inference support

4. Configuration-Driven Design

  • Hydra configuration management
  • Environment variable support
  • Dynamic configuration loading

Architectural Summary

MiroFlow represents a well-designed modular AI agent framework with the following characteristics:

Core Advantages:

  1. High Modularity: Clear separation of concerns among components, enabling easy extensibility
  2. Multi-LLM Support: Unified client interface supporting various large language models
  3. Rich Tool Ecosystem: Integration of diverse tools through MCP protocol
  4. Configuration-Driven: Flexible configuration system supporting different scenarios
  5. Comprehensive Logging: Detailed execution records and error handling

Technology Stack:

  • Python 3.12+: Leveraging modern Python features
  • Hydra: For configuration management
  • MCP Protocol: Standard for tool integration
  • Asynchronous Programming: For high-performance concurrent processing
  • Pydantic: For data validation and serialization

Application Scenarios:

  • Future event prediction
  • Complex research tasks
  • Multi-step reasoning
  • Automated information gathering

The architectural design of MiroFlow embodies best practices in modern AI agent systems, ensuring both performance and maintainability while providing excellent extensibility—qualities that make it an ideal foundation for powering the predictive capabilities of our askpaul.ai platform.

Top comments (0)