A tool for executing recipe-like natural language instructions to create complex workflows. This project includes a recipe executor and a recipe creator, both of which can be used to automate tasks and generate new recipes.
NOTE This project is a very early, experimental project that is being explored in the open. There is no support offered and it will include frequent breaking changes. This project may be abandoned at any time. If you find it useful, it is strongly encouraged to create a fork and remain on a commit that works for your needs unless you are willing to make the necessary changes to use the latest version. This project is currently NOT accepting contributions and suggestions; please see the dev_guidance.md for more details.
git clone https://github.com/microsoft/recipe-tool.git
cd recipe-toolThis project is designed to help you automate tasks and generate new recipes using a flexible orchestration system. It consists of two main components: the Recipe Executor and the Recipe Creator.
The Recipe Executor is a tool for executing recipes defined in JSON format. It can perform various tasks, including file reading/writing, LLM generation, and sub-recipe execution. The executor uses a context system to manage shared state and data between steps.
The Recipe Creator is a tool for generating new recipes based on a recipe idea. It uses the Recipe Executor to create JSON recipe files that can be executed later. The creator can also take additional files as input to provide context for the recipe generation.
- Recipe Executor: Executes recipes defined in JSON format.
- Recipe Creator: Generates new recipes based on a recipe idea.
- Recipe Format: JSON-based recipe definitions with steps
- Context Management: Manages shared state and data between steps in a recipe.
- Step Types: Various operations including file reading/writing, LLM generation, and sub-recipe execution
- LLM Integration: Supports various LLMs for generating content and executing tasks.
- File Management: Reads and writes files as part of the recipe execution process.
- Sub-Recipe Execution: Allows for executing other recipes as part of a larger recipe.
- Logging: Provides logging for debugging and tracking recipe execution.
- Template Rendering: Liquid templates for dynamic content generation
Recommended installers:
If you plan on using Azure OpenAI with Managed Identity, you need to install the Azure CLI. Follow the instructions for your platform:
- Windows: Install the Azure CLI on Windows
- Linux: Install the Azure CLI on Linux
- macOS: Install the Azure CLI on macOS
Execute the following command to log in:
az loginThis command will open a browser window for you to log in. If you are using Managed Identity, ensure that your Azure CLI is configured to use the correct identity.
The core dependencies you need to install are:
make- for scripting installation steps of the various projects within this repouv- for managing installed versions ofpython- for installing python dependenciesGitHub cli- forai-context-filesmanipulation tool
Linux:
# make is installed by default on linux
sudo apt update && sudo apt install pipx && sudo apt install gh
pipx ensurepath
pipx install uv
macOS:
brew install make
brew install uv
brew install gh
Windows:
winget install ezwinports.make -e
winget install astral-sh.uv -e
winget install GitHub.cli -e
- Clone this repository
- Copy the environment file and configure your API keys:
cp .env.example .env # Edit .env to add your OPENAI_API_KEY and other optional API keys - Run the setup command to create a virtual environment and install dependencies:
make
- Activate the virtual environment:
- Linux/macOS:
source .venv/bin/activate - Windows:
.\.venv\Scripts\activate
- Linux/macOS:
- Test the installation by running the example recipe:
make recipe-executor-create
The project includes several useful make commands:
make: Sets up the virtual environment and installs all dependenciesmake ai-context-files: Builds AI context files for recipe executor developmentmake recipe-executor-create: Generates recipe executor code from scratch using the recipe itselfmake recipe-executor-edit: Revises existing recipe executor code using recipes
Execute a recipe using the command line interface:
recipe-tool --execute path/to/your/recipe.jsonYou can also pass context variables:
recipe-tool --execute path/to/your/recipe.json context_key=value context_key2=value2Example:
recipe-tool --execute recipes/example_simple/test_recipe.json model=azure/o4-miniCreate a new recipe using the command line interface:
recipe-tool --create path/to/your/recipe_idea.txtThis will generate a new recipe file based on the provided idea. You can also pass additional files for context:
recipe-tool --create path/to/your/recipe_idea.txt files=path/to/other_file.txt,path/to/another_file.txtExample:
recipe-tool --create recipes/recipe_creator/prompts/sample_recipe_idea.md
# Test it out
recipe-tool --execute output/analyze_codebase.json input=ai_context/generated/RECIPE_EXECUTOR_CODE_FILES.md,ai_context/generated/RECIPE_EXECUTOR_RECIPE_FILES.mdThe project contains:
recipe_tool.py: The main entry point for the command line interface for both recipe execution and creationrecipe_executor/: Core implementation with modules for execution, context management, and stepsrecipes/: Recipe definition files that can be executed
One of the more interesting aspects of this project is that it can generate its own code using recipes:
-
To generate the code from scratch:
make recipe-executor-create
-
To edit/revise existing code:
make recipe-executor-edit
This demonstrates the power of the Recipe Executor for code generation and maintenance tasks.
This project is currently NOT accepting contributions and suggestions; please see the dev_guidance.md for more details.
Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.