Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:24mlight A Share investment Agent debate room agent

From Leeroopedia
Knowledge Sources
Domains AI_Agents, Decision_Making, Finance
Last Updated 2026-10-10 14:00 GMT

Overview

Concrete tool for adversarial debate resolution between bull and bear theses using LLM third-party evaluation and mixed quantitative-LLM confidence scoring, provided by the A_Share_investment_Agent repository.

Description

The debate_room_agent function collects bull and bear researcher messages, validates their presence, formats perspectives for LLM evaluation, calls get_chat_completion with debate room prompts, and computes a mixed confidence difference: 0.7 * (bull_conf - bear_conf) + 0.3 * llm_score. The final signal is determined by threshold ±0.1 on the mixed confidence difference.

Key phases:

  1. Collection (L22-64): Scans messages for researcher_*_agent, parses JSON with defensive checks
  2. LLM Evaluation (L114-152): Sends formatted perspectives to LLM with debate room prompts
  3. Scoring (L154-222): Computes mixed confidence, determines final signal

Usage

Import when you need to:

  • Resolve opposing bull/bear investment theses with LLM evaluation
  • Run after researcher_bull_agent and researcher_bear_agent in the workflow

Decorated with @agent_endpoint("debate_room", "辩论室...").

Code Reference

Source Location

Signature

@agent_endpoint("debate_room", "辩论室,分析多空双方观点,得出平衡的投资结论")
def debate_room_agent(state: AgentState) -> dict:
    """Facilitates debate between bull and bear researchers to reach a balanced conclusion."""

Import

from src.agents.debate_room import debate_room_agent

I/O Contract

Inputs

Name Type Required Description
state AgentState Yes Reads messages from researcher_bull_agent and researcher_bear_agent

Outputs

Name Type Description
messages list HumanMessage with debate results
signal str "bullish", "bearish", or "neutral"
confidence float Winning side's confidence
mixed_confidence_diff float 0.7*(bull-bear) + 0.3*llm_score
llm_score float LLM evaluation score (-1 to 1)
llm_analysis str LLM analysis text
debate_summary list Summary of bull/bear arguments
data["debate_analysis"] dict Full debate results for downstream agents

Usage Examples

from src.agents.debate_room import debate_room_agent

# Runs after [researcher_bull_agent, researcher_bear_agent] fan-in
# 1. Collects bull/bear theses from state messages
# 2. Formats perspectives_block and sends to LLM
# 3. Computes: mixed_confidence_diff = 0.7 * (bull_conf - bear_conf) + 0.3 * llm_score
# 4. Signal: |mixed_diff| < 0.1 → neutral, > 0 → bullish, < 0 → bearish

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment