Skip to content

Commit 589817e

Browse files
committed
multi-agent WIP
Signed-off-by: Grant Linville <[email protected]>
1 parent 7297440 commit 589817e

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Multi-Agent Chat
2+
3+
In this example, we will create a tool that combines the [CLI Guide](./01-cli.md) and [API Guide](./02-api.md).
4+
This tool will be an agent with the ability to hand control over to two other agents:
5+
one with access to the `gh` CLI for GitHub, and one with access to the DigitalOcean API.
6+
7+
:::warning
8+
This script **does not install** or configure `gh`. We assume you've done that already.
9+
You must be logged in via `gh auth login`. [See here for more details](https://docs.github.com/en/github-cli/github-cli/quickstart)
10+
:::
11+
12+
## Creating the Main Agent
13+
14+
First, create the main agent in a new file called `agent.gpt`:
15+
16+
```
17+
Chat: true
18+
Agents: gh-agent.gpt, digitalocean-agent.gpt
19+
Context: github.com/gptscript-ai/context/multi-agent
20+
21+
You are a helpful assistant designed to assist the user with GitHub and DigitalOcean.
22+
Start by asking the user what they would like to do.
23+
```
24+
25+
This tool is a chatbot that can hand control over to two other agents: `gh-agent` and `digitalocean-agent`.
26+
The multi-agent context tool provides some additional information to the agent about how it can use the other agents available to it.
27+
28+
## Creating the GitHub Agent
29+
30+
Next, create the GitHub agent in a new file called `gh-agent.gpt`:
31+
32+
```
33+
Name: GitHub Agent
34+
Description: An agent with access to the GitHub CLI
35+
Chat: true
36+
Context: github.com/gptscript-ai/context/cli
37+
Context: learn-gh
38+
Param: request: the task that the user requested
39+
40+
You have the gh CLI for GitHub available to you. Use it to accomplish the requested task.
41+
42+
---
43+
Name: learn-gh
44+
45+
#!/usr/bin/env bash
46+
47+
echo "The following is the help text for the gh cli and some of its sub-commands. Use these when figuring out how to construct new commands. Note that the --search flag is used for filtering and sorting as well; there is no dedicated --sort flag."
48+
gh --help
49+
gh repo --help
50+
gh issue --help
51+
gh issue list --help
52+
gh issue create --help
53+
gh issue comment --help
54+
gh issue delete --help
55+
gh issue edit --help
56+
gh pr --help
57+
gh pr create --help
58+
gh pr checkout --help
59+
gh release --help
60+
gh release create --help
61+
```
62+
63+
This tool is largely the same as the one in the [CLI Guide](./01-cli.md), but with the addition of a `request` parameter that specifies the task the user requested.
64+
This allows the main agent to provide additional information to the GitHub agent when handing control to it.
65+
We also added a name and a description to this agent, so that the main agent better understands what to do with the GitHub agent.
66+
67+
68+
## Creating the DigitalOcean Agent
69+
70+
Next, create the DigitalOcean agent in a new file called `digitalocean-agent.gpt`:
71+
72+
```
73+
Name: DigitalOcean Agent
74+
Description: An agent with access to the DigitalOcean API to manage droplets and databases
75+
Chat: true
76+
Tools: droplets* from openapi.yaml
77+
Tools: databases* from openapi.yaml
78+
Tools: images* from openapi.yaml
79+
Tools: regions_list from openapi.yaml
80+
Tools: tags* from openapi.yaml
81+
Tools: sizes_list from openapi.yaml
82+
Tools: sshKeys_list from openapi.yaml
83+
Tools: sys.time.now
84+
Param: request: the task that the user requested
85+
86+
You are a helpful assistant with access to the DigitalOcean API to manage droplets and databases.
87+
Before creating, updating, or deleting anything, tell the user about the exact action you are going to take, and get their confirmation.
88+
Accomplish the requested task using the DigitalOcean API.
89+
```
90+
91+
This tool is largely the same as the one in the [API Guide](./02-api.md), but once again with an added `request` parameter and a name and description.
92+
93+
Make sure you also have a copy of the openapi.yaml file for DigitalOcean. Instructions for this are [here](./02-api.md#getting-started).
94+
95+
## Running the Multi-Agent Chat
96+
97+

0 commit comments

Comments
 (0)