Provides reusable CrewAI tools and agents for solving linear programming problems, mixed-integer optimization models, translating natural language prompts into LP JSON format, and diagnosing infeasibility issues through the CrewAI multi-agent framework.
Crew Optimizer
Crew Optimizer rebuilds the original optimisation project around the CrewAI ecosystem. It provides reusable CrewAI tools and agents capable of solving linear programs via SciPy's HiGHS backend, exploring mixed-integer models with a lightweight branch-and-bound search (or OR-Tools fallback), translating natural language prompts into LP JSON, and diagnosing infeasibility. You can embed the tools inside your own crews or call them programmatically through the OptimizerCrew convenience wrapper, or serve them over the MCP protocol for clients such as Smithery.
Installation
This installs Crew Optimizer together with optional OR-Tools support for MILP solving. Add pytest, ruff, or other dev tools as needed (pip install pytest).
Quick Usage
To integrate with a wider multi-agent workflow, call crew.build_crew() to obtain a Crew populated with the LP, MILP, and parser agents. Provide model inputs through CrewAI’s shared context as usual.
MCP / Smithery Hosting
Crew Optimizer ships an MCP server (python -m crew_optimizer.server) that wraps the same solvers. The repository already contains a Smithery manifest (smithery.json) and build config (smithery.yaml).
Push the repository to GitHub.
In Smithery, choose Publish an MCP Server, connect GitHub, and select the repo.
Smithery installs the package (
pip install .) and launchesmcp http src/crew_optimizer/server.py --port 3333using the bundled startup script.The server exposes the following tools:
solve_linear_programsolve_mixed_integer_programparse_natural_languagediagnose_infeasibilitysolve_word_problem_with_data- Solve optimization problems using data from files
For local testing:
Testing
Install test dependencies (pip install pytest) and run:
The suite covers the LP solver, MILP branch-and-bound, and the NL parser.
Solving Word Problems with Data Files
The MCP server includes a solve_word_problem_with_data tool that can parse data files (CSV, JSON, Excel) and use them to solve optimization word problems. This is particularly useful when you have data in files and want to formulate and solve optimization problems based on that data.
Example Usage
The tool supports:
CSV/TSV files: Automatically detects and parses comma or tab-separated values
JSON files: Parses JSON arrays or objects
Excel files: Requires
pandasandopenpyxl(install withpip install crew-optimizer[excel])Auto-detection: Automatically detects file format if not specified
The parsed data is incorporated into the problem description, allowing the natural language parser to extract values and formulate constraints and objective functions based on the actual data.
Licence
Distributed under the MIT Licence. See LICENSE for details.