Here's the revised README.md that accurately reflects the current system architecture and functionality:
SeqCV is a sophisticated task execution framework that employs recursive decomposition and multi-agent collaboration to handle complex tasks. The system features:
- Recursive task decomposition for handling complex objectives
- Multi-model fallback mechanism with primary and backup LLM clients
- Quality-controlled execution with iterative refinement
- Result accumulation across recursive levels and agent rounds
graph TD
A[Task Input] --> B[Initial Execution]
B --> C{Quality Check}
C -->|Pass| D[Accumulate Results]
C -->|Fail| E[Task Decomposition]
E --> F[Subtask 1]
E --> G[Subtask 2]
E --> H[Subtask N]
F & G & H --> I[Combine Results]
I --> C
D --> J[Final Output]
-
Task Initialization
- Receives objective (e.g., "Write comprehensive AI report")
- Configures primary and fallback LLM clients
-
Initial Execution Phase
- Multiple AI agents attempt task completion in parallel
- Primary LLM client (configurable) handles initial request
- Automatic fallback to alternative models if primary fails
-
Quality Validation
- Output evaluated against completion criteria:
- Content completeness
- Relevance to objective
- Structural integrity
- Pass: Proceeds to result accumulation
- Fail: Triggers recursive decomposition
- Output evaluated against completion criteria:
-
Recursive Decomposition
- System SeqCVks task into logical subtasks:
- Subtask 1 (e.g., "AI historical development")
- Subtask 2 (e.g., "Current applications")
- Subtask N (e.g., "Emerging trends")
- Each subtask repeats the execution cycle
- System SeqCVks task into logical subtasks:
-
Result Handling
- Per-round accumulation: Agents append new content each round
- Cross-agent selection: Best result chosen via
_select_best_result - Recursive accumulation: Results propagate through call stack via
accumulated_resultparameter
-
Termination Conditions
- Successful completion (
_is_task_completereturns True) - Maximum recursion depth reached
- All fallback options exhausted
- Successful completion (
self.llm_configs = [
{"provider": "openai", "model": Config.GPT_MODEL}, # Primary
{"provider": "openrouter", "model": "meta-llama/llama-3.1-8b-instruct:free"}, # Fallback 1
{"provider": "openrouter", "model": "mistralai/mistral-7b-instruct:free"} # Fallback 2
]-
Hierarchical Preservation:
- Each recursion level receives parent's
best_resultasaccumulated_result - Final output contains concatenated results from all levels
- Each recursion level receives parent's
-
Round-Level Aggregation:
combined_result = f"{current_results[agent_id]}\n{new_text}".strip()
- Maintains complete execution history within each recursion level
-
Quality-Based Selection:
- Employs weighted scoring across multiple dimensions
- Only highest-quality results propagate through recursion
-
JSON Processing: Robust handling with comment stripping and validation
cleaned_json_str = re.sub(r'//.*?$|/\*.*?\*/', '', context, flags=re.MULTILINE)
-
Logging: Comprehensive execution tracing
- Dual output (console + file)
- Detailed LLM response logging
- Fallback attempt records
-
Customization Points:
Config.GPT_MODEL: Primary model selectionConfig.TEMPERATURE: Creativity controlprompt.INIT_SeqCVKDOWN_PROMPT: Task decomposition template
The final output inherently:
- Contains all validated intermediate results
- Preserves the highest-quality contributions from each agent
- Maintains logical structure through recursive composition
For concise outputs, implement post-processing to:
- Remove duplicate content
- Filter intermediate artifacts
- Apply final stylistic polish