You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sample demonstrates how to use the `LocalEnvironment` with the `EnvironmentToolset` to allow an agent to interact with the local filesystem and execute commands.
4
+
5
+
## Description
6
+
7
+
The agent is configured with the `EnvironmentToolset`, which provides tools for file I/O (reading, writing) and command execution within a local environment. This allows the agent to perform tasks that involve creating files, modifying them, and running local scripts or commands.
8
+
9
+
## Sample Usage
10
+
11
+
You can interact with the agent by providing prompts that require file operations and command execution.
12
+
13
+
### Example Prompt
14
+
15
+
> "Write a Python file named `hello.py` to the working directory that prints 'Hello from ADK!'. Then read the file to verify its contents, and finally execute it using a command."
16
+
17
+
### Expected Behavior
18
+
19
+
1.**Write File**: The agent uses a tool to write `hello.py` with the content `print("Hello from ADK!")`.
20
+
2.**Read File**: The agent uses a tool to read `hello.py` and verify the content.
21
+
3.**Execute Command**: The agent uses a tool to run `python3 hello.py` and returns the output.
0 commit comments