Skip to content

Agents: make one tool round trip reachable from the CLI, or retire the dormant agent code #331

Closed

Description

@iAmGiG

What happens

AutoGen is gone (#606). The agents' LLM path is now BaseAgent.process_with_tools (src/autogen_agents/core/base_agent.py:161), an Agent Framework tool loop. Nothing reaches it.

  • It is called only from the agents' generate_reply methods (src/autogen_agents/agents/voter_agent.py:259, executor_agent.py:636, scanner_agent.py:791) and from VoterAgent._fetch_and_evaluate (voter_agent.py:267), which only generate_reply calls (voter_agent.py:227).
  • generate_reply is defined five times (base_agent.py:250, risk_agent.py:565, executor_agent.py:560, scanner_agent.py:704, voter_agent.py:176) and called nowhere in src/, main.py, scripts/ or examples/.
  • Typed CLI input goes through IntentClassifier and TradeHandler (src/cli/cli_session.py:359,587) to the core orchestrator, whose parser is LLMParser (src/core/factory.py:108). It doesn't reach an agent's tool loop. RealVoterStrategy calls VoterAgent's scoring methods directly (src/strategies/real_voter_strategy.py:164,173).
  • The workflows of the agent orchestrator (TradingOrchestrator.run_morning_routine, run_continuous_monitoring, monitor_positions, run_evening_summary in src/autogen_agents/orchestration/trading_orchestrator.py) have no callers either, except that run_continuous_monitoring calls monitor_positions (line 395).

So the tool loop, the approval flow for agent-run tools (#430) and the ScannerAgent (#304) can't run from anything a user does. The CLI still calls the flagged tools directly. The design this issue first described, a multi-agent debate in an AutoGen GroupChat, went with AutoGen. This issue now asks for the first step. The original text is kept below.

Proposal

Pick one.

  1. Wire one flow. A CLI command that sends a request to one agent through process_with_tools with read-only tools, prints the reply, and shows approval requests for flagged tools (Approval flow for state-changing CLI tools under Agent Framework #430). It proves the path end to end. No multi-agent design until it exists.
  2. Retire the dormant code. Remove the generate_reply methods, the tool loop and the orchestrator workflows that nothing calls. Keep what the live path imports: BaseAgent, VoterAgent and MultiTimeframeVoter (used by RealVoterStrategy, src/strategies/real_voter_strategy.py:16-17), src/autogen_agents/tools, scanner_config (src/cli/commands/slash_commands.py:548), and TradingOrchestrator, ExecutionMode, AgentFactory, AgentBus and ExecutorAgent (the CLI's cancel and execution-mode tools, src/cli/tools/order_tools.py:72,310 and execution_mode_tools.py:118).

Acceptance

  • Option 1: a typed command reaches process_with_tools (tested with the fake model server in tests/unit/agents/test_base_agent_framework.py), prints the reply, and runs no state-changing tool without approval.
  • Option 2: nothing in src/ imports the removed code, the suite passes, and the docs that describe it are updated.
Original issue body

Summary

Implement multi-agent coordination architecture where multiple AutoGen agents can debate, discuss, and collaborate on trade analysis before presenting unified recommendations to the user.

Context

Current system uses single-agent analysis (VoterAgent). This issue explores multi-agent collaboration patterns using Microsoft AutoGen's group chat capabilities.

Vision

Instead of: Single agent analyzes → Suggests trade
Enable: Multiple agents debate → Reach consensus → Suggest trade

Example scenario:

User: "review SPY at 600"

ScannerAgent: "SPY showing bullish MACD cross, RSI neutral at 52"
RiskAgent: "Market volatility elevated (VIX 18), suggest smaller position"
VoterAgent: "Technical setup is strong, vote: BUY"
SentimentAgent: "News sentiment mixed, Fed meeting next week"

Orchestrator: [synthesizes] "Agents suggest BUY with reduced position size due to event risk. Entry: $600, Size: 50% normal, Stop: $588"

Requirements

Agent Roles

  • ScannerAgent: Identifies opportunities, technical patterns
  • VoterAgent: MACD+RSI voting system (already exists)
  • RiskAgent: Position sizing, portfolio impact, risk limits
  • SentimentAgent (optional): News/market sentiment context
  • TradingOrchestrator: Moderates discussion, synthesizes recommendations

Coordination Patterns

Pattern 1: Sequential Analysis (simplest)

1. ScannerAgent analyzes → passes to VoterAgent
2. VoterAgent votes → passes to RiskAgent  
3. RiskAgent sizes → Orchestrator presents to user

Pattern 2: Group Chat Debate (AutoGen native)

1. Orchestrator poses question to group
2. Agents discuss asynchronously (3-5 rounds)
3. Orchestrator synthesizes consensus
4. Present to user

Pattern 3: Voting System (democratic)

1. All agents analyze independently
2. Each casts vote (BUY/SELL/HOLD) with confidence
3. Orchestrator aggregates votes (weighted by confidence)
4. Present majority decision + dissenting opinions

Question for discussion: Which pattern fits best? Start with Pattern 1 (sequential), evolve to Pattern 2?

Output Format

User should see:

  • Unified recommendation (clear action)
  • Agent consensus (who voted what)
  • Key reasoning (2-3 bullet points)
  • Dissenting views (if significant disagreement)

Example Output

━━━━━━━━━━━━━━━━━━━━━━
📊 SPY @ $600 Analysis
━━━━━━━━━━━━━━━━━━━━━━

✅ RECOMMENDATION: BUY (Consensus: 3/4 agents)

📈 VoterAgent: STRONG BUY (MACD bullish cross, RSI 52)
⚠️  RiskAgent: BUY with caution (reduce position 50% due to VIX 18)  
🔍 ScannerAgent: BUY (support at $595, resistance at $615)
📰 SentimentAgent: HOLD (Fed meeting uncertainty next week)

💡 Orchestrator: Agents suggest entry with reduced risk due to event uncertainty.
   → Entry: $600 | Size: 25 shares (50% normal) | Stop: $588

Continue? [yes/no]

Technical Implementation

AutoGen Group Chat Setup

from autogen import GroupChat, GroupChatManager

# Define agents
scanner = ScannerAgent(...)
voter = VoterAgent(...)  # existing
risk = RiskAgent(...)
orchestrator = TradingOrchestrator(...)

# Create group chat
group_chat = GroupChat(
    agents=[scanner, voter, risk, orchestrator],
    messages=[],
    max_round=5
)

# Manager coordinates discussion
manager = GroupChatManager(groupchat=group_chat, llm_config=llm_config)

# User request triggers group analysis
user_request = "review SPY at 600"
orchestrator.initiate_chat(manager, message=user_request)

Event Bus Integration

Dependencies

Depends on:

Optionally depends on:

Related:

Priority & Timeline

Priority: P2 - MEDIUM
Target: Q1-Q2 2026 (after core agents are implemented)
Size: Extra Large (XL)
Component: Multi-Agent System, Orchestration

Open Questions

  1. Coordination pattern: Sequential, group chat, or voting? (needs discussion)
  2. Performance: Will multi-agent debate be too slow for "fast entry" UX goal?
  3. Disagreement handling: What if agents strongly disagree? Show debate to user or hide it?
  4. Agent weights: Should VoterAgent (proven 0.856 Sharpe) have higher weight than new agents?

Notes

  • This is an exploration issue - requires design discussion before implementation
  • Start with simple sequential pattern, evolve to group chat if needed
  • Preserve human-in-loop principle: agents suggest, humans decide
  • Don't overcomplicate: if single VoterAgent works well, multi-agent adds complexity

Next Steps

  1. Discuss coordination pattern preference
  2. Implement remaining agents (Complete remaining AutoGen agents - Focus on Integration #310)
  3. Prototype simple sequential coordination
  4. Test with paper trading, measure performance impact
  5. Iterate based on user feedback

Activity

  1. self-assigned this
    on Nov 10, 2025
  2. changed the title [-]Multi-Agent Coordination & Debate System[/-] [+][Agent][Feature] Multi-Agent Coordination & Debate System[/+] on Nov 29, 2025
  3. iAmGiG commented on Dec 1, 2025

    @iAmGiG
    OwnerAuthor

    Status Update

    Infrastructure Foundation Complete:

    Remaining Work:

    Timeline: Q1-Q2 2026 - after remaining agents (#310) are implemented.

    Adding 'future' label.

  4. added
    futureFuture feature - planned for later implementation
    on Dec 1, 2025
  5. changed the title [-][Agent][Feature] Multi-Agent Coordination & Debate System[/-] [+][Future][Agent][Feature] Multi-Agent Coordination & Debate System[/+] on Dec 1, 2025
  6. added
    track:backlogFuture enhancements - parked for later consideration
    agentsAgent code (retired in #331)
    and removed
    futureFuture feature - planned for later implementation
    on Dec 14, 2025
  7. iAmGiG commented on Mar 18, 2026

    @iAmGiG
    OwnerAuthor

    Status (March 2026): Long-term agent coordination. Multi-agent debate system for consensus trading decisions.

  8. changed the title [-][Future][Agent][Feature] Multi-Agent Coordination & Debate System[/-] [+]Agents: make one tool round trip reachable from the CLI, or retire the dormant agent code[/+] on Oct 27, 2026
  9. iAmGiG commented on Oct 31, 2026

    @iAmGiG
    OwnerAuthor

    From the #625 audit (read-only, 310cc07). This decision now also settles these:

    • Reachable: nothing a user does reaches process_with_tools. Its four call sites are in generate_reply and _fetch_and_evaluate, and nothing calls those. ExecutorAgent is reached only through the three cancel tools.
    • Dead: src/autogen_agents/orchestration/orchestrator.py has no importer and calls methods that don't exist. voter_agent._fetch_and_evaluate makes a model call, discards the result and returns a fixed HOLD.
    • If the agents stay:
      • process_with_tools_async returns every failure as an ordinary string (base_agent.py:202-205).
      • It returns an un-awaited coroutine inside a running loop, where generate_reply promises a str (:174-178).
      • There's no overall deadline or call cap.
      • ExecutorAgent's prompt promises trades and cancels, but its model tools are market data only.
      • AgentConfig.tools, model_name and temperature never reach BaseAgent.
      • OrderManager calls broker methods the AlpacaTradingClient wrapper doesn't have (see the cancel issue).
  10. iAmGiG commented on Nov 1, 2026

    @iAmGiG
    OwnerAuthor

    The owner chose stage 1 on 2026-11-01: remove what's dead whichever way this goes (#650). Still open: keep the rest, or build on it.

    What a read-only mapping found, at 8623bab:

    The remaining choice:

    Whether a natural-language agent feature is wanted is the owner's call. Either way, 21 tools are flagged now, not the 22 #430 lists, as the execution-mode tools were removed in #644.

  11. added 2 commits that reference this issue on Nov 1, 2026
  12. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FeatureSignificant feature additionagentsAgent code (retired in #331)enhancementNew feature or requesttrack:backlogFuture enhancements - parked for later consideration

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions