{"id":8187538,"url":"https://github.com/Doriandarko/maestro","last_synced_at":"2025-07-26T01:31:56.993Z","repository":{"id":228675471,"uuid":"774600961","full_name":"Doriandarko/maestro","owner":"Doriandarko","description":"A framework for Claude Opus to intelligently orchestrate subagents.","archived":false,"fork":false,"pushed_at":"2024-04-12T20:27:31.000Z","size":48,"stargazers_count":607,"open_issues_count":3,"forks_count":84,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-04-13T10:55:39.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Doriandarko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-19T20:48:29.000Z","updated_at":"2024-04-14T21:37:10.803Z","dependencies_parsed_at":"2024-03-25T00:23:23.206Z","dependency_job_id":"5440b43c-dea0-4db4-b7dd-18d62276bc8a","html_url":"https://github.com/Doriandarko/maestro","commit_stats":null,"previous_names":["doriandarko/maestro"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doriandarko%2Fmaestro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doriandarko%2Fmaestro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doriandarko%2Fmaestro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doriandarko%2Fmaestro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Doriandarko","download_url":"https://codeload.github.com/Doriandarko/maestro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227639329,"owners_count":17797615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-04-18T19:49:37.720Z","updated_at":"2024-12-01T22:30:56.126Z","avatar_url":"https://github.com/Doriandarko.png","language":"Python","funding_links":[],"categories":["Python","others","其他LLM框架","Automation","📦 Legacy \u0026 Inactive Projects","A01_文本生成_文本对话","Repos","Learning","Agent Categories","Other LLM Frameworks"],"sub_categories":["文章","大语言对话模型及数据","Repositories","\u003ca name=\"Unclassified\"\u003e\u003c/a\u003eUnclassified","Videos Playlists"],"readme":"# Maestro - A Framework for Claude Opus, GPT and local LLMs to Orchestrate Subagents\n\n\nThis Python script demonstrates an AI-assisted task breakdown and execution workflow using the Anthropic API. It utilizes two AI models, Opus and Haiku, to break down an objective into sub-tasks, execute each sub-task, and refine the results into a cohesive final output.\n\n## New: \n# Updated the original Maestro to support Claude 3.5 Sonnet\n```bash\npython maestro.py\n```\n\n\n# Use Maestro with any APIs, Anthropic, Gemini, OpenAI, Cohere, etc.\nThanks to a rewrite of the codebase using LiteLLM, it's now much easier to select the model you want.\n\nSimply\n#### Set environment variables for API keys for the services you are using\nos.environ[\"OPENAI_API_KEY\"] = \"YOUR KEY\" \n\nos.environ[\"ANTHROPIC_API_KEY\"] = \"YOUR KEY\"\n\nos.environ[\"GEMINI_API_KEY\"] = \"YOUR KEY\"\n\n#### Define the models to be used for each stage\nORCHESTRATOR_MODEL = \"gemini/gemini-1.5-flash-latest\"\n\nSUB_AGENT_MODEL = \"gemini/gemini-1.5-flash-latest\"\n\nREFINER_MODEL = \"gemini/gemini-1.5-flash-latest\"\n\nOr gpt-3.5-turbo, etc.\n\nFirst install litellm\n```bash\npip install litellm\n```\n\nAfeter installing dependecies run\n\n```bash\npython maestro-anyapi.py\n```\n\n\n## GPT-4o\n\nThe GPT script has been updated from the ground up to support the code capabilities of GPT-4o\n\nAfeter installing dependecies run\n\n```bash\npython maestro-gpt4o.py\n```\n\n## Run locally with LMStudio or Ollama\n\n### Lmstudio\n\nFirst download the app here\nhttps://lmstudio.ai/\n\nThen run the local server using your preferred method. I also recommend removing any system prompt for the app (leave your prompt field empty so it can take advantage of the script prompts).\n\nThen\n```bash\npython maestro-lmstudio.py\n```\n\n\n### Ollama\nMestro now runs locally thanks to the Ollama platform. Experience the power of Llama 3 locally! \n\nBefore running the script\n\nInstall Ollama client from here\nhttps://ollama.com/download\n\nthen\n\n```bash\npip install ollama\n```\nAnd \n\n```bash\nollama.pull('llama3:70b')\n```\nThis will depend on the model you want to use it, you only need to do it once or if you want to update the model when a new version it's out.\nIn the script I am using both versions but you can customize the model you want to use\n\nollama.pull('llama3:70b')\nollama.pull('llama3:8b')\n\nThen\n\n```bash\npython maestro-ollama.py\n```\n\n## Highly requested features\n- GROQ SUPPORT\nExperience the power of maestro thanks to Groq super fast api responses.\n```bash\npip install groq\n```\nThen\n\n```bash\npython maestro-groq.py\n```\n\n\n- SEARCH 🔍\n\nNow, when it's creating a task for its subagent, Claude Opus will perform a search and get the best answer to help the subagent solve that task even better.\n\nMake sure you replace your Tavil API for search to work\n\nGet one here https://tavily.com/\n  \n- GPT4 SUPPORT\n\nAdd support for GPT-4 as an orchestrator in maestro-gpt.py\nSimply\n```bash\npython maestro-gpt.py\n```\n\nAfter you complete your installs.\n\n\n## Features\n\n- Breaks down an objective into manageable sub-tasks using the Opus model\n- Executes each sub-task using the Haiku model\n- Provides the Haiku model with memory of previous sub-tasks for context\n- Refines the sub-task results into a final output using the Opus model\n- Generates a detailed exchange log capturing the entire task breakdown and execution process\n- Saves the exchange log to a Markdown file for easy reference\n- Utilizes an improved prompt for the Opus model to better assess task completion\n- Creates code files and folders when working on code projects.\n\n## Prerequisites\n\nTo run this script, you need to have the following:\n\n- Python installed\n- Anthropic API key\n- Required Python packages: `anthropic` and `rich`\n\n## Installation\n\n1. Clone the repository or download the script file.\n2. Install the required Python packages by running the following command:\n\n```bash\npip install -r requirements.txt\n```\n\n3. Replace the placeholder API key in the script with your actual Anthropic API key:\n\n```python\nclient = Anthropic(api_key=\"YOUR_API_KEY_HERE\")\n```\n\nIf using search, replace your Tavil API\n```python\ntavily = TavilyClient(api_key=\"YOUR API KEY HERE\")\n```\n\n## Usage\n\n1. Open a terminal or command prompt and navigate to the directory containing the script.\n2. Run the script using the following command:\n\n```bash\npython maestro.py\n```\n\n3. Enter your objective when prompted:\n\n```bash\nPlease enter your objective: Your objective here\n```\n\nThe script will start the task breakdown and execution process. It will display the progress and results in the console using formatted panels.\n\nOnce the process is complete, the script will display the refined final output and save the full exchange log to a Markdown file with a filename based on the objective.\n\n## Code Structure\n\nThe script consists of the following main functions:\n\n- `opus_orchestrator(objective, previous_results=None)`: Calls the Opus model to break down the objective into sub-tasks or provide the final output. It uses an improved prompt to assess task completion and includes the phrase \"The task is complete:\" when the objective is fully achieved.\n- `haiku_sub_agent(prompt, previous_haiku_tasks=None)`: Calls the Haiku model to execute a sub-task prompt, providing it with the memory of previous sub-tasks.\n- `opus_refine(objective, sub_task_results)`: Calls the Opus model to review and refine the sub-task results into a cohesive final output.\n\nThe script follows an iterative process, repeatedly calling the opus_orchestrator function to break down the objective into sub-tasks until the final output is provided. Each sub-task is then executed by the haiku_sub_agent function, and the results are stored in the task_exchanges and haiku_tasks lists.\n\nThe loop terminates when the Opus model includes the phrase \"The task is complete:\" in its response, indicating that the objective has been fully achieved.\n\nFinally, the opus_refine function is called to review and refine the sub-task results into a final output. The entire exchange log, including the objective, task breakdown, and refined final output, is saved to a Markdown file.\n\n## Customization\n\nYou can customize the script according to your needs:\n\n- Adjust the max_tokens parameter in the client.messages.create() function calls to control the maximum number of tokens generated by the AI models.\n- Change the models to what you prefer, like replacing Haiku with Sonnet or Opus.\n- Modify the console output formatting by updating the rich library's Panel and Console configurations.\n- Customize the exchange log formatting and file extension by modifying the relevant code sections.\n\n## License\n\nThis script is released under the MIT License.\n\n## Acknowledgements\n\n- Anthropic for providing the AI models and API.\n- Rich for the beautiful console formatting.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Doriandarko/maestro\u0026type=Date)](https://star-history.com/#Doriandarko/maestro\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDoriandarko%2Fmaestro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDoriandarko%2Fmaestro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDoriandarko%2Fmaestro/lists"}