frdel commited on
Commit
f317be2
·
1 Parent(s): 4a7d5e9

dev setup, guides, docs

Browse files
README.md CHANGED
@@ -3,14 +3,23 @@
3
  # `Agent Zero`
4
 
5
 
6
- [![Agent Zero Website](https://img.shields.io/badge/Website-agent--zero.ai-0A192F?style=for-the-badge&logo=vercel&logoColor=white)](https://agent-zero.ai) [![Thanks to Sponsors](https://img.shields.io/badge/GitHub%20Sponsors-Thanks%20to%20Sponsors-FF69B4?style=for-the-badge&logo=githubsponsors&logoColor=white)](https://github.com/sponsors/agent0ai) [![Follow on X](https://img.shields.io/badge/X-Follow-000000?style=for-the-badge&logo=x&logoColor=white)](https://x.com/Agent0ai) [![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/B8KZKNsPpj) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@AgentZeroFW) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jan-tomasek/) [![Follow on Warpcast](https://img.shields.io/badge/Warpcast-Follow-5A32F3?style=for-the-badge)](https://warpcast.com/agent-zero)
 
 
 
7
 
8
  [Introduction](#a-personal-organic-agentic-framework-that-grows-and-learns-with-you) •
9
  [Installation](./docs/installation.md) •
 
 
10
  [How to update](./docs/installation.md#how-to-update-agent-zero) •
11
  [Documentation](./docs/README.md) •
12
  [Usage](./docs/usage.md)
13
 
 
 
 
 
14
  </div>
15
 
16
 
@@ -54,7 +63,7 @@ From now on, please use this name for both `git clone` and `docker pull` command
54
  - Agent Zero uses the operating system as a tool to accomplish its tasks. It has no single-purpose tools pre-programmed. Instead, it can write its own code and use the terminal to create and use its own tools as needed.
55
  - The only default tools in its arsenal are online search, memory features, communication (with the user and other agents), and code/terminal execution. Everything else is created by the agent itself or can be extended by the user.
56
  - Tool usage functionality has been developed from scratch to be the most compatible and reliable, even with very small models.
57
- - **Default Tools:** Agent Zero includes tools like knowledge, webpage content, code execution, and communication.
58
  - **Creating Custom Tools:** Extend Agent Zero's functionality by creating your own custom tools.
59
  - **Instruments:** Instruments are a new type of tool that allow you to create custom functions and procedures that can be called by Agent Zero.
60
 
 
3
  # `Agent Zero`
4
 
5
 
6
+ [![Agent Zero Website](https://img.shields.io/badge/Website-agent--zero.ai-0A192F?style=for-the-badge&logo=vercel&logoColor=white)](https://agent-zero.ai) [![Thanks to Sponsors](https://img.shields.io/badge/GitHub%20Sponsors-Thanks%20to%20Sponsors-FF69B4?style=for-the-badge&logo=githubsponsors&logoColor=white)](https://github.com/sponsors/agent0ai) [![Follow on X](https://img.shields.io/badge/X-Follow-000000?style=for-the-badge&logo=x&logoColor=white)](https://x.com/Agent0ai) [![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/B8KZKNsPpj) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@AgentZeroFW) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jan-tomasek/) [![Follow on Warpcast](https://img.shields.io/badge/Warpcast-Follow-5A32F3?style=for-the-badge)](https://warpcast.com/agent-zero)
7
+
8
+
9
+ ## Documentation:
10
 
11
  [Introduction](#a-personal-organic-agentic-framework-that-grows-and-learns-with-you) •
12
  [Installation](./docs/installation.md) •
13
+ [Development](./docs/development.md) •
14
+ [Extensibility](./docs/extensibility.md) •
15
  [How to update](./docs/installation.md#how-to-update-agent-zero) •
16
  [Documentation](./docs/README.md) •
17
  [Usage](./docs/usage.md)
18
 
19
+ Or see DeepWiki generated documentation:
20
+
21
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/agent0ai/agent-zero)
22
+
23
  </div>
24
 
25
 
 
63
  - Agent Zero uses the operating system as a tool to accomplish its tasks. It has no single-purpose tools pre-programmed. Instead, it can write its own code and use the terminal to create and use its own tools as needed.
64
  - The only default tools in its arsenal are online search, memory features, communication (with the user and other agents), and code/terminal execution. Everything else is created by the agent itself or can be extended by the user.
65
  - Tool usage functionality has been developed from scratch to be the most compatible and reliable, even with very small models.
66
+ - **Default Tools:** Agent Zero includes tools like knowledge, code execution, and communication.
67
  - **Creating Custom Tools:** Extend Agent Zero's functionality by creating your own custom tools.
68
  - **Instruments:** Instruments are a new type of tool that allow you to create custom functions and procedures that can be called by Agent Zero.
69
 
docs/README.md CHANGED
@@ -4,6 +4,8 @@ To begin with Agent Zero, follow the links below for detailed guides on various
4
 
5
  - **[Installation](installation.md):** Set up (or [update](installation.md#how-to-update-agent-zero)) Agent Zero on your system.
6
  - **[Usage Guide](usage.md):** Explore GUI features and usage scenarios.
 
 
7
  - **[Architecture Overview](architecture.md):** Understand the internal workings of the framework.
8
  - **[Contributing](contribution.md):** Learn how to contribute to the Agent Zero project.
9
  - **[Troubleshooting and FAQ](troubleshooting.md):** Find answers to common issues and questions.
@@ -11,7 +13,7 @@ To begin with Agent Zero, follow the links below for detailed guides on various
11
  ### Your experience with Agent Zero starts now!
12
 
13
  - **Download Agent Zero:** Follow the [installation guide](installation.md) to download and run Agent Zero.
14
- - **Join the Community:** Join the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/Z2tun2N3) community to discuss ideas, ask questions, and collaborate with other contributors.
15
  - **Share your Work:** Share your Agent Zero creations, workflows and discoverings on our [Show and Tell](https://github.com/agent0ai/agent-zero/discussions/categories/show-and-tell) area on GitHub.
16
  - **Report Issues:** Use the [GitHub issue tracker](https://github.com/agent0ai/agent-zero/issues) to report framework-relative bugs or suggest new features.
17
 
 
4
 
5
  - **[Installation](installation.md):** Set up (or [update](installation.md#how-to-update-agent-zero)) Agent Zero on your system.
6
  - **[Usage Guide](usage.md):** Explore GUI features and usage scenarios.
7
+ - **[Development](development.md):** Set up a development environment for Agent Zero.
8
+ - **[Extensibility](extensibility.md):** Learn how to create custom extensions for Agent Zero.
9
  - **[Architecture Overview](architecture.md):** Understand the internal workings of the framework.
10
  - **[Contributing](contribution.md):** Learn how to contribute to the Agent Zero project.
11
  - **[Troubleshooting and FAQ](troubleshooting.md):** Find answers to common issues and questions.
 
13
  ### Your experience with Agent Zero starts now!
14
 
15
  - **Download Agent Zero:** Follow the [installation guide](installation.md) to download and run Agent Zero.
16
+ - **Join the Community:** Join the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/B8KZKNsPpj) community to discuss ideas, ask questions, and collaborate with other contributors.
17
  - **Share your Work:** Share your Agent Zero creations, workflows and discoverings on our [Show and Tell](https://github.com/agent0ai/agent-zero/discussions/categories/show-and-tell) area on GitHub.
18
  - **Report Issues:** Use the [GitHub issue tracker](https://github.com/agent0ai/agent-zero/issues) to report framework-relative bugs or suggest new features.
19
 
docs/architecture.md CHANGED
@@ -119,13 +119,8 @@ Agent Zero comes with a set of built-in tools designed to help agents perform ta
119
  | call_subordinate | Allows agents to delegate tasks to subordinate agents |
120
  | code_execution_tool | Allows agents to execute Python, Node.js, and Shell code in the terminal |
121
  | input | Allows agents to use the keyboard to interact with an active shell |
122
- | knowledge_tool | Enables agents to retrieve information from memory, knowledge base or online external sources |
123
  | response_tool | Allows agents to output a response |
124
  | memory_tool | Enables agents to save, load, delete and forget information from memory |
125
- | webpage_content_tool | Enables agents to fetch and analyze the text content of webpages |
126
-
127
- #### Knowledge Tool
128
- The `knowledge_tool` uses SearXNG to search the web and retrieve information. It can also search the local knowledge base and memory for relevant information. The tool returns a summary of the information, which can be used by the agent to make decisions or answer questions.
129
 
130
  #### SearXNG Integration
131
  Agent Zero has integrated SearXNG as its primary search tool, replacing the previous knowledge tools (Perplexity and DuckDuckGo). This integration enhances the agent's ability to retrieve information while ensuring user privacy and customization.
 
119
  | call_subordinate | Allows agents to delegate tasks to subordinate agents |
120
  | code_execution_tool | Allows agents to execute Python, Node.js, and Shell code in the terminal |
121
  | input | Allows agents to use the keyboard to interact with an active shell |
 
122
  | response_tool | Allows agents to output a response |
123
  | memory_tool | Enables agents to save, load, delete and forget information from memory |
 
 
 
 
124
 
125
  #### SearXNG Integration
126
  Agent Zero has integrated SearXNG as its primary search tool, replacing the previous knowledge tools (Perplexity and DuckDuckGo). This integration enhances the agent's ability to retrieve information while ensuring user privacy and customization.
docs/contribution.md CHANGED
@@ -4,6 +4,9 @@ Contributions to improve Agent Zero are very welcome! This guide outlines how t
4
 
5
  ## Getting Started
6
 
 
 
 
7
  1. **Fork the Repository:** Fork the Agent Zero repository on GitHub.
8
  2. **Clone Your Fork:** Clone your forked repository to your local machine.
9
  3. **Create a Branch:** Create a new branch for your changes. Use a descriptive name that reflects the purpose of your contribution (e.g., `fix-memory-leak`, `add-search-tool`, `improve-docs`).
 
4
 
5
  ## Getting Started
6
 
7
+ - See [development](development.md) for instructions on how to set up a development environment.
8
+ - See [extensibility](extensibility.md) for instructions on how to create custom extensions.
9
+
10
  1. **Fork the Repository:** Fork the Agent Zero repository on GitHub.
11
  2. **Clone Your Fork:** Clone your forked repository to your local machine.
12
  3. **Create a Branch:** Create a new branch for your changes. Use a descriptive name that reflects the purpose of your contribution (e.g., `fix-memory-leak`, `add-search-tool`, `improve-docs`).
docs/development.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Development manual for Agent Zero
2
+ This guide will show you how to setup a local development environment for Agent Zero in a VS Code compatible IDE, including proper debugger.
3
+
4
+ > [!WARNING]
5
+ > This guide is for developers and contributors. It assumes you have a basic understanding of how to use Git/GitHub, Docker, IDEs and Python.
6
+
7
+ > [!NOTE]
8
+ > - Agent Zero runs in a Docker container, this simplifies installation and ensures unified environment and behavior across systems.
9
+ > - Developing and debugging in a container would be complicated though, therefore we use a hybrid approach where the python framework runs on your machine (in VS Code for example) and only connects to a Dockerized instance when it needs to execute code or use other pre-installed functionality like the built-in search engine.
10
+
11
+
12
+ ## To follow this guide you will need:
13
+ 1. VS Code compatible IDE (VS Code, Cursor, Windsurf...)
14
+ 2. Python environment (Conda, venv, uv...)
15
+ 3. Docker (Docker Desktop, docker-ce...)
16
+ 4. (optional) Git/GitHub
17
+
18
+ > [!NOTE] I will be using clean VS Code, Conda and Docker Desktop in this example on MacOS.
19
+
20
+
21
+ ## Step 0: Install required software
22
+ - See the list above and install the software required if you don't already have it.
23
+ - You can choose your own variants, but Python, Docker and a VS Code compatible IDE are required.
24
+ - For Python you can choose your environment manager - base Python venv, Conda, uv...
25
+
26
+ ## Step 1: Clone or download the repository
27
+ - Agent Zero is available on GitHub [github.com/agent0ai/agent-zero](https://github.com/agent0ai/agent-zero).
28
+ - You can download the files using a browser and extract or run `git clone https://github.com/agent0ai/agent-zero` in your desired directory.
29
+
30
+ > [!NOTE] In my case, I used `cd ~/Desktop` and `git clone https://github.com/agent0ai/agent-zero`, so my project folder is `~/Desktop/agent-zero`.
31
+
32
+ ## Step 2: Open project folder in your IDE
33
+ - I will be using plain and clean VS Code for this example to make sure I don't skip any setup part, you can use any of it's variants like Cursor, Windsurf etc.
34
+ - Agent Zero comes with `.vscode` folder that contains basic setup, recommended extensions, and debugger profiles. These will help us a lot.
35
+
36
+ 1. Open your IDE and open the project folder using `File > Open Folder` and select your folder, in my case `~/Desktop/agent-zero`.
37
+ 2. You will probably be prompted to trust the directory, confirm that.
38
+ 3. You should now have the project open in your IDE
39
+ ![VS Code project](res/dev/devinst-1.png)
40
+
41
+ # Step 3: Prepare your IDE:
42
+ 1. Notice the prompt in lower right corner of the screenshot above to install recommended extensions, this comes from the `.vscode/extensions.json` file. It contains Python language support, debugger and error helper, install them by confirming the popup or manually in Extensions tab of your IDE. These are the extensions mentioned:
43
+ ```
44
+ usernamehw.errorlens
45
+ ms-python.debugpy
46
+ ms-python.python
47
+ ```
48
+
49
+ Now when you select one of the python files in the project, you should see proper Python syntax highlighting and error detection. It should immediately show some errors, because we did not yet install dependencies.
50
+ ![VS Code Python](res/dev/devinst-2.png)
51
+
52
+ 2. Prepare the python environment to run Agent Zero in. (⚠️ This step assumes you have some Python runtime installed.) By clicking the python version in lower right corner (3.13.1 in my example), you should get a list of available environments. You can click the `+ Create Virtual Environment` button. You might be prompted to select the environment manager if you have multiple installed. I have venv and Conda, I will select Conda here. I'm also prompted for desired python version, I will select 3.12, that is known to work well.
53
+ ![VS Code Python environments](res/dev/devinst-3.png)
54
+ ![VS Code Python environments](res/dev/devinst-4.png)
55
+
56
+ - Your new environment should be automatically activated. If not, select it in the lower right corner. You might need to open a new terminal in VS Code to reflect the changes with `Terminal > New Terminal` or clicking the `+` button in the terminal tab. Your terminal prompt should now start with your environment name/path, in my case `(/Users/frdel/Desktop/agent-zero/.conda)` This shows the environment is active in the terminal.
57
+
58
+ ![VS Code env terminal](res/dev/devinst-5.png)
59
+
60
+ 3. Install dependencies. Run these two commands in the terminal:
61
+ ```bash
62
+ pip install -r requirements.txt
63
+ playwright install chromium
64
+ ```
65
+ These will install all the python packages and browser binaries for playwright (browser agent).
66
+ Errors in the code editor caused by missing packages should now be gone. If not, try reloading the window.
67
+
68
+
69
+ ## Step 4: Run Agent Zero in the IDE
70
+ Great work! Now you should be able to run Agent Zero from your IDE including real-time debugging.
71
+ It will not be able to do code execution and few other features requiring the Docker container just yet, but most of the framework will already work.
72
+
73
+ 1. The project is pre-configured for debugging. Go to Debugging tab, select "run_ui.py" and click the green play button (or press F5 by default). The configuration can be found at `.vscode/launch.json`.
74
+
75
+ ![VS Code debugging](res/dev/devinst-6.png)
76
+
77
+ The framework will run at the default port 5000. If you open `http://localhost:5000` in your browser and see `ERR_EMPTY_RESPONSE`, don't panic, you may need to select another port like I did for some reason. If you need to change the defaut port, you can add `"--port=5555"` to the args in the `.vscode/launch.json` file or you can create a `.env` file in the root directory and set the `WEB_UI_PORT` variable to the desired port.
78
+
79
+ It may take a while the first time. You should see output like the screenshot below. The RFC error is ok for now as we did not yet connect our local development to another instance in docker.
80
+ ![First run](res/dev/devinst-7.png)
81
+
82
+
83
+ After inserting my API key in settings, my Agent Zero instance works. I can send a simple message and get a response.
84
+ ⚠️ Some tools like code execution will not work yet as they need to be connected to a Dockerized instance.
85
+
86
+ ![First message](res/dev/devinst-8.png)
87
+
88
+
89
+ ## Debugging
90
+ - You can try out the debugger already by placing a breakpoint somewhere in the python code.
91
+ - Let's open `python/api/message.py` for example and place a breakpoint at the beginning of the `communicate` function by clicking on the left of the row number. A red dot should appear showing a breakpoint is set.
92
+
93
+ ![Debugging](res/dev/devinst-9.png)
94
+
95
+ - Now when I send a message in the UI, the debugger will pause the execution at the breakpoint and allow me to inspect all the runtime variables and run the code step by step, even modify the variables or jump to another locations in the code. No more print statements needed!
96
+
97
+ ![Debugging](res/dev/devinst-10.png)
98
+
99
+
100
+ ## Step 5: Run another instance of Agent Zero in Docker
101
+ - Some parts of A0 require standardized linux environment, additional web services and preinstalled binaries that would be unneccessarily complex to set up in a local environment.
102
+ - To make development easier, we can use existing A0 instance in docker and forward some requests to be executed there using SSH and RFC (Remote Function Call).
103
+
104
+ 1. Pull the docker image `agent0ai/agent-zero` from Docker Hub and run it with a web port (`80`) mapped and SSH port (`22`) mapped.
105
+ If you want, you can also map the `/a0` folder to our local project folder as well, this way we can update our local instance and the docker instance at the same time.
106
+ This is how it looks in my example: port `80` is mapped to `8880` on the host and `22` to `8822`, `/a0` folder mapped to `/Users/frdel/Desktop/agent-zero`:
107
+
108
+ ![docker run](res/dev/devinst-11.png)
109
+ ![docker run](res/dev/devinst-12.png)
110
+
111
+
112
+ ## Step 6: Configure SSH and RFC connection
113
+ - The last step is to configure the local development (VS Code) instance and the dockerized instance to communicate with each other. This is very simple and can be done in the settings in the Web UI of both instances.
114
+ - In my example the dark themed instance is the VS Code one, the light themed one is the dockerized instance.
115
+
116
+ 1. Open the "Settings" page in the Web UI of your dockerized instance and go in the "Development" section.
117
+ 2. Set the `RFC Password` field to a new password and save.
118
+ 3. Open the "Settings" page in the Web UI of your local instance and go in the "Development" section.
119
+ 4. Here set the `RFC Password` field to the same password you used in the dockerized instance. Also set the SSH port and HTTP port the same numbers you used when creating the container - in my case `8822` for SSH and `8880` for HTTP. The `RFC Destination URL` will most probably stay `localhost` as both instances are running on the host machine.
120
+ 5. Click save and test by asking your agent to do something in the terminal, like "Get current OS version". It should be able to communicate with the dockerized instance via RFC and SSH and execute the command there, responding with something like "Kali GNU/Linux Rolling".
121
+
122
+ My Dockerized instance:
123
+ ![Dockerized instance](res/dev/devinst-14.png)
124
+
125
+ My VS Code instance:
126
+ ![VS Code instance](res/dev/devinst-13.png)
127
+
128
+
129
+ # 🎉 Congratulations! 🚀
130
+
131
+ You have successfully set up a complete Agent Zero development environment! You now have:
132
+
133
+ - ✅ A local development instance running in your IDE with full debugging capabilities
134
+ - ✅ A dockerized instance for code execution and system operations
135
+ - ✅ RFC and SSH communication between both instances
136
+ - ✅ The ability to develop, debug, and test Agent Zero features seamlessly
137
+
138
+ You're now ready to contribute to Agent Zero, create custom extensions, or modify the framework to suit your needs. Happy coding! 💻✨
139
+
140
+
141
+ ## Next steps
142
+ - See [extensibility](extensibility.md) for instructions on how to create custom extensions.
143
+ - See [contribution](contribution.md) for instructions on how to contribute to the framework.
docs/extensibility.md ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Extensibility framework in Agent Zero
2
+
3
+ > [!NOTE] Agent Zero is built with extensibility in mind. It provides a framework for creating custom extensions, agents, instruments, and tools that can be used to enhance the functionality of the framework.
4
+
5
+ ## Extensible components
6
+ - The Python framework controlling Agent Zero is built as simple as possible, relying on independent smaller and modular scripts for individual tools, API endpoints, system extensions and helper scripts.
7
+ - This way individual components can be easily replaced, upgraded or extended.
8
+
9
+ Here's a summary of the extensible components:
10
+
11
+ ### Extensions
12
+ Extensions are components that hook into specific points in the agent's lifecycle. They allow you to modify or enhance the behavior of Agent Zero at predefined extension points. The framework uses a plugin-like architecture where extensions are automatically discovered and loaded.
13
+
14
+ #### Extension Points
15
+ Agent Zero provides several extension points where custom code can be injected:
16
+
17
+ - **agent_init**: Executed when an agent is initialized
18
+ - **before_main_llm_call**: Executed before the main LLM call is made
19
+ - **message_loop_start**: Executed at the start of the message processing loop
20
+ - **message_loop_prompts_before**: Executed before prompts are processed in the message loop
21
+ - **message_loop_prompts_after**: Executed after prompts are processed in the message loop
22
+ - **message_loop_end**: Executed at the end of the message processing loop
23
+ - **monologue_start**: Executed at the start of agent monologue
24
+ - **monologue_end**: Executed at the end of agent monologue
25
+ - **reasoning_stream**: Executed when reasoning stream data is received
26
+ - **response_stream**: Executed when response stream data is received
27
+ - **system_prompt**: Executed when system prompts are processed
28
+
29
+ #### Extension Mechanism
30
+ The extension mechanism in Agent Zero works through the `call_extensions` function in `agent.py`, which:
31
+
32
+ 1. Loads default extensions from `/python/extensions/{extension_point}/`
33
+ 2. Loads agent-specific extensions from `/agents/{agent_profile}/extensions/{extension_point}/`
34
+ 3. Merges them, with agent-specific extensions overriding default ones based on filename
35
+ 4. Executes each extension in order
36
+
37
+ #### Creating Extensions
38
+ To create a custom extension:
39
+
40
+ 1. Create a Python class that inherits from the `Extension` base class
41
+ 2. Implement the `execute` method
42
+ 3. Place the file in the appropriate extension point directory:
43
+ - Default extensions: `/python/extensions/{extension_point}/`
44
+ - Agent-specific extensions: `/agents/{agent_profile}/extensions/{extension_point}/`
45
+
46
+ **Example extension:**
47
+
48
+ ```python
49
+ # File: /agents/_example/extensions/agent_init/_10_example_extension.py
50
+ from python.helpers.extension import Extension
51
+
52
+ class ExampleExtension(Extension):
53
+ async def execute(self, **kwargs):
54
+ # rename the agent to SuperAgent0
55
+ self.agent.agent_name = "SuperAgent" + str(self.agent.number)
56
+ ```
57
+
58
+ #### Extension Override Logic
59
+ When an extension with the same filename exists in both the default location and an agent-specific location, the agent-specific version takes precedence. This allows for selective overriding of extensions while inheriting the rest of the default behavior.
60
+
61
+ For example, if both these files exist:
62
+ - `/python/extensions/agent_init/example.py`
63
+ - `/agents/my_agent/extensions/agent_init/example.py`
64
+
65
+ The version in `/agents/my_agent/extensions/agent_init/example.py` will be used, completely replacing the default version.
66
+
67
+ ### Tools
68
+ Tools are modular components that provide specific functionality to agents. They are invoked by the agent through tool calls in the LLM response. Tools are discovered dynamically and can be extended or overridden.
69
+
70
+ #### Tool Structure
71
+ Each tool is implemented as a Python class that inherits from the base `Tool` class. Tools are located in:
72
+ - Default tools: `/python/tools/`
73
+ - Agent-specific tools: `/agents/{agent_profile}/tools/`
74
+
75
+ #### Tool Override Logic
76
+ When a tool with the same name is requested, Agent Zero first checks for its existence in the agent-specific tools directory. If found, that version is used. If not found, it falls back to the default tools directory.
77
+
78
+ **Example tool override:**
79
+
80
+ ```python
81
+ # File: /agents/_example/tools/response.py
82
+ from python.helpers.tool import Tool, Response
83
+
84
+ # example of a tool redefinition
85
+ # the original response tool is in python/tools/response.py
86
+ # for the example agent this version will be used instead
87
+
88
+ class ResponseTool(Tool):
89
+ async def execute(self, **kwargs):
90
+ print("Redefined response tool executed")
91
+ return Response(message=self.args["text"] if "text" in self.args else self.args["message"], break_loop=True)
92
+ ```
93
+
94
+ #### Tool Execution Flow
95
+ When a tool is called, it goes through the following lifecycle:
96
+ 1. Tool initialization
97
+ 2. `before_execution` method
98
+ 3. `execute` method (main functionality)
99
+ 4. `after_execution` method
100
+
101
+ ### API Endpoints
102
+ API endpoints expose Agent Zero functionality to external systems or the user interface. They are modular and can be extended or replaced.
103
+
104
+ API endpoints are located in:
105
+ - Default endpoints: `/python/api/`
106
+
107
+ Each endpoint is a separate Python file that handles a specific API request.
108
+
109
+ ### Helpers
110
+ Helper modules provide utility functions and shared logic used across the framework. They support the extensibility of other components by providing common functionality.
111
+
112
+ Helpers are located in:
113
+ - Default helpers: `/python/helpers/`
114
+
115
+ ### Prompts
116
+ Prompts define the instructions and context provided to the LLM. They are highly extensible and can be customized for different agents.
117
+
118
+ Prompts are located in:
119
+ - Default prompts: `/prompts/`
120
+ - Agent-specific prompts: `/agents/{agent_profile}/prompts/`
121
+
122
+ #### Prompt Features
123
+ Agent Zero's prompt system supports several powerful features:
124
+
125
+ ##### Variable Placeholders
126
+ Prompts can include variables using the `{{var}}` syntax. These variables are replaced with actual values when the prompt is processed.
127
+
128
+ **Example:**
129
+ ```markdown
130
+ # Current system date and time of user
131
+ - current datetime: {{date_time}}
132
+ - rely on this info always up to date
133
+ ```
134
+
135
+ ##### Dynamic Variable Loaders
136
+ For more advanced prompt customization, you can create Python files with the same name as your prompt files. These Python files act as dynamic variable loaders that generate variables at runtime.
137
+
138
+ When a prompt file is processed, Agent Zero automatically looks for a corresponding `.py` file in the same directory. If found, it uses this Python file to generate dynamic variables for the prompt.
139
+
140
+ **Example:**
141
+ If you have a prompt file `agent.system.tools.md`, you can create `agent.system.tools.py` alongside it:
142
+
143
+ ```python
144
+ from python.helpers.files import VariablesPlugin
145
+ from python.helpers import files
146
+
147
+ class Tools(VariablesPlugin):
148
+ def get_variables(self, file: str, backup_dirs: list[str] | None = None) -> dict[str, Any]:
149
+ # Dynamically collect all tool instruction files
150
+ folder = files.get_abs_path(os.path.dirname(file))
151
+ folders = [folder]
152
+ if backup_dirs:
153
+ folders.extend([files.get_abs_path(d) for d in backup_dirs])
154
+
155
+ prompt_files = files.get_unique_filenames_in_dirs(folders, "agent.system.tool.*.md")
156
+
157
+ tools = []
158
+ for prompt_file in prompt_files:
159
+ tool = files.read_file(prompt_file)
160
+ tools.append(tool)
161
+
162
+ return {"tools": "\n\n".join(tools)}
163
+ ```
164
+
165
+ Then in your `agent.system.tools.md` prompt file, you can use:
166
+ ```markdown
167
+ # Available Tools
168
+ {{tools}}
169
+ ```
170
+
171
+ This approach allows for highly dynamic prompts that can adapt based on available extensions, configurations, or runtime conditions. See existing examples in the `/prompts/` directory for reference implementations.
172
+
173
+ ##### File Includes
174
+ Prompts can include content from other prompt files using the `{{ include "./path/to/file.md" }}` syntax. This allows for modular prompt design and reuse.
175
+
176
+ **Example:**
177
+ ```markdown
178
+ # Agent Zero System Manual
179
+
180
+ {{ include "./agent.system.main.role.md" }}
181
+
182
+ {{ include "./agent.system.main.environment.md" }}
183
+
184
+ {{ include "./agent.system.main.communication.md" }}
185
+ ```
186
+
187
+ #### Prompt Override Logic
188
+ Similar to extensions and tools, prompts follow an override pattern. When the agent reads a prompt, it first checks for its existence in the agent-specific prompts directory. If found, that version is used. If not found, it falls back to the default prompts directory.
189
+
190
+ **Example of a prompt override:**
191
+
192
+ ```markdown
193
+ > !!!
194
+ > This is an example prompt file redefinition.
195
+ > The original file is located at /prompts.
196
+ > Only copy and modify files you need to change, others will stay default.
197
+ > !!!
198
+
199
+ ## Your role
200
+ You are Agent Zero, a sci-fi character from the movie "Agent Zero".
201
+ ```
202
+
203
+ This example overrides the default role definition in `/prompts/agent.system.main.role.md` with a custom one for a specific agent profile.
204
+
205
+ ## Subagent Customization
206
+ Agent Zero supports creating specialized subagents with customized behavior. The `_example` agent in the `/agents/_example/` directory demonstrates this pattern.
207
+
208
+ ### Creating a Subagent
209
+
210
+ 1. Create a directory in `/agents/{agent_profile}/`
211
+ 2. Override or extend default components by mirroring the structure in the root directories:
212
+ - `/agents/{agent_profile}/extensions/` - for custom extensions
213
+ - `/agents/{agent_profile}/tools/` - for custom tools
214
+ - `/agents/{agent_profile}/prompts/` - for custom prompts
215
+
216
+ ### Example Subagent Structure
217
+
218
+ ```
219
+ /agents/_example/
220
+ ├── extensions/
221
+ │ └── agent_init/
222
+ │ └── _10_example_extension.py
223
+ ├── prompts/
224
+ │ └── ...
225
+ └── tools/
226
+ ├── example_tool.py
227
+ └── response.py
228
+ ```
229
+
230
+ In this example:
231
+ - `_10_example_extension.py` is an extension that renames the agent when initialized
232
+ - `response.py` overrides the default response tool with custom behavior
233
+ - `example_tool.py` is a new tool specific to this agent
234
+
235
+ ## Best Practices
236
+ - Keep extensions focused on a single responsibility
237
+ - Use the appropriate extension point for your functionality
238
+ - Leverage existing helpers rather than duplicating functionality
239
+ - Test extensions thoroughly to ensure they don't interfere with core functionality
240
+ - Document your extensions to make them easier to maintain and share
docs/installation.md CHANGED
@@ -50,8 +50,8 @@ The following user guide provides instructions for installing and running Agent
50
  <img src="res/setup/image-13.png" alt="docker installed" height="100"/>
51
  <br><br>
52
 
53
- > [!IMPORTANT]
54
- > **macOS Configuration:** In Docker Desktop's preferences (Docker menu) → Settings →
55
  > Advanced, enable "Allow the default Docker socket to be used (requires password)."
56
 
57
  ![docker socket macOS](res/setup/macsocket.png)
@@ -74,17 +74,24 @@ The following user guide provides instructions for installing and running Agent
74
  > docker pull agent0ai/agent-zero
75
  > ```
76
 
77
- 2.2. Create a data directory for persistence:
 
 
 
 
 
78
  - Choose or create a directory on your machine where you want to store Agent Zero's data
79
  - This can be any location you prefer (e.g., `C:/agent-zero-data` or `/home/user/agent-zero-data`)
 
80
  - This directory will contain all your Agent Zero files, like the legacy root folder structure:
 
81
  - `/memory` - Agent's memory and learned information
82
  - `/knowledge` - Knowledge base
83
  - `/instruments` - Instruments and functions
84
  - `/prompts` - Prompt files
85
  - `/work_dir` - Working directory
86
  - `.env` - Your API keys
87
- - `settings.json` - Your Agent Zero settings
88
 
89
  > [!TIP]
90
  > Choose a location that's easy to access and backup. All your Agent Zero data
@@ -94,16 +101,22 @@ The following user guide provides instructions for installing and running Agent
94
  - In Docker Desktop, go back to the "Images" tab
95
  - Click the `Run` button next to the `agent0ai/agent-zero` image
96
  - Open the "Optional settings" menu
97
- - Set the port to `0` in the second "Host port" field (for automatic port assignment)
98
 
99
  Optionally you can map local folders for file persistence:
100
- - Under "Volumes", configure:
101
- - Host path: Your chosen directory (e.g., `C:\agent-zero-data`)
102
- - Container path: `/a0`
 
 
 
103
 
104
- ![docker port mapping](res/setup/3-docker-port-mapping.png)
105
 
106
  - Click the `Run` button in the "Images" tab.
 
 
 
 
107
  - The container will start and show in the "Containers" tab
108
 
109
  ![docker containers](res/setup/4-docker-container-started.png)
@@ -205,11 +218,6 @@ The Settings page is the control center for selecting the Large Language Models
205
 
206
  ## Important Considerations
207
 
208
- > [!CAUTION]
209
- > Changing the `embedding_llm` will re-index all the memory and knowledge, and
210
- > requires clearing the `memory` folder to avoid errors, as the embeddings can't be
211
- > mixed in the vector database. Note that this will DELETE ALL of Agent Zero's memory.
212
-
213
  ## Installing and Using Ollama (Local Models)
214
  If you're interested in Ollama, which is a powerful tool that allows you to run various large language models locally, here's how to install and use it:
215
 
@@ -251,7 +259,9 @@ ollama pull <model-name>
251
 
252
  3. Write your model code as expected by Ollama, in the format `llama3.2` or `qwen2.5:7b`
253
 
254
- 4. Click `Save` to confirm your settings.
 
 
255
 
256
  ![ollama](res/setup/settings/4-local-models.png)
257
 
@@ -275,6 +285,10 @@ Once you've downloaded some models, you might want to check which ones you have
275
  ## Using Agent Zero on your mobile device
276
  Agent Zero's Web UI is accessible from any device on your network through the Docker container:
277
 
 
 
 
 
278
  1. The Docker container automatically exposes the Web UI on all network interfaces
279
  2. Find the mapped port in Docker Desktop:
280
  - Look under the container name (usually in the format `<PORT>:80`)
@@ -296,6 +310,10 @@ For developers or users who need to run Agent Zero directly on their system,see
296
 
297
  # How to update Agent Zero
298
 
 
 
 
 
299
  1. **If you come from the previous version of Agent Zero:**
300
  - Your data is safely stored across various directories and files inside the Agent Zero folder.
301
  - To update to the new Docker runtime version, you might want to backup the following files and directories:
@@ -347,208 +365,9 @@ For developers or users who need to run Agent Zero directly on their system,see
347
  > docker run -p $PORT:80 -v /path/to/your/data:/a0 agent0ai/agent-zero
348
  > ```
349
 
350
- 3. **Full Binaries**
351
- - Using Git/GitHub: Pull the latest version of the Agent Zero repository.
352
- - The custom knowledge, solutions, memory, and other data will get ignored, so you don't need to worry about losing any of your custom data. The same goes for your .env file with all of your API keys and settings.json.
353
-
354
- > [!WARNING]
355
- > - If you update manually, beware: save your .env file with the API keys, and look for new dependencies in requirements.txt.
356
- > - If any changes are made to the requirements of the updated version, you have to execute this command inside the a0 conda env after activating it:
357
- > ```bash
358
- > pip install -r requirements.txt
359
-
360
- # In-Depth Guide for Full Binaries Installation
361
- - Agent Zero is a framework. It's made to be customized, edited, enhanced. Therefore you need to install the necessary components to run it when downloading its full binaries. This guide will help you to do so.
362
- - The following step by step instructions can be followed along with a video for this tutorial on how to make Agent Zero work with its full development environment.
363
-
364
- [![Video](res/setup/thumb_play.png)](https://youtu.be/8H7mFsvxKYQ)
365
-
366
- ## Reminders:
367
- 1. There's no need to install Python, Conda will manage that for you.
368
- 2. You don't necessarily need API keys: Agent Zero can run with local models. For this tutorial though, we will leave it to the default OpenAI API. A guide for downloading Ollama along with local models is available [here](#installing-and-using-ollama-local-models).
369
- 3. Visual Studio Code or any other code editor is not mandatory, but it makes it easier to navigate and edit files.
370
- 4. Git/GitHub is not mandatory, you can download the framework files through your browser. We will not be showing how to use Git in this tutorial.
371
- 5. Docker is not mandatory for the full binaries installation, since the framework will run on your machine connecting to the Docker container through the Web UI RFC functionality.
372
- 6. Running Agent Zero without Docker makes the process more complicated and it's thought for developers and contributors.
373
-
374
- > [!IMPORTANT]
375
- > Linux instructions are provided as general instructions for any Linux distribution. If you're using a distribution other than Debian/Ubuntu, you may need to adjust the instructions accordingly.
376
- >
377
- > For Debian/Ubuntu, just follow the macOS instructions, as they are the same.
378
-
379
- ## 1. Install Conda (miniconda)
380
- - Conda is a Python environment manager, it will help you keep your projects and installations separated.
381
- - It's a lightweight version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others.
382
-
383
- 1. Go to the download page of miniconda [here](https://docs.anaconda.com/miniconda/#miniconda-latest-installer-links). If the link does not work, just search the web for "miniconda download".
384
- 2. Based on your operating system, download the right installer of miniconda. For macOS select the version with "pkg" at the end.
385
-
386
- <img src="res/setup/image-1.png" alt="miniconda download win" width="500"/>
387
- <img src="res/setup/image-5.png" alt="miniconda download macos" width="500"/>
388
- <br><br>
389
-
390
- 3. Run the installer and go through the installation process, here you can leave everything to default and just click Next, Next... The same goes for macOS with the "pkg" graphical installer.
391
-
392
- <img src="res/setup/image.png" alt="miniconda install" width="200"/>
393
- <img src="res/setup/image-2.png" alt="miniconda install" width="200"/>
394
- <img src="res/setup/image-3.png" alt="miniconda install" width="200"/>
395
- <img src="res/setup/image-4.png" alt="miniconda install" width="200"/>
396
- <br><br>
397
-
398
- 4. After the installation is complete, you should have "Anaconda Powershell Prompt" installed on your Windows machine. On macOS, when you open the Terminal application in your Applications folder and type "conda --version", you should see the version installed.
399
-
400
- <img src="res/setup/image-6.png" alt="miniconda installed" height="100"/>
401
- <img src="res/setup/image-7.png" alt="miniconda installed" height="100"/>
402
- <br><br>
403
-
404
-
405
- ## 2. Download Agent Zero
406
- - You can clone the Agent Zero repository (https://github.com/agent0ai/agent-zero) from GitHub if you know how to use Git. In this tutorial I will just show how to download the files.
407
-
408
- 1. Go to the Agent Zero releases [here](https://github.com/agent0ai/agent-zero/releases).
409
- 2. The latest release is on the top of the list, click the "Source Code (zip)" button under "Assets" to download it.
410
-
411
- <img src="res/setup/image-14-u.png" alt="agent zero download" width="500"/>
412
- <br><br>
413
-
414
- 3. Extract the downloaded archive where you want to have it. I will extract them to "agent-zero" folder on my Desktop - "C:\Users\frdel\Desktop\agent-zero" on Windows and "/Users/frdel/Desktop/agent-zero" on macOS.
415
-
416
- ## 3. Set up Conda environment
417
- - Now that we have the project files and Conda, we can create **virtual Python environment** for this project, activate it and install requirements.
418
-
419
- 1. Open your **"Anaconda Powershell Prompt"** application on windows or **"Terminal"** application on macOS.
420
- 2. In the terminal, navigate to your Agent Zero folder using **"cd"** command. Replace the path with your actual Agent Zero folder path.
421
- ~~~
422
- cd C:\Users\frdel\Desktop\agent-zero
423
- ~~~
424
- You should see your folder has changed on the next terminal line.
425
-
426
- <img src="res/setup/image-15.png" alt="agent zero cd" height="100"/>
427
- <img src="res/setup/image-16.png" alt="agent zero cd" height="100"/>
428
- <br><br>
429
-
430
- 3. Create Conda environment using command **"conda create"**. After **"-n"** is your environment name, you can choose your own, i will use **"a0"** - short for Agent Zero. After **"python"** is the Python version that Conda will install for you into this environment, right now, 3.12 works fine. **-y** skips confirmations.
431
- ~~~
432
- conda create -n a0 python=3.12 -y
433
- ~~~
434
-
435
- 4. Once done, activate the new environment for this terminal window by another command:
436
- ~~~
437
- conda activate a0
438
- ~~~
439
- And you should see that the **(base)** on the left has changed to **(a0)**. This means that this terminal now uses the new **a0** virtual environment and all packages will be installed into this environment.
440
-
441
- <img src="res/setup/image-17.png" alt="conda env" height="200"/>
442
- <img src="res/setup/image-18.png" alt="conda env" height="200"/>
443
- <br><br>
444
-
445
- > [!IMPORTANT]
446
- > If you open a new terminal window, you will need to activate the environment with
447
- > "conda activate a0" again for that window.
448
-
449
- 5. Install requirements using **"pip"**. Pip is a Python package manager. We can install all required packages from requirements.txt file using command:
450
- ~~~
451
- pip install -r requirements.txt
452
- ~~~
453
- This might take some time. If you get any errors regarding version conflicts and compatibility, double check that your environment is activated and that you created that environment with the correct Python version.
454
-
455
- <img src="res/setup/image-19.png" alt="conda reqs" height="200"/>
456
- <br><br>
457
-
458
- ## 4. Install Docker (Docker Desktop application)
459
- Simply put, Docker is a way of running virtual computers on your machine. These are lightweight, disposable and isolated from your operating system, so it is a way to sandbox Agent Zero.
460
- - Agent Zero only connects to the Docker container when it needs to execute code and commands. The frameworks itself runs on your machine.
461
- - Docker has a desktop application with GUI for all major operating system, which is the recommended way to install it.
462
-
463
- 1. Go to the download page of Docker Desktop [here](https://www.docker.com/products/docker-desktop/). If the link does not work, just search the web for "docker desktop download".
464
- 2. Download the version for your operating system. Don't be tricked by the seemingly missing windows intel/amd version, it's the button itself, not in the dropdown menu.
465
-
466
- <img src="res/setup/image-8.png" alt="docker download" width="200"/>
467
- <br><br>
468
-
469
- 3. Run the installer and go through the installation process. It should be even shorter than Conda installation, you can leave everything to default. On macOS, the installer is a "dmg" image, so just drag and drop the application to your Applications folder like always.
470
-
471
- <img src="res/setup/image-9.png" alt="docker install" width="300"/>
472
- <img src="res/setup/image-10.png" alt="docker install" width="300"/>
473
-
474
- <img src="res/setup/image-12.png" alt="docker install" width="300"/>
475
- <br><br>
476
-
477
-
478
- 4. Once installed, you should see Docker Desktop application on your Windows/Mac machine.
479
-
480
- <img src="res/setup/image-11.png" alt="docker installed" height="100"/>
481
- <img src="res/setup/image-13.png" alt="docker installed" height="100"/>
482
- <br><br>
483
-
484
- 5. Create account in the application.
485
- - It's required to be signed in to the Docker Hub, so create a free account in the Docker Desktop application, you will be prompted when the application first runs.
486
-
487
- > [!IMPORTANT]
488
- > **Important macOS-only Docker Configuration:** In Docker Desktop's preferences
489
- > (Docker menu) go to Settings, navigate to "Advanced" and check "Allow the default
490
- > Docker socket to be used (requires password)." This allows Agent Zero to
491
- > communicate with the Docker daemon.
492
-
493
- ![docker socket macOS](res/setup/macsocket.png)
494
-
495
- > [!NOTE]
496
- > **Linux Users:** You can install both Docker Desktop or docker-ce (Community Edition).
497
- > For Docker Desktop, follow the instructions for your specific Linux distribution [here](https://docs.docker.com/desktop/install/linux-install/).
498
- > For docker-ce, follow the instructions [here](https://docs.docker.com/engine/install/).
499
- >
500
- > If you're using docker-ce, you will need to add your user to the `docker` group to be able to run docker commands without sudo. You can do this by running the following command in your terminal: `sudo usermod -aG docker $USER`. Then log out and log back in for the changes to take effect.
501
- >
502
- > Login in the Docker CLI with `docker login` and provide your Docker Hub credentials.
503
-
504
- 6. Pull the Docker image
505
- - Agent Zero needs a Docker image to be pulled from the Docker Hub to be run, even when using the full binaries.
506
- You can refer to the [installation instructions above](#windows-macos-and-linux-setup-guide) to run the Docker container and then resume from the next step. There are two differences:
507
- - You need to map two ports instead of one:
508
- - 55022 in the first field to run the Remote Function Call SSH
509
- - 0 in the second field to run the Web UI in automatic port assignment
510
- - You need to map the `/a0` volume to the location of your local Agent Zero folder.
511
- - Run the Docker container following the instructions.
512
-
513
- ## 5. Run the local Agent Zero instance
514
- Run the Agent Zero with Web UI:
515
- ~~~
516
- python run_ui.py
517
- ~~~
518
-
519
- <img src="res/setup/image-21.png" alt="run ui" height="110"/>
520
- <br><br>
521
-
522
- - Open the URL shown in terminal in your web browser. You should see the Agent Zero interface.
523
-
524
- ## 6. Configure Agent Zero
525
- Now we can configure Agent Zero - select models, settings, API Keys etc. Refer to the [Usage](usage.md#agent-configuration) guide for a full guide on how to configure Agent Zero.
526
-
527
- ## 7. Configure Agent Zero RFC
528
- Agent Zero needs to be configured further to redirect some functions to the Docker container. This is crucial for development as A0 needs to run in a standardized environment to support all features.
529
- 1. Go in "Settings" page in the Web UI of your local instance and go in the "Development" section.
530
- 2. Set "RFC Destination URL" to `http://localhost`
531
- 3. Set the two ports (HTTP and SSH) to the ones used when creating the Docker container
532
- 4. Click "Save"
533
-
534
- ![rfc local settings](res/setup/9-rfc-devpage-on-local-sbs-1.png)
535
-
536
- 5. Go in "Settings" page in the Web UI of your Docker instance and go in the "Development" section.
537
-
538
- ![rfc docker settings](res/setup/9-rfc-devpage-on-docker-instance-1.png)
539
-
540
- 6. This time the page has only the password field, set it to the same password you used when creating the Docker container.
541
- 7. Click "Save"
542
- 8. Use the Development environment
543
- 9. Now you have the full development environment to work on Agent Zero.
544
-
545
- <img src="res/setup/image-22-1.png" alt="run ui" width="400"/>
546
- <img src="res/setup/image-23-1.png" alt="run ui" width="400"/>
547
- <br><br>
548
-
549
 
550
  ### Conclusion
551
  After following the instructions for your specific operating system, you should have Agent Zero successfully installed and running. You can now start exploring the framework's capabilities and experimenting with creating your own intelligent agents.
552
 
553
- If you encounter any issues during the installation process, please consult the [Troubleshooting section](troubleshooting.md) of this documentation or refer to the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/Z2tun2N3) community for assistance.
554
 
 
50
  <img src="res/setup/image-13.png" alt="docker installed" height="100"/>
51
  <br><br>
52
 
53
+ > [!NOTE]
54
+ > **MacOS Configuration:** In Docker Desktop's preferences (Docker menu) → Settings →
55
  > Advanced, enable "Allow the default Docker socket to be used (requires password)."
56
 
57
  ![docker socket macOS](res/setup/macsocket.png)
 
74
  > docker pull agent0ai/agent-zero
75
  > ```
76
 
77
+ 2.2. OPTIONAL - Create a data directory for persistence:
78
+
79
+ > [!CAUTION]
80
+ > Preferred way of persisting Agent Zero data is to use the backup and restore feature.
81
+ > By mapping the whole `/a0` directory to a local directory, you will run into problems when upgrading Agent Zero to a newer version.
82
+
83
  - Choose or create a directory on your machine where you want to store Agent Zero's data
84
  - This can be any location you prefer (e.g., `C:/agent-zero-data` or `/home/user/agent-zero-data`)
85
+ - You can map individual subfolders of `/a0` to a local directory or the full `/a0` directory (not recommended).
86
  - This directory will contain all your Agent Zero files, like the legacy root folder structure:
87
+ - `/agents` - Specialized agents with their prompts and tools
88
  - `/memory` - Agent's memory and learned information
89
  - `/knowledge` - Knowledge base
90
  - `/instruments` - Instruments and functions
91
  - `/prompts` - Prompt files
92
  - `/work_dir` - Working directory
93
  - `.env` - Your API keys
94
+ - `/tmp/settings.json` - Your Agent Zero settings
95
 
96
  > [!TIP]
97
  > Choose a location that's easy to access and backup. All your Agent Zero data
 
101
  - In Docker Desktop, go back to the "Images" tab
102
  - Click the `Run` button next to the `agent0ai/agent-zero` image
103
  - Open the "Optional settings" menu
104
+ - Set the web port (80) to desired host port number in the second "Host port" field or set to `0` for automatic port assignment
105
 
106
  Optionally you can map local folders for file persistence:
107
+ > [!CAUTION]
108
+ > Preferred way of persisting Agent Zero data is to use the backup and restore feature.
109
+ > By mapping the whole `/a0` directory to a local directory, you will run into problems when upgrading Agent Zero to a newer version.
110
+ - OPTIONAL: Under "Volumes", configure your mapped folders, if needed:
111
+ - Example host path: Your chosen directory (e.g., `C:\agent-zero\memory`)
112
+ - Example container path: `/a0/memory`
113
 
 
114
 
115
  - Click the `Run` button in the "Images" tab.
116
+
117
+ ![docker port mapping](res/setup/2-docker-image-run.png)
118
+ ![docker port mapping](res/setup/2-docker-image-run2.png)
119
+
120
  - The container will start and show in the "Containers" tab
121
 
122
  ![docker containers](res/setup/4-docker-container-started.png)
 
218
 
219
  ## Important Considerations
220
 
 
 
 
 
 
221
  ## Installing and Using Ollama (Local Models)
222
  If you're interested in Ollama, which is a powerful tool that allows you to run various large language models locally, here's how to install and use it:
223
 
 
259
 
260
  3. Write your model code as expected by Ollama, in the format `llama3.2` or `qwen2.5:7b`
261
 
262
+ 4. Provide your API base URL to your ollama API endpoint, usually `http://host.docker.internal:11434`
263
+
264
+ 5. Click `Save` to confirm your settings.
265
 
266
  ![ollama](res/setup/settings/4-local-models.png)
267
 
 
285
  ## Using Agent Zero on your mobile device
286
  Agent Zero's Web UI is accessible from any device on your network through the Docker container:
287
 
288
+ > [!NOTE]
289
+ > In settings, External Services tab, you can enable Cloudflare Tunnel to expose your Agent Zero instance to the internet.
290
+ > ⚠️ Do not forget to set username and password in the settings Authentication tab to secure your instance on the internet.
291
+
292
  1. The Docker container automatically exposes the Web UI on all network interfaces
293
  2. Find the mapped port in Docker Desktop:
294
  - Look under the container name (usually in the format `<PORT>:80`)
 
310
 
311
  # How to update Agent Zero
312
 
313
+ > [!NOTE]
314
+ > Since v0.9, Agent Zero has a Backup and Restore feature, so you don't need to backup the files manually.
315
+ > In Settings, Backup and Restore tab will guide you through the process.
316
+
317
  1. **If you come from the previous version of Agent Zero:**
318
  - Your data is safely stored across various directories and files inside the Agent Zero folder.
319
  - To update to the new Docker runtime version, you might want to backup the following files and directories:
 
365
  > docker run -p $PORT:80 -v /path/to/your/data:/a0 agent0ai/agent-zero
366
  > ```
367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
 
369
  ### Conclusion
370
  After following the instructions for your specific operating system, you should have Agent Zero successfully installed and running. You can now start exploring the framework's capabilities and experimenting with creating your own intelligent agents.
371
 
372
+ If you encounter any issues during the installation process, please consult the [Troubleshooting section](troubleshooting.md) of this documentation or refer to the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/B8KZKNsPpj) community for assistance.
373
 
docs/mcp_setup.md CHANGED
@@ -44,7 +44,7 @@ Within `tmp/settings.json`, the MCP servers are defined under the `"mcp_servers"
44
  ```json
45
  {
46
  // ... other settings ...
47
- "mcp_servers": "[{\\\"name\\\": \\\"sequential-thinking\\\",\\\"command\\\": \\\"npx\\\",\\\"args\\\": [\\\"--yes\\\", \\\"--package\\\", \\\"@modelcontextprotocol/server-sequential-thinking\\\", \\\"mcp-server-sequential-thinking\\\"]}, {\\\"name\\\": \\\"brave-search\\\", \\\"command\\\": \\\"npx\\\", \\\"args\\\": [\\\"--yes\\\", \\\"--package\\\", \\\"@modelcontextprotocol/server-brave-search\\\", \\\"mcp-server-brave-search\\\"], \\\"env\\\": {\\\"BRAVE_API_KEY\\\": \\\"YOUR_BRAVE_KEY_HERE\\\"}}, {\\\"name\\\": \\\"fetch\\\", \\\"command\\\": \\\"npx\\\", \\\"args\\\": [\\\"--yes\\\", \\\"--package\\\", \\\"@tokenizin/mcp-npx-fetch\\\", \\\"mcp-npx-fetch\\\", \\\"--ignore-robots-txt\\\", \\\"--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\\\"]}]",
48
  // ... other settings ...
49
  }
50
  ```
@@ -120,7 +120,7 @@ Here are templates for configuring individual servers within the `mcp_servers` J
120
  ```json
121
  {
122
  // ... other settings ...
123
- "mcp_servers": "[{\\\"name\\\": \\\"MyPythonTools\\\", \\\"command\\\": \\\"python3\\\", \\\"args\\\": [\\\"mcp_scripts/my_server.py\\\"], \\\"disabled\\\": false}, {\\\"name\\\": \\\"ExternalAPI\\\", \\\"url\\\": \\\"https://data.example.com/mcp\\\", \\\"headers\\\": {\\\"X-Auth-Token\\\": \\\"supersecret\\\"}, \\\"disabled\\\": false}]",
124
  // ... other settings ...
125
  }
126
  ```
 
44
  ```json
45
  {
46
  // ... other settings ...
47
+ "mcp_servers": "[{'name': 'sequential-thinking','command': 'npx','args': ['--yes', '--package', '@modelcontextprotocol/server-sequential-thinking', 'mcp-server-sequential-thinking']}, {'name': 'brave-search', 'command': 'npx', 'args': ['--yes', '--package', '@modelcontextprotocol/server-brave-search', 'mcp-server-brave-search'], 'env': {'BRAVE_API_KEY': 'YOUR_BRAVE_KEY_HERE'}}, {'name': 'fetch', 'command': 'npx', 'args': ['--yes', '--package', '@tokenizin/mcp-npx-fetch', 'mcp-npx-fetch', '--ignore-robots-txt', '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36']}]",
48
  // ... other settings ...
49
  }
50
  ```
 
120
  ```json
121
  {
122
  // ... other settings ...
123
+ "mcp_servers": "[{'name': 'MyPythonTools', 'command': 'python3', 'args': ['mcp_scripts/my_server.py'], 'disabled': false}, {'name': 'ExternalAPI', 'url': 'https://data.example.com/mcp', 'headers': {'X-Auth-Token': 'supersecret'}, 'disabled': false}]",
124
  // ... other settings ...
125
  }
126
  ```
docs/res/dev/devinst-1.png ADDED

Git LFS Details

  • SHA256: d6cb7f7cc050dd3b0009f352b1d84f11003aa5b3f98eff7e3fc934a770b80c0a
  • Pointer size: 131 Bytes
  • Size of remote file: 349 kB
docs/res/dev/devinst-10.png ADDED

Git LFS Details

  • SHA256: d9539cb0cc2c58b09b016ca0c2f5d449ea959b55004205d3edda1f0375f4b7f8
  • Pointer size: 131 Bytes
  • Size of remote file: 490 kB
docs/res/dev/devinst-11.png ADDED

Git LFS Details

  • SHA256: 7ff9eb570d62994ba332600cda14179276145d6685cc4ca6679d3ce25bca4446
  • Pointer size: 130 Bytes
  • Size of remote file: 52.1 kB
docs/res/dev/devinst-12.png ADDED

Git LFS Details

  • SHA256: 92df21e262fa61bdd14c48c7b1cd9e36cb9c629529b2c15db02fc6bba18cdd30
  • Pointer size: 130 Bytes
  • Size of remote file: 23.8 kB
docs/res/dev/devinst-13.png ADDED

Git LFS Details

  • SHA256: 2fe5534cc7ee960d1de52fd8ead33a19dd015939e452d6c4a3cea70595c0f6f8
  • Pointer size: 131 Bytes
  • Size of remote file: 255 kB
docs/res/dev/devinst-14.png ADDED

Git LFS Details

  • SHA256: c1ca880079dd9c62b474b0234281ad5c104383b2f7d426ec903d19758948890f
  • Pointer size: 131 Bytes
  • Size of remote file: 198 kB
docs/res/dev/devinst-2.png ADDED

Git LFS Details

  • SHA256: 09cc3e02b53abf2c5bc51f10a2b29f4432522f11e11e00f2e19b3f6aee9415be
  • Pointer size: 131 Bytes
  • Size of remote file: 653 kB
docs/res/dev/devinst-3.png ADDED

Git LFS Details

  • SHA256: 7ebc988e6986b59b76c34faa1f8fc562a028fa843e0135b65ffa9030550c17fc
  • Pointer size: 131 Bytes
  • Size of remote file: 176 kB
docs/res/dev/devinst-4.png ADDED

Git LFS Details

  • SHA256: 28d2bbf59056185a8f7f9bb530cddfb55ed1667a3858e291c70fadb3433c35fe
  • Pointer size: 130 Bytes
  • Size of remote file: 50.9 kB
docs/res/dev/devinst-5.png ADDED

Git LFS Details

  • SHA256: fe15f94fe067b703f1ec1b290cb18a2857c2ddef19c87f2d06bcbe4526c98abd
  • Pointer size: 131 Bytes
  • Size of remote file: 110 kB
docs/res/dev/devinst-6.png ADDED

Git LFS Details

  • SHA256: 5a0d8a27032a7606dff24838e67ea87941b8a847a8e80ef7d7e60b444b45d235
  • Pointer size: 130 Bytes
  • Size of remote file: 45.8 kB
docs/res/dev/devinst-7.png ADDED

Git LFS Details

  • SHA256: 9145bbd40492247461d663364b42fb48718d3465bd70c7cf8e6780478ee1bec3
  • Pointer size: 131 Bytes
  • Size of remote file: 162 kB
docs/res/dev/devinst-8.png ADDED

Git LFS Details

  • SHA256: 08b0194b988f155071b154c7d39fa2221e422f450e865f502d760881d01890c0
  • Pointer size: 131 Bytes
  • Size of remote file: 201 kB
docs/res/dev/devinst-9.png ADDED

Git LFS Details

  • SHA256: 354fbf2dcddf543900b693f1e354b45eea367083c778e16d701ace62ae5395b0
  • Pointer size: 131 Bytes
  • Size of remote file: 156 kB
docs/res/setup/1-docker-image-search.png CHANGED

Git LFS Details

  • SHA256: 566a1a695a1c24556664dd7ebd4a267af9936e740671226bb32c262d8696d7be
  • Pointer size: 131 Bytes
  • Size of remote file: 158 kB

Git LFS Details

  • SHA256: 3917439c131a3d57565ff0d3d7f73851bf27cced9ebcc9451d4f421e9def4ae5
  • Pointer size: 131 Bytes
  • Size of remote file: 233 kB
docs/res/setup/2-docker-image-run.png CHANGED

Git LFS Details

  • SHA256: c37208f9135d7cbaaad9889b2fc6244d8d7d274c932a4134d99df6c45c0b111d
  • Pointer size: 130 Bytes
  • Size of remote file: 33.7 kB

Git LFS Details

  • SHA256: 9729d11a483b768ceb2edbf9daa5c68809553fba78cf72db5569396f5b7312cd
  • Pointer size: 130 Bytes
  • Size of remote file: 75 kB
docs/res/setup/2-docker-image-run2.png ADDED

Git LFS Details

  • SHA256: d65792f81cb68072023c8c968c729d99e80886df07b4c13e90d3c8ca289a2b38
  • Pointer size: 130 Bytes
  • Size of remote file: 29.9 kB
docs/troubleshooting.md CHANGED
@@ -18,7 +18,7 @@ Refer to the [Choosing your LLMs](installation.md#installing-and-using-ollama-lo
18
  Refer to the [How to update Agent Zero](installation.md#how-to-update-agent-zero) section of the documentation for instructions on how to update Agent Zero while retaining memory and data.
19
 
20
  **7. Where can I find more documentation or tutorials?**
21
- - Join the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/Z2tun2N3) community for support and discussions.
22
 
23
  **8. How do I adjust API rate limits?**
24
  Modify the `rate_limit_seconds` and `rate_limit_requests` parameters in the `AgentConfig` class within `initialize.py`.
 
18
  Refer to the [How to update Agent Zero](installation.md#how-to-update-agent-zero) section of the documentation for instructions on how to update Agent Zero while retaining memory and data.
19
 
20
  **7. Where can I find more documentation or tutorials?**
21
+ - Join the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/B8KZKNsPpj) community for support and discussions.
22
 
23
  **8. How do I adjust API rate limits?**
24
  Modify the `rate_limit_seconds` and `rate_limit_requests` parameters in the `AgentConfig` class within `initialize.py`.
docs/usage.md CHANGED
@@ -100,16 +100,16 @@ Agent Zero supports direct file attachments in the chat interface for seamless f
100
  ## Tool Usage
101
  Agent Zero's power comes from its ability to use [tools](architecture.md#tools). Here's how to leverage them effectively:
102
 
103
- - **Understand Tools:** Agent Zero includes default tools like knowledge (powered by SearXNG), webpage content, code execution, and communication. Understand the capabilities of these tools and how to invoke them.
104
 
105
  ## Example of Tools Usage: Web Search and Code Execution
106
  Let's say you want Agent Zero to perform some financial analysis tasks. Here's a possible prompt:
107
 
108
- > Please be a professional financial analyst. Find last month Bitcoin/ USD price trend and make a chart in your environment. The chart must have highlighted key points corresponding with dates of major news about cryptocurrency. Use the 'knowledge_tool' to find the price and the news, and the 'code_execution_tool' to perform the rest of the job.
109
 
110
  Agent Zero might then:
111
 
112
- 1. Use the `knowledge_tool` to query a reliable source for the Bitcoin price and for the news about cryptocurrency as prompted.
113
  2. Extract the price from the search results and save the news, extracting their dates and possible impact on the price.
114
  3. Use the `code_execution_tool` to execute a Python script that performs the graph creation and key points highlighting, using the extracted data and the news dates as inputs.
115
  4. Return the final chart that you'll find in `/work_dir`, responding to the user with the `response_tool`.
 
100
  ## Tool Usage
101
  Agent Zero's power comes from its ability to use [tools](architecture.md#tools). Here's how to leverage them effectively:
102
 
103
+ - **Understand Tools:** Agent Zero includes default tools like knowledge (powered by SearXNG), code execution, and communication. Understand the capabilities of these tools and how to invoke them.
104
 
105
  ## Example of Tools Usage: Web Search and Code Execution
106
  Let's say you want Agent Zero to perform some financial analysis tasks. Here's a possible prompt:
107
 
108
+ > Please be a professional financial analyst. Find last month Bitcoin/ USD price trend and make a chart in your environment. The chart must have highlighted key points corresponding with dates of major news about cryptocurrency. Use the 'search_engine' and 'document_query_tool' to find the price and the news, and the 'code_execution_tool' to perform the rest of the job.
109
 
110
  Agent Zero might then:
111
 
112
+ 1. Use the `search_engine` and `document_query_tool` to query a reliable source for the Bitcoin price and for the news about cryptocurrency as prompted.
113
  2. Extract the price from the search results and save the news, extracting their dates and possible impact on the price.
114
  3. Use the `code_execution_tool` to execute a Python script that performs the graph creation and key points highlighting, using the extracted data and the news dates as inputs.
115
  4. Return the final chart that you'll find in `/work_dir`, responding to the user with the `response_tool`.
knowledge/default/main/about/github_readme.md CHANGED
@@ -11,7 +11,7 @@ To begin with Agent Zero, follow the links below for detailed guides on various
11
  ### Your experience with Agent Zero starts now!
12
 
13
  - **Download Agent Zero:** Follow the [installation guide](installation.md) to download and run Agent Zero.
14
- - **Join the Community:** Join the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/Z2tun2N3) community to discuss ideas, ask questions, and collaborate with other contributors.
15
  - **Share your Work:** Share your Agent Zero creations, workflows and discoverings on our [Show and Tell](https://github.com/agent0ai/agent-zero/discussions/categories/show-and-tell) area on GitHub.
16
  - **Report Issues:** Use the [GitHub issue tracker](https://github.com/agent0ai/agent-zero/issues) to report framework-relative bugs or suggest new features.
17
 
 
11
  ### Your experience with Agent Zero starts now!
12
 
13
  - **Download Agent Zero:** Follow the [installation guide](installation.md) to download and run Agent Zero.
14
+ - **Join the Community:** Join the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/B8KZKNsPpj) community to discuss ideas, ask questions, and collaborate with other contributors.
15
  - **Share your Work:** Share your Agent Zero creations, workflows and discoverings on our [Show and Tell](https://github.com/agent0ai/agent-zero/discussions/categories/show-and-tell) area on GitHub.
16
  - **Report Issues:** Use the [GitHub issue tracker](https://github.com/agent0ai/agent-zero/issues) to report framework-relative bugs or suggest new features.
17
 
knowledge/default/main/about/installation.md CHANGED
@@ -550,5 +550,5 @@ Agent Zero needs to be configured further to redirect some functions to the Dock
550
  ### Conclusion
551
  After following the instructions for your specific operating system, you should have Agent Zero successfully installed and running. You can now start exploring the framework's capabilities and experimenting with creating your own intelligent agents.
552
 
553
- If you encounter any issues during the installation process, please consult the [Troubleshooting section](troubleshooting.md) of this documentation or refer to the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/Z2tun2N3) community for assistance.
554
 
 
550
  ### Conclusion
551
  After following the instructions for your specific operating system, you should have Agent Zero successfully installed and running. You can now start exploring the framework's capabilities and experimenting with creating your own intelligent agents.
552
 
553
+ If you encounter any issues during the installation process, please consult the [Troubleshooting section](troubleshooting.md) of this documentation or refer to the Agent Zero [Skool](https://www.skool.com/agent-zero) or [Discord](https://discord.gg/B8KZKNsPpj) community for assistance.
554
 
prompts/agent.system.main.tips.md CHANGED
@@ -4,7 +4,7 @@
4
  reason step-by-step execute tasks
5
  avoid repetition ensure progress
6
  never assume success
7
- memory refers to knowledge_tool and memory tools not own knowledge
8
 
9
  ## Files
10
  save files in /root
 
4
  reason step-by-step execute tasks
5
  avoid repetition ensure progress
6
  never assume success
7
+ memory refers memory tools not own knowledge
8
 
9
  ## Files
10
  save files in /root
prompts/agent.system.tool.browser._md DELETED
@@ -1,83 +0,0 @@
1
- ### browser_open:
2
-
3
- control stateful chromium browser using playwright
4
- use with url argument to open a new page
5
- all browser tools return simplified DOM with unique selectors
6
- once page is opened use browser_do tool to interact.
7
-
8
- ```json
9
- {
10
- "thoughts": ["I need to send..."],
11
- "tool_name": "browser_open",
12
- "tool_args": {
13
- "url": "https://www.example.com"
14
- }
15
- }
16
- ```
17
-
18
- ### browser_do:
19
-
20
- use to fill forms press keys click buttons execute javascript
21
- arguments are optional
22
- fill argument is array of objects with selector and text
23
- press argument is array of keys to be pressed in order - Enter, Escape...
24
- click argument is an array of selectors clicked in order
25
- execute argument is a string of javascript executed
26
- always prefer clicking on <a> or <button> tags first
27
- confirm fields with Enter or find submit button
28
- consents and popups may block page, close them
29
- only use selectors mentioned in last browser response
30
- do not repeat same steps if do not work! find ways around problems
31
- ```json
32
- {
33
- "thoughts": [
34
- "Login required...",
35
- "I will fill username, password, click remember me and submit."
36
- ],
37
- "tool_name": "browser_do",
38
- "tool_args": {
39
- "fill": [
40
- {
41
- "selector": "12l",
42
- "text": "root"
43
- },
44
- {
45
- "selector": "14vs",
46
- "text": "toor"
47
- }
48
- ],
49
- "click": ["19c", "65d"]
50
- }
51
- }
52
- ```
53
-
54
- ```json
55
- {
56
- "thoughts": [
57
- "Search for...",
58
- "I will fill search box and press Enter."
59
- ],
60
- "tool_name": "browser_do",
61
- "tool_args": {
62
- "fill": [
63
- {
64
- "selector": "98d",
65
- "text": "example"
66
- }
67
- ],
68
- "press": ["Enter"]
69
- }
70
- }
71
- ```
72
-
73
- ```json
74
- {
75
- "thoughts": [
76
- "Standard interaction not possible, I need to execute custom code..."
77
- ],
78
- "tool_name": "browser_do",
79
- "tool_args": {
80
- "execute": "const elem = document.querySelector('[data-uid=\"4z\"]'); elem.click();"
81
- }
82
- }
83
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
prompts/agent.system.tool.code_exe.md CHANGED
@@ -7,7 +7,7 @@ select "session" number, 0 default, others for multitasking
7
  if code runs long, use "output" to wait, "reset" to kill process
8
  use "pip" "npm" "apt-get" in "terminal" to install packages
9
  to output, use print() or console.log()
10
- if tool outputs error, adjust code before retrying; knowledge_tool can help
11
  important: check code for placeholders or demo data; replace with real variables; don't reuse snippets
12
  don't use with other tools except thoughts; wait for response before using others
13
  check dependencies before running code
 
7
  if code runs long, use "output" to wait, "reset" to kill process
8
  use "pip" "npm" "apt-get" in "terminal" to install packages
9
  to output, use print() or console.log()
10
+ if tool outputs error, adjust code before retrying;
11
  important: check code for placeholders or demo data; replace with real variables; don't reuse snippets
12
  don't use with other tools except thoughts; wait for response before using others
13
  check dependencies before running code
prompts/agent.system.tool.knowledge.md DELETED
@@ -1,22 +0,0 @@
1
- ### knowledge_tool:
2
- provide your question as a search engine - ready query
3
- the first responder will be a search engine not an ai or human
4
- formulate your query as concisely and precisely as possible
5
- provide question arg get online and memory response
6
- powerful tool answers specific questions directly
7
- ask for result first not guidance
8
- memory gives guidance online gives current info
9
- verify memory with online
10
- **Example usage**:
11
- ~~~json
12
- {
13
- "thoughts": [
14
- "...",
15
- ],
16
- "headline": "Searching knowledge base and online resources",
17
- "tool_name": "knowledge_tool",
18
- "tool_args": {
19
- "question": "How to...",
20
- }
21
- }
22
- ~~~
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
prompts/agent.system.tool.web.md DELETED
@@ -1,19 +0,0 @@
1
- ### webpage_content_tool:
2
- get webpage text content news wiki etc
3
- use url arg for main text
4
- gather online content
5
- provide full valid url with http:// or https://
6
-
7
- **Example usage**:
8
- ```json
9
- {
10
- "thoughts": [
11
- "...",
12
- ],
13
- "headline": "Extracting webpage text content",
14
- "tool_name": "webpage_content_tool",
15
- "tool_args": {
16
- "url": "https://...comexample",
17
- }
18
- }
19
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
prompts/msg.memory_cleanup.md DELETED
@@ -1,26 +0,0 @@
1
- # Cleanup raw memories from database
2
- - You will receive two data collections:
3
- 1. Conversation history of AI agent.
4
- 2. Raw memories from vector database based on similarity score.
5
- - Your job is to remove all memories from the database that are not relevant to the topic of the conversation history and only return memories that are relevant and helpful for future of the conversation.
6
- - Database can sometimes produce results very different from the conversation, these have to be remove.
7
- - Focus on the end of the conversation history, that is where the most current topic is.
8
-
9
- # Expected output format
10
- - Return filtered list of bullet points of key elements in the memories
11
- - Do not include memory contents, only their summaries to inform the user that he has memories of the topic.
12
- - If there are relevant memories, instruct user to use "knowledge_tool" to get more details.
13
-
14
- # Example output 1 (relevant memories):
15
- ~~~md
16
- 1. Guide how to create a web app including code.
17
- 2. Javascript snippets from snake game development.
18
- 3. SVG image generation for game sprites with examples.
19
-
20
- Check your knowledge_tool for more details.
21
- ~~~
22
-
23
- # Example output 2 (no relevant memories):
24
- ~~~text
25
- No relevant memories on the topic found.
26
- ~~~
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
python/api/image_get.py CHANGED
@@ -24,7 +24,11 @@ class ImageGet(ApiHandler):
24
  raise ValueError("No path provided")
25
 
26
  # check if path is within base directory
27
- if not runtime.call_development_function(files.is_in_base_dir, path):
 
 
 
 
28
  raise ValueError("Path is outside of allowed directory")
29
 
30
  # get file extension and info
@@ -37,30 +41,31 @@ class ImageGet(ApiHandler):
37
  # # If metadata is requested, return file information
38
  # if metadata:
39
  # return _get_file_metadata(path, filename, file_ext, image_extensions)
40
-
41
  if file_ext in image_extensions:
42
- # Handle image files
43
- if not runtime.call_development_function(files.exists, path):
44
- # If image doesn't exist, return default image icon
45
- return _send_fallback_icon("image")
46
 
47
- # send image file right away if dockerized, if development, read it from docker and send
48
- if runtime.is_dockerized():
49
- response = send_file(path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  else:
51
- b64_content = await runtime.call_development_function(
52
- files.read_file_base64, path
53
- )
54
- file_content = base64.b64decode(b64_content)
55
- mime_type, _ = guess_type(filename)
56
- if not mime_type:
57
- mime_type = "application/octet-stream"
58
- response = send_file(
59
- io.BytesIO(file_content),
60
- mimetype=mime_type,
61
- as_attachment=False,
62
- download_name=filename,
63
- )
64
 
65
  # Add cache headers for better device sync performance
66
  response.headers["Cache-Control"] = "public, max-age=3600"
 
24
  raise ValueError("No path provided")
25
 
26
  # check if path is within base directory
27
+ if runtime.is_development():
28
+ in_base = files.is_in_base_dir(files.fix_dev_path(path))
29
+ else:
30
+ in_base = files.is_in_base_dir(path)
31
+ if not in_base:
32
  raise ValueError("Path is outside of allowed directory")
33
 
34
  # get file extension and info
 
41
  # # If metadata is requested, return file information
42
  # if metadata:
43
  # return _get_file_metadata(path, filename, file_ext, image_extensions)
44
+
45
  if file_ext in image_extensions:
 
 
 
 
46
 
47
+ # in development environment, try to serve the image from local file system if exists, otherwise from docker
48
+ if runtime.is_development():
49
+ if files.exists(path):
50
+ response = send_file(path)
51
+ elif await runtime.call_development_function(files.exists, path):
52
+ b64_content = await runtime.call_development_function(
53
+ files.read_file_base64, path
54
+ )
55
+ file_content = base64.b64decode(b64_content)
56
+ mime_type, _ = guess_type(filename)
57
+ if not mime_type:
58
+ mime_type = "application/octet-stream"
59
+ response = send_file(
60
+ io.BytesIO(file_content),
61
+ mimetype=mime_type,
62
+ as_attachment=False,
63
+ download_name=filename,
64
+ )
65
+ else:
66
+ response = _send_fallback_icon("image")
67
  else:
68
+ response = send_file(path)
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  # Add cache headers for better device sync performance
71
  response.headers["Cache-Control"] = "public, max-age=3600"
python/helpers/memory_consolidation.py CHANGED
@@ -592,8 +592,9 @@ class MemoryConsolidator:
592
  **result.metadata # LLM metadata second (wins conflicts)
593
  }
594
 
595
- if result.reasoning:
596
- final_metadata['consolidation_reasoning'] = result.reasoning
 
597
 
598
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
599
  return [new_id]
@@ -624,8 +625,9 @@ class MemoryConsolidator:
624
  **result.metadata # LLM metadata second (wins conflicts)
625
  }
626
 
627
- if result.reasoning:
628
- final_metadata['consolidation_reasoning'] = result.reasoning
 
629
 
630
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
631
  return [new_id]
@@ -676,8 +678,9 @@ class MemoryConsolidator:
676
  **result.metadata
677
  }
678
 
679
- if result.reasoning:
680
- final_metadata['consolidation_reasoning'] = result.reasoning
 
681
 
682
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
683
  return [new_id]
@@ -700,8 +703,9 @@ class MemoryConsolidator:
700
  **result.metadata # LLM metadata second (wins conflicts)
701
  }
702
 
703
- if result.reasoning:
704
- final_metadata['consolidation_reasoning'] = result.reasoning
 
705
 
706
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
707
  return [new_id]
@@ -762,8 +766,9 @@ class MemoryConsolidator:
762
  **result.metadata # LLM metadata second (wins conflicts)
763
  }
764
 
765
- if result.reasoning:
766
- final_metadata['consolidation_reasoning'] = result.reasoning
 
767
 
768
  new_memory_id = await db.insert_text(result.new_memory_content, final_metadata)
769
  updated_ids.append(new_memory_id)
 
592
  **result.metadata # LLM metadata second (wins conflicts)
593
  }
594
 
595
+ # do not include reasoning in memory
596
+ # if result.reasoning:
597
+ # final_metadata['consolidation_reasoning'] = result.reasoning
598
 
599
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
600
  return [new_id]
 
625
  **result.metadata # LLM metadata second (wins conflicts)
626
  }
627
 
628
+ # do not include reasoning in memory
629
+ # if result.reasoning:
630
+ # final_metadata['consolidation_reasoning'] = result.reasoning
631
 
632
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
633
  return [new_id]
 
678
  **result.metadata
679
  }
680
 
681
+ # do not include reasoning in memory
682
+ # if result.reasoning:
683
+ # final_metadata['consolidation_reasoning'] = result.reasoning
684
 
685
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
686
  return [new_id]
 
703
  **result.metadata # LLM metadata second (wins conflicts)
704
  }
705
 
706
+ # do not include reasoning in memory
707
+ # if result.reasoning:
708
+ # final_metadata['consolidation_reasoning'] = result.reasoning
709
 
710
  new_id = await db.insert_text(result.new_memory_content, final_metadata)
711
  return [new_id]
 
766
  **result.metadata # LLM metadata second (wins conflicts)
767
  }
768
 
769
+ # do not include reasoning in memory
770
+ # if result.reasoning:
771
+ # final_metadata['consolidation_reasoning'] = result.reasoning
772
 
773
  new_memory_id = await db.insert_text(result.new_memory_content, final_metadata)
774
  updated_ids.append(new_memory_id)
python/helpers/runtime.py CHANGED
@@ -2,7 +2,7 @@ import argparse
2
  import inspect
3
  import secrets
4
  from typing import TypeVar, Callable, Awaitable, Union, overload, cast
5
- from python.helpers import dotenv, rfc, settings
6
  import asyncio
7
  import threading
8
  import queue
@@ -82,10 +82,11 @@ async def call_development_function(func: Union[Callable[..., T], Callable[...,
82
  if is_development():
83
  url = _get_rfc_url()
84
  password = _get_rfc_password()
 
85
  result = await rfc.call_rfc(
86
  url=url,
87
  password=password,
88
- module=func.__module__,
89
  function_name=func.__name__,
90
  args=list(args),
91
  kwargs=kwargs,
 
2
  import inspect
3
  import secrets
4
  from typing import TypeVar, Callable, Awaitable, Union, overload, cast
5
+ from python.helpers import dotenv, rfc, settings, files
6
  import asyncio
7
  import threading
8
  import queue
 
82
  if is_development():
83
  url = _get_rfc_url()
84
  password = _get_rfc_password()
85
+ module = files.deabsolute_path(func.__code__.co_filename).replace("/", ".").removesuffix(".py") # __module__ is not reliable
86
  result = await rfc.call_rfc(
87
  url=url,
88
  password=password,
89
+ module=module,
90
  function_name=func.__name__,
91
  args=list(args),
92
  kwargs=kwargs,