https://github.com/simonmesmith/agentflow Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Customer Stories + White papers, Ebooks, Webinars + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. {{ message }} simonmesmith / agentflow Public * Notifications * Fork 1 * Star 50 Complex LLM Workflows from Simple JSON. License MIT license 50 stars 1 fork Activity Star Notifications * Code * Issues 10 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights simonmesmith/agentflow This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/s] Use Git or checkout with SVN using the web URL. [gh repo clone simonm] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @simonmesmith simonmesmith Merge pull request #41 from simonmesmith/ simonmesmith-patch-1 ... 8227741 Aug 8, 2023 Merge pull request #41 from simonmesmith/simonmesmith-patch-1 Update README.md to include verbose option 8227741 Git stats * 48 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows Make text updates to close #18 August 5, 2023 17:00 agentflow Add verbose option to close #20 August 8, 2023 13:37 tests Add get_url() function to close #37 August 8, 2023 11:08 .flake8 Fix flake8 format issue August 4, 2023 15:13 .gitignore Initial commit August 2, 2023 16:57 LICENSE Make text updates to close #18 August 5, 2023 17:00 README.md Update README.md to include verbose option August 8, 2023 13:41 example.env Set up August 2, 2023 17:05 requirements.in Add get_url() function to close #37 August 8, 2023 11:08 requirements.txt Add get_url() function to close #37 August 8, 2023 11:08 run.py Add verbose option to close #20 August 8, 2023 13:37 View code Agentflow: Complex LLM Workflows from Simple JSON Why Agentflow? Installation and Use Creating Your Own Flows Creating Your Own Functions License README.md Agentflow: Complex LLM Workflows from Simple JSON Python lint and test Agentflow is designed to be a powerful yet user-friendly tool for creating and executing workflows powered by large language models (LLMs). With Agentflow, you can: * Craft workflows in plain English: Workflows are written in human-readable JSON files. * Develop custom functions: Extend Agentflow's capabilities as per your needs. * Generate autonomous outputs: Maintain control while allowing the system to work independently. Why Agentflow? While LLM interfaces like ChatGPT and Bard facilitate turn-by-turn conversations, they limit automation possibilities. Tools like AutoGPT and BabyAGI aim to address this by empowering LLMs to autonomously create and execute to-do lists. However, these tools can't always guarantee the desired outcomes. Agentflow offers a balanced solution. It allows you to define workflows in an easy-to-understand JSON format, which LLMs then execute step-by-step. You can include functions in your workflows to enhance the LLMs' capabilities, enabling the execution of complex multi-step processes. Installation and Use Agentflow is currently in development. To try it: 1. Sign up for the OpenAI API and get an API key 2. Clone or download this repository. 3. Create a .env file from example.env and insert your OpenAI API key. 4. Install the necessary dependencies by running pip install -r requirements.txt. Now, you're ready to run Agentflow: * Run python -m run --flow=example to run a basic example flow. * To try a workflow with variables, run python -m run --flow= example_with_variables --variables 'market=college students' 'price_point=$50'. * To see task completion in real-time, use the -v verbose option, like this: python -m run --flow=example -v Creating Your Own Flows Creating flows is straightforward. You can use example.json or example_with_variables.json as a starting point. If you prefer to create a flow from scratch, use the following format: { "system_message": "An optional message that guides the model's behavior.", "tasks": [ { "action": "Instruct the LLM here!" }, { "action": "Actions can have settings, including function calls and temperature, like so:", "settings": { "function_call": "save_file", "temperature": 0.5 } }, { "action": "..." } ] } Creating Your Own Functions You can extend Agentflow's capabilities by creating your own functions. To start, you can just copy a function file like save_file.py and modify it. Alternatively, you can create a new function from scratch. First, create a new file in the functions directory. The file name will be the function name. For instance, functions/save_file.py creates a function called save_file. Next, create a function class in the format FunctionName that inherits from BaseFunction. If you do this, and use the correct JSON function definition, you can incorporate your new function into your workflows. Please note: It's a good idea to create tests for your functions, to make sure they behave the way you expect. Otherwise, you may not know whether you're getting errors from the LLM or from your function. License Agentflow is licensed under the MIT License. About Complex LLM Workflows from Simple JSON. Resources Readme License MIT license Activity Stars 50 stars Watchers 1 watching Forks 1 fork Report repository Releases No releases published Packages 0 No packages published Languages * Python 100.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.