Skip to content

Commit 3fe52c2

Browse files
chore: update docs with AgentsRuntimeFactory info (#28)
1 parent 3608dcd commit 3fe52c2

4 files changed

Lines changed: 104 additions & 85 deletions

File tree

CONTRIBUTING.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Most of the times when working on this repo, you'll also need to do some changes
44

55
## Development Strategies
66

7-
A simple way to make development easier and not combine code changes with agent defintitions, is to create a separate Python project that references the `uipath-agents-python` package as an editable dependency. For a better experience, start by creating a new root-level directory (e.g. `python-workspace`) that will hold all the related projects and repositories.
7+
A simple way to make development easier and not combine code changes with agent definitions, is to create a separate Python project that references the `uipath-agents-python` package as an editable dependency. For a better experience, start by creating a new root-level directory (e.g. `python-workspace`) that will hold all the related projects and repositories.
88

99
```bash
1010
# . python-workspace/
@@ -43,13 +43,21 @@ You can open this directory in your IDE to make your life easier instead of open
4343
cp -R ../uipath-agents-python/examples/basic basic
4444
cd basic
4545
46-
# repeat the instructions to run an agent from [README.md](README.md)
46+
# Ensure agent.json is at the top level (required for runtime detection)
47+
ls agent.json
48+
49+
# Authenticate and run
4750
uv run uipath auth --alpha
48-
uv run uipath agent.json '{}'
51+
uv run uipath run agent.json '{}'
4952
```
5053
5154
3. You now have a fully functioning setup to start working on `uipath-agents-python`. Any change will be picked up by the `playground` project for testing.
5255
56+
**Key behavior to remember:**
57+
- The runtime automatically detects agents by the presence of `agent.json` at the top level - this MUST be present at all times even if `.agent-builder/` with `agent.json` in already exists.
58+
- If you create a `.agent-builder/` directory, it would override the top-level `agent.json` and `bindings.json` during execution.
59+
- Copying contents of .agent-builder runs during both `run` and `debug` commands and files are copied only if the directory exists, without being a critical dependency.
60+
5361
### Multiple Repositories
5462
5563
Due to how the SDKs are structured, most of the code used for agents in stored in `uipath-langchain-python`. And in order to test the changes locally, you'll also need to set it up as an `editable` dependency. While we're at it, we'll do the same for `uipath-python` to have a complete development environment.

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,15 @@ uv run uipath run
6464

6565
The library expects multiple files in order to run:
6666

67-
- `agent.json`: agent definition file
67+
- `agent.json`: agent definition file (also used for Agents runtime detection)
6868
- `bindings.json`: agent's bindings definiton file
6969
- `uipath.json`: binding overwrite information
7070

71-
These files are generated automatically by Studio Web / Serverless Executor and can be obtained for local development by following these steps:
71+
These files must be present at the **top level** of your working directory. The UiPath CLI automatically detects which runtime to use based on the presence of `agent.json` - if found, it loads the `AgentsRuntimeFactory` from this package to handle agent execution.
72+
73+
#### Getting the Configuration Files
74+
75+
These files are generated automatically by Studio Web / Serverless Executor. For local development, you can obtain them by following these steps:
7276

7377
1. Open an agent project in Studio Web.
7478
2. Start a Debug run (you can wait for the agent to finish or stop after a few seconds).
@@ -80,7 +84,7 @@ These files are generated automatically by Studio Web / Serverless Executor and
8084

8185
- if a warning with `.agent-builder folder not found` is displayed, run the agent in Debug one more time
8286

83-
4. Copy the `agent.json` and `bindings.json` from the output.
87+
4. Copy the `agent.json` and `bindings.json` from the output to your local project directory.
8488
5. Create a `uipath.json` file using the following contents:
8589

8690
```json
@@ -93,13 +97,15 @@ These files are generated automatically by Studio Web / Serverless Executor and
9397
}
9498
```
9599

100+
**Note on `.agent-builder` directory**: When running agents locally, the runtime automatically checks for a `.agent-builder/` directory. If it exists, any files inside will be copied to the top level, overriding existing files. This is used by Studio Web, but you can also leverage it for local testing by placing updated configurations in `.agent-builder/` without modifying your main files.
101+
96102
### Commands
97103

98104
For normal local development, only the `run` command is relevant, as the `debug` command is not meant for local debug, it's intended for Studio Web debug. The `run` command can be used for debugging the python code IDE.
99105
100106
**Run**
101107
102-
The basic command used to start or resume an agent execution in production mode (source code [cli_run.py](src/uipath_agents/_cli/cli_run.py))
108+
The basic command used to start or resume an agent execution in production mode (source code [cli_run.py](src/uipath_agents/_cli/cli_run.py)). This command will automatically prepare agent files from `.agent-builder/` if that directory exists before executing.
103109
104110
```bash
105111
# Start the agent.json from the current directory with inline args
@@ -118,24 +124,28 @@ uv run uipath run --resume
118124
```
119125

120126
- **Entrypoint** is currently unused for Agents, it can be be any string or removed entirely.
127+
- Files from `.agent-builder/` are automatically copied to the top level if that directory exists
121128

122129
**Debug (StudioWeb)**
123130

124-
The command used for runs started from Studio Web. It loads the `agent.json` and `bindings.json` from the `.agent-builder` directory and copies them to the root directory and wires-up the debug hooks / channels. Should not be used for local development unless you're working on debug specific features.
131+
The command used for runs started from Studio Web. Like the `run` command, it automatically prepares files from `.agent-builder/` if that directory exists, then wires-up the debug hooks and communication channels with Studio Web. Should not be used for local development unless you're working on debug specific features.
125132

126133
```bash
127134
# <entrypoint> <args>
128135
uv run uipath debug agent.json '{}'
129136
```
130137

138+
- Files are loaded from `.agent-builder/` and copied to the top level before execution
139+
- Establishes bidirectional communication with Studio Web for breakpoints, logs, and state inspection
140+
131141
**Dev**
132142

133143
Currently work in progress. It's available for standard coded agents but not yet adapted for agents.
134144

135145
### Hints
136146

137-
- Take a look at the configurations in `./examples`\_
138-
- You can run any agent from any sub directory of `uipath-agents-python` as long as you have the three required files present.
147+
- Take a look at the configurations in `./examples`
148+
- You can run any agent from any sub directory of `uipath-agents-python` as long as you have the three required files present at the top level of that directory.
139149
- Remember to run `uv run uipath auth (--alpha)` if you get a 401 while executing the agent.
140150
- You can also download the solution package from Studio Web and get the files from the `.agent-builder` directory or from an already published package.
141151
- Do not confuse the `uipath debug` command with the `--debug` flag. The former is used for StudioWeb two-way communication for breakpoints, logs and so on and the latter waits for a debugger to be attached to the running process.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ description = "UiPath Agents"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
77
dependencies = [
8-
"uipath>=2.2.6",
9-
"uipath-langchain>=0.1.4",
8+
"uipath>=2.2.8",
9+
"uipath-langchain>=0.1.6",
1010
"langgraph>=1.0.0",
1111
"azure-monitor-opentelemetry>=1.7.0",
1212
"opentelemetry-instrumentation-aiohttp-client>=0.49.0",

0 commit comments

Comments
 (0)