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
Copy file name to clipboardExpand all lines: backend/agent/README.md
+39-8Lines changed: 39 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
3
3
# Launch an agent
4
4
5
-
The agent is the process that starts operator containers, coordinates their lifecycle, and talks to the platform over NATS. You need at least one running agent before operators can launch.
5
+
The agent is the process that starts operator containers, coordinates their lifecycle, and talks to the rest of the platform over NATS. You need at least one running agent before operators can launch.
6
6
7
7
## Prerequisites
8
8
9
-
Have a Python environment manager available (e.g., [`poetry`](https://python-poetry.org/docs/) or [`uv`](https://github.com/astral-sh/uv)).
9
+
Have a Python environment manager available (e.g., [`uv`](https://github.com/astral-sh/uv)).
10
10
11
11
## Configure the environment
12
12
@@ -23,10 +23,10 @@ cd backend/agent
23
23
AGENT_NAME=SecretAgentMan # change to how you want it to display in the frontend
24
24
```
25
25
26
-
- If you want to target specific resources, set tags:
26
+
- If you want to run operators with specific tags on this agent, set your tags:
27
27
28
28
```bash
29
-
AGENT_TAGS='["ncem-4dcamera","gpu"]'
29
+
AGENT_TAGS='["ncem-4dcamera"]'
30
30
```
31
31
32
32
## Install and run
@@ -43,12 +43,9 @@ or
43
43
uv sync
44
44
```
45
45
46
-
If an agent is running at NERSC, we will use `podman-hpc`:
46
+
If an agent is running at NERSC, we will use `podman-hpc`. If using `uv`, it will attempt to use the python binary from the user account that ran this command first, which is normally stored in `~/.local/share/uv/python`. If you are sharing this agent between users, you can set the `UV_PYTHON_INSTALL_DIR` env var to a shared location.
47
47
48
48
```bash
49
-
# note this will link the current user account's python (normally stored in ~/.local/share/uv/python)
50
-
# if we need to share across accounts, you can set the `UV_PYTHON_INSTALL_DIR` env var to a shared location
51
-
# prior to running the command below
52
49
uv sync --extra hpc
53
50
```
54
51
@@ -65,3 +62,37 @@ or with `uv`:
65
62
cd backend/agent
66
63
uv run interactem-agent
67
64
```
65
+
66
+
## Connecting an agent to a different NATS cluster
67
+
68
+
To connect into a different NATS cluster, we have to set the `.env` variables:
69
+
70
+
```bash
71
+
NATS_SERVER_URL=nats://the.url.to.nats # could also be ws/wss (websocket/secure websocket)
72
+
NATS_SERVER_URL_IN_CONTAINER=nats://the.url.to.nats # same as above
73
+
NATS_CREDS_FILE=/path/to/backend.creds
74
+
OPERATOR_CREDS_FILE=/path/to/operator.creds
75
+
AGENT_NETWORKS='["your-network-name"]'# need to be changed
76
+
ZMQ_BIND_INTERFACE="eth0"# interface you are planning to transmit data from on this agent.
77
+
```
78
+
79
+
## Connecting agents and their resources
80
+
81
+
`AGENT_TAGS` and `AGENT_NETWORKS` matter for how the pipeline will be deployed.
82
+
83
+
Say you have Data Reader Operator and you want to always run it next to your microscope. You must do the following:
84
+
85
+
1. On your local agent, set `AGENT_TAGS='["a-unique-tag-name"]'.
86
+
1. On your operator that you want to always run on the agent's machine, set the tag in the operator spec:
87
+
88
+
```json
89
+
"tags": [
90
+
{
91
+
"value": "a-unique-tag-name",
92
+
"description": "Required to run on agents with the tag a-unique-tag-name."
93
+
}
94
+
]
95
+
```
96
+
97
+
1. Then, let's say this pipeline involves a processing step that is very heavy and needs gpus. Tag that operator with `gpu`, and it will be sent to an agent that also has the tag `gpu`.
98
+
1. If the connection between these operators crosses a `AGENT_NETWORKS` boundary ONE TIME, it may not cross that boundary again. This is because we only allow OUTBOUND connections from Operator inputs, and thereby INBOUND connections to operator outputs. This is a bit of a quirk, and could be fixed by other means in the future.
Copy file name to clipboardExpand all lines: docs/source/launch-agent.md
+39-8Lines changed: 39 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Launch an agent
2
2
3
-
The agent is the process that starts operator containers, coordinates their lifecycle, and talks to the platform over NATS. You need at least one running agent before operators can launch.
3
+
The agent is the process that starts operator containers, coordinates their lifecycle, and talks to the rest of the platform over NATS. You need at least one running agent before operators can launch.
4
4
5
5
## Prerequisites
6
6
7
-
Have a Python environment manager available (e.g., [`poetry`](https://python-poetry.org/docs/) or [`uv`](https://github.com/astral-sh/uv)).
7
+
Have a Python environment manager available (e.g., [`uv`](https://github.com/astral-sh/uv)).
8
8
9
9
## Configure the environment
10
10
@@ -21,10 +21,10 @@ cd backend/agent
21
21
AGENT_NAME=SecretAgentMan # change to how you want it to display in the frontend
22
22
```
23
23
24
-
- If you want to target specific resources, set tags:
24
+
- If you want to run operators with specific tags on this agent, set your tags:
25
25
26
26
```bash
27
-
AGENT_TAGS='["ncem-4dcamera","gpu"]'
27
+
AGENT_TAGS='["ncem-4dcamera"]'
28
28
```
29
29
30
30
## Install and run
@@ -41,12 +41,9 @@ or
41
41
uv sync
42
42
```
43
43
44
-
If an agent is running at NERSC, we will use `podman-hpc`:
44
+
If an agent is running at NERSC, we will use `podman-hpc`. If using `uv`, it will attempt to use the python binary from the user account that ran this command first, which is normally stored in `~/.local/share/uv/python`. If you are sharing this agent between users, you can set the `UV_PYTHON_INSTALL_DIR` env var to a shared location.
45
45
46
46
```bash
47
-
# note this will link the current user account's python (normally stored in ~/.local/share/uv/python)
48
-
# if we need to share across accounts, you can set the `UV_PYTHON_INSTALL_DIR` env var to a shared location
49
-
# prior to running the command below
50
47
uv sync --extra hpc
51
48
```
52
49
@@ -63,3 +60,37 @@ or with `uv`:
63
60
cd backend/agent
64
61
uv run interactem-agent
65
62
```
63
+
64
+
## Connecting an agent to a different NATS cluster
65
+
66
+
To connect into a different NATS cluster, we have to set the `.env` variables:
67
+
68
+
```bash
69
+
NATS_SERVER_URL=nats://the.url.to.nats # could also be ws/wss (websocket/secure websocket)
70
+
NATS_SERVER_URL_IN_CONTAINER=nats://the.url.to.nats # same as above
71
+
NATS_CREDS_FILE=/path/to/backend.creds
72
+
OPERATOR_CREDS_FILE=/path/to/operator.creds
73
+
AGENT_NETWORKS='["your-network-name"]'# need to be changed
74
+
ZMQ_BIND_INTERFACE="eth0"# interface you are planning to transmit data from on this agent.
75
+
```
76
+
77
+
## Connecting agents and their resources
78
+
79
+
`AGENT_TAGS` and `AGENT_NETWORKS` matter for how the pipeline will be deployed.
80
+
81
+
Say you have Data Reader Operator and you want to always run it next to your microscope. You must do the following:
82
+
83
+
1. On your local agent, set `AGENT_TAGS='["a-unique-tag-name"]'.
84
+
1. On your operator that you want to always run on the agent's machine, set the tag in the operator spec:
85
+
86
+
```json
87
+
"tags": [
88
+
{
89
+
"value": "a-unique-tag-name",
90
+
"description": "Required to run on agents with the tag a-unique-tag-name."
91
+
}
92
+
]
93
+
```
94
+
95
+
1. Then, let's say this pipeline involves a processing step that is very heavy and needs gpus. Tag that operator with `gpu`, and it will be sent to an agent that also has the tag `gpu`.
96
+
1. If the connection between these operators crosses a `AGENT_NETWORKS` boundary ONE TIME, it may not cross that boundary again. This is because we only allow OUTBOUND connections from Operator inputs, and thereby INBOUND connections to operator outputs. This is a bit of a quirk, and could be fixed by other means in the future.
0 commit comments