Skip to main content
Component: ErrorFixingMixin Module: gaia_agent_code.tools.error_fixing Import: from gaia_agent_code.tools.error_fixing import ErrorFixingMixin

Overview

ErrorFixingMixin provides automatic error detection and fixing capabilities using LLM-driven analysis. It handles syntax errors, linting issues, runtime errors, and includes workflow planning tools for complex projects. Key Features:
  • Automatic syntax error detection and fixing
  • LLM-based code correction
  • Pylint error fixing with iteration
  • Runtime error fixing
  • Architectural plan generation
  • Project structure creation
  • Workflow planning
  • GAIA.md initialization from codebase

Tool Specifications

1. auto_fix_syntax_errors

Scan project for syntax errors and fix them automatically. Parameters:
  • project_path (str, required): Path to project directory
Returns:

2. fix_code

Fix Python code using LLM analysis. Parameters:
  • file_path (str, required): Path to file to fix
  • error_description (str, optional): Error description
Returns:

3. fix_linting_errors

Fix pylint issues iteratively. Parameters:
  • file_path (str, required): Path to file
  • lint_issues (List[Dict], required): Pylint issues
Returns:

4. fix_python_errors

Fix runtime errors automatically. Parameters:
  • file_path (str, required): Path to file
  • error_message (str, required): Runtime error message
Returns:
Handled Errors:
  • NameError (add missing imports)
  • IndentationError (fix spacing)
  • TypeError (add type checking)

5. create_architectural_plan

Generate architectural plan for a project. Parameters:
  • query (str, required): Project requirements
  • project_type (str, optional): “application”, “library”, “game”, “api”
Returns:
Generated Plan Structure:

6. create_project_structure

Create folder structure from architectural plan. Parameters: None (uses self.plan) Returns:

7. implement_from_plan

Implement components from architectural plan. Parameters:
  • component (str, optional): Specific component to implement
  • auto_implement_all (bool, optional): Implement all (default: False)
Returns:

8. init_gaia_md

Initialize GAIA.md from codebase analysis. Parameters:
  • project_root (str, optional): Root directory (default: ”.”)
Returns:

9. create_workflow_plan

Plan a complex multi-step workflow. The code agent uses this when a user request can’t be satisfied by a single tool call — it decomposes the request into an ordered plan of tool invocations the agent then executes. Parameters:
  • query (str, required): Natural-language description of the workflow to plan
Returns:

Usage Examples

Example 1: Auto-Fix Syntax Errors

Example 2: Fix Code with LLM

Example 3: Fix Linting Errors

Example 4: Create Architectural Plan

Example 5: Initialize GAIA.md


LLM-Based Fixing

Fix Code Prompt Template

Return ONLY the corrected code, no explanations."""

Project Templates

Game Project Structure

API Project Structure


Testing Requirements

File: tests/agents/code/test_error_fixing.py

Dependencies


ErrorFixingMixin Technical Specification