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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142# AutoPack demo
This is a small demo of [AutoPack](https://autopack.ai). This example is an Autonomous AI Agent capable of accomplishing
tasks with no predetermined tools. It will search for, install, and use tools needed to accomplish the task without
any human intervention.
Here is how to use it, including an example run.
## Safety note
This program is unsafe to run on any computer that you care about, and should not be run without human oversight. It
will automatically search for and execute unknown code, which inherently is dangerous. Putting it in the hands of AI
is dangerous on top of that.
I cannot recommend that anyone execute this code without a thorough understanding of what it is doing.
Use at your own risk.
## Walkthrough
### Setup
```bash
$ git clone https://github.com/erik-megarad/autopack-demo.git
$ cd autopack-demo
$ poetry install
```
### Execute the main.py script
```bash
$ python main.py
```
### It will prompt you for what you want to do
In this case we will have it gather information about our system and write it to a file.
```
What would you like me to do?
> Write the current OS name, OS version, and used disk percentage into a file called my_computer.txt
```
## After this step everything is automatic
After you provide input you can sit back and watch it accomplish its task.
### Packs are installed
Based on the user's input, the program will (using AI) determine what tools are best for the task given. It will
then install those packs and automatically provide them to LangChain.
```
Installing pack: erik-megarad/my_tools/os_info
Cloning repo into /src/orbital/demo/.autopack/erik_megarad_my_tools_os_info
Installing pack: erik-megarad/my_tools/disk_usage
psutil>=5.9.5 has been successfully installed.
Cloning repo into /src/orbital/demo/.autopack/erik_megarad_my_tools_disk_usage
Installing pack: hwchase17/langchain/write_file
```
### The agent will then go and complete the task.
```
> Entering new chain...
> I can use the `os_info` and `disk_usage` tools to gather the required information and then write it to a file. Let me do
> that for you.
Action:
```
```json
{
"action": "os_info",
"action_input": {}
}
```
```
Observation: {"os_name": "Darwin", "os_version": "22.5.0"}
Thought:The current OS name is Darwin and the OS version is 22.5.0. Now I need to get the disk usage percentage.
Action:
```
```json
{
"action": "disk_usage",
"action_input": {
"directory": "/"
}
}
```
```
Observation: {"total_bytes": 1720000159744, "used_bytes": 9059983360, "free_bytes": 1431739711488, "percent": 60.0}
Thought:The disk usage percentage is 60.0%. Now I will write this information to the file "my_computer.txt".
Action:
```
```json
{
"action": "write_file",
"action_input": {
"text": "OS Name: Darwin\nOS Version: 22.5.0\nDisk Usage: 60.0%",
"append": false,
"file_path": "my_computer.txt"
}
}
```
```
Observation: File written successfully to my_computer.txt.
Thought:The information has been successfully written to the file "my_computer.txt". Is there anything else I can help
you with?
Action:
```
```json
{
"action": "Final Answer",
"action_input": "The information has been written to the file my_computer.txt."
}
```
```
> Finished chain.
```
### Now that the task has finished, we can check the file.
```bash
$ cat my_computer.txt
OS Name: Darwin
OS Version: 22.5.0
Disk Usage: 60.0%
```