├── .circleci └── config.yml ├── LICENSE ├── README.md ├── kurtosis.yml └── main.star /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | executors: 4 | ubuntu_vm: 5 | machine: 6 | image: ubuntu-2004:202201-02 7 | 8 | jobs: 9 | run_starlark: 10 | executor: ubuntu_vm 11 | resource_class: xlarge 12 | steps: 13 | 14 | # Set up Kurtosis 15 | - run: | 16 | echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list 17 | sudo apt update 18 | sudo apt install kurtosis-cli 19 | - checkout 20 | 21 | - run: kurtosis analytics disable 22 | 23 | - run: kurtosis engine restart 24 | 25 | - run: | 26 | kurtosis run ${PWD} '{"OPENAI_API_KEY": "test", "PORT_OVERRIDE": 60040}' 27 | 28 | workflows: 29 | build: 30 | jobs: 31 | # -- PR check jobs ------------------------------------------ 32 | - run_starlark: 33 | filters: 34 | branches: 35 | ignore: -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Kurtosis Tech 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # agentGPT Package 2 | 3 | Let your AI Agents loose locally in just 2 commands, made possible by [Kurtosis](https://github.com/kurtosis-tech/kurtosis) 4 | 5 | Assuming you have Kurtosis [installed](https://docs.kurtosis.com/install/); replace _YOUR_API_KEY_HERE_ with your actual OpenAI API key 6 | 7 | ```bash 8 | kurtosis run github.com/kurtosis-tech/agentgpt-package '{"OPENAI_API_KEY": "YOUR_API_KEY_HERE"}' 9 | ``` 10 | 11 | Then just visit it on your browser at `http://localhost:3000` 12 | 13 | ## Docker Image Note 14 | 15 | Currently this project is working with a self published image at `h4ck3rk3y/agentgpt`. If you have the [`agentGPT`](https://github.com/reworkd/AgentGPT) repo cloned locally, do the following instead from inside the `agentGPT` repository: 16 | 17 | ```bash 18 | ./setup.sh --docker 19 | kurtosis run github.com/kurtosis-tech/agentgpt-package '{"OPENAI_API_KEY": "YOUR_API_KEY_HERE", "IMAGE": "IMAGE_NAME"}' 20 | ``` 21 | 22 | Where `IMAGE_NAME` is the desired image name. The `IMAGE` arg overrides the `IMAGE` with which the container runs. 23 | 24 | 25 | ## Exposed Port Note 26 | 27 | By default we expose the port `3000`; if you are running into port conflicts or want to change it for any other reason use the `PORT_OVERRIDE` arg; as follows (using 3030 as an example): 28 | 29 | ```bash 30 | kurtosis run github.com/kurtosis-tech/agentgpt-package '{"OPENAI_API_KEY": "YOUR_API_KEY_HERE", "PORT_OVERRIDE": 3030}' 31 | ``` 32 | -------------------------------------------------------------------------------- /kurtosis.yml: -------------------------------------------------------------------------------- 1 | name: "github.com/kurtosis-tech/agentgpt-package" -------------------------------------------------------------------------------- /main.star: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY_ENV_VAR = "OPENAI_API_KEY" 2 | 3 | # WARNING DON'T USE IT IN PRODUCTION 4 | # OVERRIDE THIS BY PASSING YOUR OWN NEXTAUTH_SECRET INSIDE ARGS 5 | DEFAULT_NEXTAUTH_SECRET = "tcqlc6bKBaTiZ6KocEVoWJ3F5Q2IB9OAYWH/0OvrRck=" 6 | 7 | DEFAULT_IMAGE = "h4ck3rk3y/agentgpt:e1de6b784" 8 | # Set args to {"IMAGE": "YOUR_IMAGE_HERE"} to pull a different image than h4ck3rk3y/agentgpt 9 | IMAGE_OVERRIDE_KEY = "IMAGE" 10 | 11 | DEFAULT_PORT_TO_EXPOSE = 3000 12 | HTTP_PORT_ON_CONTAINER = 3000 13 | # pass PORT_OVERRIDE arg key to expose the server on something else apart from 3000 14 | PORT_OVERRIDE_ARG_KEY = "PORT_OVERRIDE" 15 | 16 | # We don't validate this; we just let it go 17 | TEST_API_KEY = "test" 18 | 19 | def run(plan, args): 20 | 21 | if OPENAI_API_KEY_ENV_VAR not in args: 22 | fail("{0} is necessary to be passed".format(OPENAI_API_KEY_ENV_VAR)) 23 | 24 | openai_api_key = args[OPENAI_API_KEY_ENV_VAR] 25 | 26 | env_vars = get_default_env(openai_api_key) 27 | 28 | for key in args: 29 | if key == OPENAI_API_KEY_ENV_VAR or key not in env_vars: 30 | continue 31 | plan.print("Overriding default value {0} with passed value {1} for {2}".format(env_vars[key], args[key], key)) 32 | env_vars[key] = args[key] 33 | 34 | exposed_port = args.get(PORT_OVERRIDE_ARG_KEY, DEFAULT_PORT_TO_EXPOSE) 35 | image = args.get(IMAGE_OVERRIDE_KEY, DEFAULT_IMAGE) 36 | 37 | plan.add_service( 38 | name = "agentgpt", 39 | config = ServiceConfig( 40 | image = image, 41 | ports = { 42 | "http": PortSpec(number = HTTP_PORT_ON_CONTAINER, transport_protocol = "TCP") 43 | }, 44 | public_ports = { 45 | "http": PortSpec(number = exposed_port, transport_protocol = "TCP"), 46 | }, 47 | env_vars = env_vars 48 | ) 49 | ) 50 | 51 | return { 52 | "agentGPT URL": "http://127.0.0.1:{0}".format(exposed_port) 53 | } 54 | 55 | 56 | def validate_api_key(api_key): 57 | if api_key == TEST_API_KEY: 58 | return 59 | 60 | if len(api_key) != 51: 61 | fail("Invalid API Key; api keys must be 51 characters long and begin with sk-") 62 | 63 | if api_key[0:3] != "sk-": 64 | fail("Invalid API Key; api keys must be 51 characters long and begin with sk-") 65 | 66 | for character in api_key[3:]: 67 | if not character.isalnum(): 68 | fail("Invalid API Key; api keys must be 51 characters long and begin with sk-. Characters after sk- can only be alphanumeric got {0}".format(character)) 69 | 70 | 71 | def get_default_env(openai_api_key): 72 | return { 73 | "NODE_ENV": "development", 74 | "NEXTAUTH_SECRET": DEFAULT_NEXTAUTH_SECRET, 75 | "NEXTAUTH_URL": "http://localhost:3000", 76 | "OPENAI_API_KEY": openai_api_key, 77 | "DATABASE_URL": "file:../db/db.sqlite", 78 | } --------------------------------------------------------------------------------