Overview
Implemented insrc/services/agents/agent_general_coder.py:19, the GeneralCoder class provides a clean workspace for programming tasks through two specialized agents:
- General_Coder Agent: Plans code solutions and provides programming guidance
- Coder_Excute Agent: Executes code and returns results
Key Features
Code Generation
Write complete, executable code solutions from task descriptions
Code Execution
Execute code in a safe environment and return results
Debugging Help
Identify and fix errors with detailed explanations
File Management
Automatically track and summarize created files
Usage
Basic Usage
CLI Mode
- Direct Mode
- Via Unified Interface
Methods
create_code_tool()
Generate, execute code and return execution results. Source:src/services/agents/agent_general_coder.py:95
Detailed description of the task, including required operations and expected results (not code)
Additional background information or context for the task (includes user’s original question, necessary information, data paths, etc.)
List of Python libraries that might be needed for the task
Union[str, dict] - Execution results or dictionary with execution_result and file_summary
Example with Context
Configuration
Initialization Parameters
LLM configuration dictionary with API settings
Code execution configuration including
work_dir and use_docker settingsOptional connection ID for tracking
Optional callback function for sending messages
Optional list of previous conversation history
Working Directory
The agent automatically manages files in its working directory:Code Quality Features
The Programming Assistant follows best practices enforced through system prompts:Modular Code Organization
Modular Code Organization
For complex problems, the agent automatically:
- Breaks down tasks into logical components
- Creates separate files for each component
- Executes files in proper sequence
- Example:
data_fetcher.py,data_processor.py,visualizer.py
src/services/agents/agent_general_coder.py:85File Description Tracking
File Description Tracking
The agent automatically:
- Tracks all created files
- Adds descriptions using
insert_file_description_to_file() - Maintains a
Task_description.jsonfile - Only saves files after successful execution
src/services/agents/agent_general_coder.py:84Error Handling
Error Handling
The agent:
- Filters out failed execution attempts from history
- Only includes successful code in final output
- Provides clear error messages
- Retries with corrected code
src/services/agents/agent_general_coder.py:226Clean Code Standards
Clean Code Standards
Enforced practices:
- Avoid repetitive and redundant code
- Separate analysis from execution code
- Only output executable code in code blocks
- First explain approach, then provide clean code
- No mixed explanations within code blocks
src/services/agents/agent_general_coder.py:86File Management
Automatic File Summarization
The agent uses LLM to analyze created files and categorize them: Source:src/services/agents/agent_general_coder.py:146
Task Description File
The agent maintainsTask_description.json to track files across sessions:
Example Use Cases
- Data Analysis
- Algorithm Implementation
- Web Scraping
Integration with Scheduler
The Programming Assistant is accessible through the RepoMaster scheduler: Source:src/core/agent_scheduler.py:273
Conversation Parameters
The agent uses the following parameters for code generation conversations: Source:src/services/agents/agent_general_coder.py:125
Limitations
When to Use Programming Assistant
✅ Good for:- Writing standalone scripts and utilities
- Learning programming concepts with examples
- Implementing algorithms and data structures
- Quick prototyping and experimentation
- Debugging code snippets
- Tasks requiring specific libraries in repositories
- Complex multi-file projects with dependencies
- Tasks requiring web search or real-time data
- Working with existing codebases
Next Steps
Repository Agent
Learn about repository analysis and execution
Unified Interface
Use intelligent multi-agent orchestration