From a7712e6596fba20b72c451ebb9ff732460ee34fd Mon Sep 17 00:00:00 2001 From: mike dupont Date: Thu, 19 Oct 2023 09:46:36 -0400 Subject: [PATCH] ghost coder is now working, agent protocol running now you can run : ` sudo docker-compose up -d mockopenai ghostcoder ` ` sudo docker-compose logs -f mockopenai ghostcoder &` ` sudo docker-compose run arena` --- .gitmodules | 6 ++++ README.md | 4 +++ arena/Dockerfile | 8 ++++- arena/agent.json | 6 ++++ arena/run.py | 47 +++++++++++++++++++++++++++++ data.json | 6 ++++ docker-compose.yml | 31 +++++++++++++++++-- logs/todo.txt | 1 + vendor/Mutant-AI | 1 - vendor/act_base | 2 +- vendor/agent-protocol-client-python | 1 + vendor/agent-protocol-sdk-python | 1 + vendor/aorwall | 2 +- vendor/bored.sh | 10 ++++++ 14 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 arena/agent.json create mode 100644 arena/run.py create mode 100644 data.json create mode 100644 logs/todo.txt delete mode 160000 vendor/Mutant-AI create mode 160000 vendor/agent-protocol-client-python create mode 160000 vendor/agent-protocol-sdk-python create mode 100644 vendor/bored.sh diff --git a/.gitmodules b/.gitmodules index 2d6a799..972d804 100644 --- a/.gitmodules +++ b/.gitmodules @@ -187,3 +187,9 @@ [submodule "vendor/vikyw89"] path = vendor/vikyw89 url = https://github.com/vikyw89/Auto-GPT +[submodule "vendor/agent-protocol-client-python"] + path = vendor/agent-protocol-client-python + url = https://github.com/AI-Engineer-Foundation/agent-protocol-client-python +[submodule "vendor/agent-protocol-sdk-python"] + path = vendor/agent-protocol-sdk-python + url = https://github.com/AI-Engineer-Foundation/agent-protocol-sdk-python diff --git a/README.md b/README.md index 3ba51fd..d7529d7 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,7 @@ we start with the results of the download of the change stats Auto-GPT/stats/fil `sudo docker-compose build` `sudo docker-compose up mockopenai` `sudo docker-compose run auto-gpt-chat-gpt-prompts ` + + +# Example of verbose build +`sudo docker-compose --progress=plain --log-level DEBUG --ansi=never --verbose build ghostcoder` diff --git a/arena/Dockerfile b/arena/Dockerfile index 10e22f5..6f8a85a 100644 --- a/arena/Dockerfile +++ b/arena/Dockerfile @@ -1 +1,7 @@ -from debian \ No newline at end of file +from h4ckermike/act_base +add vendor/agent-protocol-client-python/ /opt/agent-protocol +add vendor/agent-protocol-sdk-python/ /opt/agent-protocol-sdk +add arena/agent.json /tmp/ +add arena/run.py /tmp/ +RUN pip install /opt/agent-protocol +RUN pip install /opt/agent-protocol-sdk diff --git a/arena/agent.json b/arena/agent.json new file mode 100644 index 0000000..4a4ef06 --- /dev/null +++ b/arena/agent.json @@ -0,0 +1,6 @@ +{ + "input":"Write hello", + "additional_input":{ + "test_run_id": "123" + } +} diff --git a/arena/run.py b/arena/run.py new file mode 100644 index 0000000..38cd1aa --- /dev/null +++ b/arena/run.py @@ -0,0 +1,47 @@ +import asyncio + +from agent_protocol.models import StepRequestBody +from agent_protocol_client import ( + Configuration, + ApiClient, + StepRequestBody, + TaskRequestBody, + AgentApi, +) + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = Configuration(host="http://ghostcoder:8000") + + +async def main(): + # Enter a context with an instance of the API client + async with ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = AgentApi(api_client) + task_request_body = TaskRequestBody(input="Write 'Hello world!' to hi.txt.") + + response = await api_instance.create_agent_task( + task_request_body=task_request_body + ) + print("The response of AgentApi->create_agent_task:\n") + print(response) + print("\n\n") + + task_id = response.task_id + i = 1 + + while ( + step := await api_instance.execute_agent_task_step( + task_id=task_id, step_request_body=StepRequestBody(input=str(i)) + ) + ) and step.is_last is False: + print("The response of AgentApi->execute_agent_task_step:\n") + print(step) + print("\n\n") + i += 1 + + print("Agent finished its work!") + + +asyncio.run(main()) diff --git a/data.json b/data.json new file mode 100644 index 0000000..4a4ef06 --- /dev/null +++ b/data.json @@ -0,0 +1,6 @@ +{ + "input":"Write hello", + "additional_input":{ + "test_run_id": "123" + } +} diff --git a/docker-compose.yml b/docker-compose.yml index e63a60a..fb61965 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,15 @@ version: '3' services: + arena: depends_on: - mockopenai - - the_agency_1 + - ghostcoder build: - context : arena + context : . + dockerfile: arena/Dockerfile + #entrypoint: bash -c "curl -d @/tmp/agent.json --request POST http://ghostcoder:8000/ap/v1/agent/tasks " + entrypoint: python /tmp/run.py act_base: #root base of action build: vendor/act_base @@ -356,3 +360,26 @@ services: #poetry run agent start forge --setup #poetry run agbenchmark --mock #poetry run agbenchmark --test=WriteFile + + ghostcoder: + #ports: + # - "8001:8000" # we can expose ports for each bot + #CMD ["poetry", "run", "python", "autogpt/__main__.py"] + entrypoint: bash -c "poetry run python -m forge agent start ghostcoder" + #entrypoint: bash + environment: + - GITHUB_PAT="${GITHUB_PAT}" + - GITHUB_REPO="jmikedupont2/ai-ticket" + - OPENAI_API_KEY=your-openai-api-key + - OPENAI_API_BASE=http://mockopenai:5000/v1 + - AGENT_WORKSPACE=/tmp/workspace/ + - DATABASE_STRING=sqlite:///agent.db + build: + context: vendor/aorwall/ + dockerfile: autogpts/ghostcoder/Dockerfile + args: + BASE_IMAGE: h4ckermike/basic_agent + volumes: + - ./vendor/aorwall/benchmark:/benchmark + - ./vendor/aorwall/autogpts/ghostcoder:/app/ #mount the source in for editing witho + - ./tests/ai_settings.yaml:/tmp/ai_settings.yaml diff --git a/logs/todo.txt b/logs/todo.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/logs/todo.txt @@ -0,0 +1 @@ + diff --git a/vendor/Mutant-AI b/vendor/Mutant-AI deleted file mode 160000 index 2f79caa..0000000 --- a/vendor/Mutant-AI +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2f79caa6b901d006a78c1ac9e69db4465c0f971a diff --git a/vendor/act_base b/vendor/act_base index dbd8163..e0dadf6 160000 --- a/vendor/act_base +++ b/vendor/act_base @@ -1 +1 @@ -Subproject commit dbd81631ba84fd0f5c252fc7df8fe99b1f6a4bec +Subproject commit e0dadf60d906d3c7e9e96ce2fe0b69870b953dae diff --git a/vendor/agent-protocol-client-python b/vendor/agent-protocol-client-python new file mode 160000 index 0000000..a9006c7 --- /dev/null +++ b/vendor/agent-protocol-client-python @@ -0,0 +1 @@ +Subproject commit a9006c766fb00dc3d570af586be1a1297c5092d6 diff --git a/vendor/agent-protocol-sdk-python b/vendor/agent-protocol-sdk-python new file mode 160000 index 0000000..8ba4c9c --- /dev/null +++ b/vendor/agent-protocol-sdk-python @@ -0,0 +1 @@ +Subproject commit 8ba4c9c2dc8d3faca1870e2b8822fbd6d9e9df37 diff --git a/vendor/aorwall b/vendor/aorwall index e9b64ad..5cbde57 160000 --- a/vendor/aorwall +++ b/vendor/aorwall @@ -1 +1 @@ -Subproject commit e9b64adae9fce180a392c726457e150177e746fb +Subproject commit 5cbde570e53a8e4489b01120bee49e39005aade1 diff --git a/vendor/bored.sh b/vendor/bored.sh new file mode 100644 index 0000000..033d49f --- /dev/null +++ b/vendor/bored.sh @@ -0,0 +1,10 @@ +git submodule add https://github.com/jinho-kim-osd/osGPT +git submodule add https://github.com/bsenst/FritzGPT +git submodule add https://github.com/murnanedaniel/Asimov +git submodule add https://github.com/polywrap/evo.ninja +git submodule add https://github.com/cluna80/Mutant-AI +git submodule add https://github.com/gordonwilliamsburg/test gordonwilliamsburg +git submodule add https://github.com/joslangarica/AutoGPT joslangarica +git submodule add https://github.com/isayahc/AutoGPT isayahc +git submodule add https://github.com/merwanehamadi/Auto-GPT merwanehamadi +git submodule add https://github.com/HMDCrew/AutoGPT HMDCrew