Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add debate work pattern. resolves #257 #328

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zhjuzi
Copy link
Contributor

@zhjuzi zhjuzi commented Mar 1, 2025

Debate Agent Framework with LLM-driven Tool Execution

Description

Implementation of a complete Debate Agent Framework including a new work pattern, enhanced execution agent, and a sample application. The framework supports LLM-driven tool decision-making and flexible debate workflows, allowing for better handling of complex debate scenarios and enhancing execution capabilities through intelligent tool selection.

System Architecture

未命名绘图 (1)

Features

Debate Work Pattern (debate_work_pattern.py)

  • Complete implementation of debate flow work pattern
  • Support for collaborative work among planning, critique, and execution agents
  • Integrated consensus evaluation mechanism for multi-round debates
  • Flexible debate history management
  • Configurable round limits and consensus thresholds

EnhancedExecutingAgentTemplate (enhanced_executing_agent_template.py)

  • LLM-powered tool selection and parameter generation
  • Dynamic tool calling with feedback loop
  • Tool description formatting injected into prompts
  • Tool call history tracking for enhanced decision making
  • Iterative tool execution support

Debate Agent Template (debate_agent_template.py)

  • Implementation of complete debate agent template
  • Configuration-driven design aligned with AgentUniverse framework
  • Standardized interface implementation
  • Expert framework integration support
  • Flexible debate orchestration and agent coordination

Critique Agent Template (critique_agent_template.py)

  • Dedicated critique agent template implementation
  • Support for generating critique_score for consensus evaluation
  • Structured feedback mechanism for concerns and suggestions
  • JSON output parsing for consistent evaluation

Debate Flow Process

graph TD
    User[User Input] --> DebateAgent[Debate Agent Template]
    
    subgraph "Debate Work Pattern"
        DebateAgent --> Planning[Planning Agent]
        Planning --> Critique[Critique Agent]
        Critique --> |Consensus Check| Decision{Consensus Reached?}
        Decision -->|No| Planning
        Decision -->|Yes| Execution[Enhanced Executing Agent]
    end
    
    Execution -->|Tool Selection| ToolCalling[LLM Tool Calling]
    ToolCalling -->|JSON Format| Tools[Available Tools]
    Tools --> Results[Execution Results]
    Results --> Output[Final Output]
Loading

Technical Details

  • Hybrid evaluation strategy to assess consensus between planning and critique agents
  • LLM-generated critique_score as primary evaluation mechanism
  • Rule-based evaluation using concern count as fallback strategy
  • LLM-based tool selection instead of hardcoded tool calls
  • Tool call chain implementation for multi-step execution
  • Configuration-driven framework design pattern

Consensus Evaluation Process

  1. Primary Strategy: Use LLM-generated critique_score

    • The CritiqueAgentTemplate outputs a 'critique_score' field (0-1 range)
    • This score directly represents the critic's assessment of the plan quality
    • The score is parsed from the LLM's structured JSON output
  2. Fallback Strategy: Rule-based evaluation

    • If critique_score is missing, count the number of concerns
    • No concerns = complete consensus (1.0)
    • Each concern reduces consensus by 0.1 (linear relationship)

Example Application

  • Complete debate agent application example provided
  • Multi-tool integration (including markdown_writer_tool)
  • Demonstration of full debate workflow
  • Includes necessary configuration files and test code

Test Results

image
image
image

Checklist

  • [√] Code follows project coding style
  • [√] Added necessary documentation
  • [√] Added type hints and docstrings
  • [√] Properly implemented error handling and user feedback
  • [√] Maintained compatibility with existing APIs
  • [√] Improved code organization and maintainability
  • [√] Provided complete example application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant