-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcreate_agent
executable file
·56 lines (43 loc) · 1.94 KB
/
create_agent
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Get the agent name from the first argument
agent_name="$1"
# Directory path
dir_path="./gentpool/pool/${agent_name}"
echo "Initializing agent ${agent_name} in folder ${dir_path}, continue? (y/n)"
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
# Create the directory if it doesn't exist
mkdir -p "${dir_path}"
# Create the files
touch "${dir_path}/__init__.py"
touch "${dir_path}/agent.yaml"
touch "${dir_path}/prompt.py"
touch "${dir_path}/tool.py"
# Initialize the content in the __init__.py file
echo "from .prompt import *" > "${dir_path}/__init__.py"
echo "from .tool import *" >> "${dir_path}/__init__.py"
# Register the agent in the pool
echo "from .${agent_name} import *" >> "./gentpool/pool/__init__.py"
# Initialize the content in the agent.yaml file
echo "### Author: ###" > "${dir_path}/agent.yaml"
echo "name: ${agent_name}" > "${dir_path}/agent.yaml"
echo "type: " >> "${dir_path}/agent.yaml"
echo "version: " >> "${dir_path}/agent.yaml"
echo "description: " >> "${dir_path}/agent.yaml"
echo "target_tasks: " >> "${dir_path}/agent.yaml"
echo "prompt_template: " >> "${dir_path}/agent.yaml"
echo "llm: " >> "${dir_path}/agent.yaml"
echo "plugins: " >> "${dir_path}/agent.yaml"
echo "memory: " >> "${dir_path}/agent.yaml"
# Initialize the content in the prompt.py file
echo "### Define your custom prompt here. Check prebuilts in gentopia.prompt :)###" > "${dir_path}/prompt.py"
echo "from gentopia.prompt import *" >> "${dir_path}/prompt.py"
echo "from gentopia import PromptTemplate" >> "${dir_path}/prompt.py"
# Initialize the content in the tool.py file
echo "### Define your custom tool here. Check prebuilts in gentopia.tool (:###" > "${dir_path}/tool.py"
echo "from gentopia.tools import *" >> "${dir_path}/tool.py"
echo "Agent ${agent_name} has been initialized."
else
echo "Exiting..."
exit 1
fi