Automatic Generation of Agentic AI Crews for Financial Modeling Tasks
Final Year Project (BSCS) β FAST National University, Karachi
Based on: "Agentic AI Systems for Financial Services" by Okpala et al. (arXiv:2502.05439, 2025)
AutoCrew extends the base paper by introducing a Meta Agent that automatically generates multi-agent crew configurations from natural language. Instead of hardcoding agents, tasks, and tools in Python, you describe the task in English and the system builds everything dynamically.
The project provides two paths for comparison:
- Path A (Manual): Hardcoded agents, tasks, and tools β replicates the base paper
- Path B (AutoCrew): Meta Agent generates a JSON config, Crew Factory builds live agents from it
Both paths share the same tools, Human-in-the-Loop (HITL) gate, and CrewAI execution engine. A built-in comparison framework evaluates both side-by-side on accuracy, F1 score, timing, and MRM verdict.
AutoCrew/
βββ src/
β βββ main.py # Entry point (manual/auto/compare)
β βββ config.py # LLM provider setup (Groq/Gemini/Ollama/Mock)
β βββ state.py # Shared state between crews
β β
β βββ meta_agent/ # Path B: Auto crew generation
β β βββ orchestrator.py # Chains the 5-step pipeline
β β βββ task_decomposer.py # NL task β subtask list
β β βββ agent_selector.py # Subtask β agent role + persona
β β βββ tool_assigner.py # Agent β tool names from registry
β β βββ instruction_writer.py# Generate detailed task instructions
β β βββ json_generator.py # Assemble crew_config.json
β β
β βββ crew_factory/ # JSON β live CrewAI objects
β β βββ crew_builder.py # Parses JSON, builds Agent/Task/Crew
β β βββ auto_runner.py # Runs the auto pipeline end-to-end
β β
β βββ manual/ # Path A: Base paper replication
β β βββ modeling_crew.py # Hardcoded modeling agents
β β βββ mrm_crew.py # Hardcoded MRM agents
β β βββ manual_runner.py # Runs the manual pipeline
β β
β βββ tools/ # Shared tools (both paths use these)
β β βββ code_execution.py # Executes Python scripts
β β βββ eda_tool.py # Automated EDA on CSV files
β β βββ cag_tool.py # Compliance checking tool
β β βββ tool_registry.py # String β tool instance mapping
β β
β βββ evaluation/ # Comparison & reporting
β β βββ comparison.py # Run both paths, compare metrics
β β βββ metrics_collector.py # Extract accuracy/F1/timing from output
β β βββ generate_charts.py # Generate all figures (PNG)
β β βββ report_generator.py # Generate PDF report (ReportLab)
β β βββ terminal_logger.py # Generate Terminal output
β β
β βββ hitl/ # Human-in-the-loop
β βββ human_gate.py # Y/N approval gate between phases
β
βββ data/ # Place your datasets here
β βββ .gitkeep
β
βββ configs/ # Auto-generated crew configs
β βββ generated/
β βββ .gitkeep
β
βββ prompts/ # LLM prompt templates
β βββ decompose_task.txt
β βββ select_agents.txt
β βββ assign_tools.txt
β βββ write_instructions.txt
β
βββ registries/ # Agent and tool catalogs
β βββ agent_templates.json
β βββ tool_catalog.json
β
βββ tests/
β βββ .gitkeep
β
βββ .env # API keys (create this yourself)
βββ .gitignore
βββ .gitattributes
βββ requirements.txt
βββ README.md
git clone https://github.com/ssarimm/AutoCrew-Meta-Agent-Researchpython -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activatepip install -r requirements.txtPlace your CSV datasets in the data/ folder:
| # | Dataset | Source | Task |
|---|---|---|---|
| 1 | credit_card_approval.csv |
UCI ML Repository | Binary classification (approve/reject) |
| 2 | creditcard_2023.csv |
Kaggle | Fraud detection (imbalanced) |
| 3 | cs-training.csv |
Kaggle - Give Me Some Credit | Credit scoring (financial distress) |
Create a .env file in the project root:
# Pick one (or more) LLM provider
#Add Api Keys in `.env` file at root directory
OPENROUTER_API_KEY= python -m src.mainYou'll be prompted to select:
- LLM Provider β Groq / Gemini / Ollama / Mock / Open Router / Others
- Dataset β Credit Approval / Fraud Detection / Credit Scoring
- Mode:
1Manual Pipeline (Path A - base paper)2AutoCrew Pipeline (Path B - meta agent)3Comparison Mode (runs both, generates comparison report)
After a run, you'll find:
| Location | Contents |
|---|---|
results/AutoCrew_Report.pdf |
Full PDF report with charts |
results/auto_results_*.json |
Raw metrics from auto path |
results/comparison_*.md |
Markdown comparison report |
results/comparison_*.json |
Raw comparison data |
figures/*.png |
Generated charts (5 figures) |
configs/generated/*.json |
Auto-generated crew configs |
The Meta Agent converts a natural language task into a complete crew configuration in 5 steps:
"Predict credit approval"
β Task Decomposer (subtasks)
β Agent Selector (roles + personas)
β Tool Assigner (tools from registry)
β Instruction Writer (detailed prompts)
β JSON Generator (crew_config.json)
Each step is one LLM call with structured JSON output. Total time: ~6 seconds on Groq.
User Input β Meta Agent β crew_config.json β Crew Factory β Modeling Crew β HITL Gate β MRM Crew β Verdict
- Use
credit_card_approval.csvfor demos β it's small (689 rows) and won't exhaust free this - If rate-limited, wait 24 hours or switch to Gemini (higher free tier)
- Run modes 1 and 2 separately if you want to avoid rate limits during comparison mode
| # | Contribution | Description |
|---|---|---|
| 1 | Meta Agent | LLM-powered 5-step orchestrator for automatic crew creation |
| 2 | JSON Config | Structured crew_config.json generated from natural language |
| 3 | Crew Factory | JSON parser that builds live CrewAI Agent/Task/Crew objects |
| 4 | Dual-Path Architecture | Manual vs Auto for fair, controlled comparison |
| 5 | Tool Registry | Extensible string-to-tool mapping with validation |
| 6 | Evaluation Framework | Side-by-side metrics (accuracy, F1, timing, verdict) |
- Framework: CrewAI + LangChain
- LLM Routing: LiteLLM
- ML: scikit-learn, pandas, numpy
- Reporting: ReportLab (PDF), matplotlib (charts)
- Language: Python 3.10+
This project is part of an academic Final Year Project (FYP) at FAST National University, Karachi.