5.8 KiB
5.8 KiB
Tasks — Agent Robustness Optimization
Priority 1: Configuration Foundation
- 1. Add new config fields to AppConfig
- 1.1 Add
max_data_context_retriesfield (default=2) withAPP_MAX_DATA_CONTEXT_RETRIESenv override toconfig/app_config.py - 1.2 Add
conversation_window_sizefield (default=10) withAPP_CONVERSATION_WINDOW_SIZEenv override toconfig/app_config.py - 1.3 Add
max_parallel_profilesfield (default=4) withAPP_MAX_PARALLEL_PROFILESenv override toconfig/app_config.py
- 1.1 Add
Priority 2: Data Privacy Fallback (R1–R3)
- 2. Implement error classification
- [-] 2.1 Add
_classify_error(error_message: str) -> strmethod toDataAnalysisAgentindata_analysis_agent.pywith regex patterns for KeyError, ValueError, NameError, empty DataFrame - [-] 2.2 Add
_extract_column_from_error(error_message: str) -> Optional[str]function toutils/data_privacy.py - [-] 2.3 Add
_lookup_column_in_profile(column_name, safe_profile) -> Optional[dict]function toutils/data_privacy.py
- [-] 2.1 Add
- 3. Implement enriched hint generation
- [-] 3.1 Add
generate_enriched_hint(error_message: str, safe_profile: str) -> strfunction toutils/data_privacy.py - [-] 3.2 Integrate retry logic into the
analyze()loop indata_analysis_agent.py: add per-round retry counter, call_classify_erroron failures, generate enriched hint when below retry limit, fall back to normal error handling at limit
- [-] 3.1 Add
Priority 3: Conversation History Trimming (R4–R5)
- 4. Implement conversation trimming
- [~] 4.1 Add
_trim_conversation_history()method toDataAnalysisAgentimplementing sliding window with first-message preservation - [~] 4.2 Add
_compress_trimmed_messages(messages: list) -> strmethod toDataAnalysisAgentthat generates summary with action types and success/failure, excluding code blocks and raw output - [~] 4.3 Call
_trim_conversation_history()at the start of each round in theanalyze()loop, after the first round
- [~] 4.1 Add
Priority 4: Analysis Template System (R6–R8)
- 5. Backend template integration
- [~] 5.1 Add optional
template_nameparameter toDataAnalysisAgent.analyze()method; retrieve template viaget_template(), prependget_full_prompt()to user requirement - [~] 5.2 Add
GET /api/templatesendpoint toweb/main.pyreturninglist_templates()result - [~] 5.3 Add optional
templatefield toStartRequestmodel inweb/main.py; pass template name to agent inrun_analysis_task
- [~] 5.1 Add optional
- 6. Frontend template selector
- [~] 6.1 Add template selector HTML section (cards above requirement input) to
web/static/index.html - [~] 6.2 Add template fetching, selection logic, and "No Template" default to
web/static/script.js - [~] 6.3 Add template card styles (
.template-card,.template-card.selected) toweb/static/clean_style.css
- [~] 6.1 Add template selector HTML section (cards above requirement input) to
Priority 5: Frontend Progress Bar (R9)
- 7. Backend progress updates
- [~] 7.1 Add
set_progress_callback(callback)method toDataAnalysisAgent; call callback at start of each round inanalyze()loop - [~] 7.2 Wire progress callback in
run_analysis_taskinweb/main.pyto updateSessionDataprogress fields - [~] 7.3 Add
current_round,max_rounds,progress_percentage,status_messagetoGET /api/statusresponse inweb/main.py
- [~] 7.1 Add
- 8. Frontend progress bar
- [~] 8.1 Add progress bar HTML element below the status bar area in
web/static/index.html - [~] 8.2 Add
updateProgressBar(percentage, message)function toweb/static/script.js; call it during polling whenis_runningis true; set to 100% on completion - [~] 8.3 Add progress bar styles with CSS transition animation to
web/static/clean_style.css
- [~] 8.1 Add progress bar HTML element below the status bar area in
Priority 6: Multi-File Chunked & Parallel Loading (R10–R11)
- 9. Chunked loading enhancement
- [~] 9.1 Add
_profile_chunked(file_path: str) -> strfunction toutils/data_loader.pythat profiles using first chunk + sampled subsequent chunks - [~] 9.2 Add
load_and_profile_data_smart(file_paths, max_file_size_mb) -> strfunction toutils/data_loader.pythat selects chunked vs full loading based on file size threshold - [~] 9.3 Update
DataAnalysisAgent.analyze()to use smart loader and expose chunked iterator in Code_Executor namespace for large files
- [~] 9.1 Add
- 10. Parallel profiling
- [~] 10.1 Add
_profile_files_parallel(file_paths: list) -> tuple[str, str]method toDataAnalysisAgentusingThreadPoolExecutorwithmax_parallel_profilesworkers - [~] 10.2 Update
DataAnalysisAgent.analyze()to call_profile_files_parallelwhen multiple files are provided, replacing sequentialbuild_safe_profile+build_local_profilecalls
- [~] 10.1 Add
Priority 7: Testing
- 11. Write property-based tests
- 11.1
PBTProperty test for error classification correctness (Property 1) usinghypothesis - 11.2
PBTProperty test for enriched hint content and privacy (Property 3) usinghypothesis - 11.3
PBTProperty test for env var config override (Property 4) usinghypothesis - 11.4
PBTProperty test for sliding window trimming invariants (Property 5) usinghypothesis - 11.5
PBTProperty test for trimming summary content (Property 6) usinghypothesis - 11.6
PBTProperty test for template prompt integration (Property 7) usinghypothesis - 11.7
PBTProperty test for invalid template error (Property 8) usinghypothesis - 11.8
PBTProperty test for parallel profile merge with error resilience (Property 11) usinghypothesis
- 11.1
- 12. Write unit and integration tests
- 12.1 Unit tests for error classifier with known error messages
- 12.2 Unit tests for conversation trimming at boundary conditions
- 12.3 Integration tests for
GET /api/templatesandPOST /api/startwith template field - 12.4 Integration tests for
GET /api/statusprogress fields