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: docs/design/multi-agent-runtime-proposal.md
+31-14Lines changed: 31 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,16 +207,22 @@ In both policies, coordinator failure always causes full rollback and an error r
207
207
208
208
#### Dependency endpoint injection
209
209
210
-
Before a dependent role's sandbox is created, the verified pod IPs of its dependencies are injected as environment variables into the pod template. The naming convention is:
210
+
Before a dependent role's sandbox is created, the verified pod IPs of its dependencies are injected as environment variables into the pod template. To ensure compatibility with standard shell naming conventions, any hyphens or non-alphanumeric characters in the role name are replaced by underscores.
For a role with `dependencies: [planner]`, the pod receives:
218
+
**Port Resolution Rule:**
219
+
* If the dependency's `AgentRuntime` CRD defines a single port, that port is used.
220
+
* If it defines multiple ports, the system first looks for a port named `http` or `default`. If no such port is found, it falls back to the first port in the ports list.
221
+
222
+
For a role with `dependencies: [my-planner]` (where the planner exposes `8080` as the first port), the dependent pod receives:
217
223
218
224
```
219
-
AGENTCUBE_DEP_PLANNER_ENDPOINT = 10.0.0.4:8080
225
+
AGENTCUBE_DEP_MY_PLANNER_ENDPOINT = 10.0.0.4:8080
220
226
```
221
227
222
228
Injection happens in-memory inside `createSandboxGroup()` by mutating the pod template before it is passed to `buildSandboxByAgentRuntime()`. The referenced `AgentRuntime` CRD object in the informer cache is never written.
@@ -290,11 +296,12 @@ func (s *Server) createSandboxGroup(
Both `store_redis.go` and `store_valkey.go` implement these methods using the key prefix `agentgroup:`. The serialization format is JSON, consistent with existing `sandbox:` entries.
520
+
Both `store_redis.go` and `store_valkey.go` implement these methods using the key prefix `agentgroup:`.
506
521
507
-
> **Note:**`UpdateAgentGroupRoleStatus` performs a read-modify-write on the manifest JSON. Under high concurrency this could race, but group manifests are updated infrequently (only during self-healing) and only by the reconciler, so optimistic concurrency control is not required in the initial implementation.
522
+
> **Store Implementation Note:** To prevent race conditions in a distributed environment during concurrent updates, the store backends (Redis/Valkey) implement group manifests using a **Redis Hash** (`HSET agentgroup:{groupSessionID}`) instead of a raw JSON string.
523
+
>
524
+
> The hash fields map directly to roles and their metadata (e.g., `HSET agentgroup:{groupSessionID} role:{roleName} <json>`), allowing atomic field-level updates without rewriting the full manifest JSON, avoiding read-modify-write races.
0 commit comments