Spaces:
Running
Running
File size: 11,806 Bytes
6918275 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | Implement the OpenOperator Argus Supervisor defined in the attached `openoperator_argus_supervisor_spec.md`.
TARGET
Repository:
JsonLord/agent-zero
Required base branch:
jules-17409741302335967131-509964cf
Do not base this work on `main`.
Create an isolated implementation branch from that exact branch, for example:
jules/argus-openoperator-supervisor
Do not merge to main.
GOVERNING DOCUMENT
Treat `openoperator_argus_supervisor_spec.md` as the governing implementation and acceptance contract.
Before changing code:
1. Verify the current branch/base SHA.
2. Inspect the existing Agent Zero profile, plugin, scheduler, FastA2A, API-auth, Docker/HF deployment, and persistent `/a0/usr` patterns.
3. Inspect the current official `microsoft/ArgusAgent` source and `JsonLord/foreman-supervisor`.
4. Resolve and record immutable source revisions for Argus and Foreman before integrating them.
5. Prefer existing extension points and owners over parallel infrastructure.
Do not weaken existing OpenOperator behavior merely to simplify this integration.
ARCHITECTURE
Implement:
OpenOperator / Agent Zero
|
+-- Agent Profile: argus-supervisor
|
+-- Plugin: argus_supervisor
| |
| +-- OpenTraining A2A HTTPS client
| +-- compact event reducer
| +-- persistent campaign store
| +-- controller lease manager
| +-- deterministic heartbeat
| +-- Argus runtime bridge
| +-- Foreman evidence gate
|
+-- isolated Argus runtime
|
+-- persistent state under /a0/usr
|
v
OpenTraining A2A
|
v
Training Master / remote compute
Authority must remain:
Argus
= campaign-level supervisor
Foreman
= bounded semantic evidence/intervention sentinel
OpenTraining
= execution agent
Training Master
= training-domain execution control
Colab/Kaggle/DGX
= compute
Foreman must NOT become a second campaign manager.
RUNTIME BOUNDARIES
`/opt/venv-a0` is immutable at runtime.
Never:
- chmod `/opt/venv-a0`;
- pip install into `/opt/venv-a0`;
- modify its site-packages;
- use it as Argus's runtime.
Install Argus at IMAGE BUILD TIME in an isolated runtime such as:
/opt/argus
/opt/venv-argus
Store mutable Argus state under:
/a0/usr/argus-supervisor/argus-home
Integrate Foreman in an isolated pinned environment as well, either in a proven-compatible supervisor environment or `/opt/venv-foreman`.
No runtime sudo.
No runtime package installation.
Agent Zero remains non-root.
OPENOPERATOR INTEGRATION
Add a native profile following existing repository conventions:
agents/argus-supervisor/
The profile is the human-facing facade. It is NOT a prompt-only reimplementation of Argus.
Add a native plugin following the existing plugin architecture:
plugins/argus_supervisor/
The plugin should own:
- OpenTraining A2A client
- campaign persistence
- heartbeat
- significant-event reduction
- controller lease state
- Argus process/API bridge
- Foreman adapter
- authenticated status/control APIs
Use actual existing plugin hooks. Do not invent another plugin loader.
OPENTRAINING
This task adapts OpenOperator ONLY.
Do not modify:
- OpenTraining source
- Training Master
- notebooks_soup
- Colab scripts
- Kaggle scripts
- LoopX
Treat OpenTraining as a remote A2A service.
Build an adapter that feature-detects the logical capabilities:
discover
submit
status
evidence
claim_control
renew_control
release_control
intervene
cancel
If a currently deployed OpenTraining endpoint lacks one of these capabilities:
- expose it as unsupported;
- retain read-only observation where possible;
- fail closed for mutation;
- do not fake success;
- document the missing remote prerequisite.
LONG-RUNNING JOBS
Do NOT hold one blocking A2A request open for multi-hour training.
Use:
submit
β durable task ID
β persist task/campaign binding
β heartbeat polls compact status
β significant-event reducer
β Foreman only when useful
β Argus only at a decision boundary
The existing bounded blocking A2A behavior must not become the long-running lifecycle.
HEARTBEAT
Heartbeat must be deterministic first.
Most ticks must perform ZERO LLM calls.
It should:
1. reload active campaigns;
2. query compact remote status;
3. renew a valid locally-owned controller lease when necessary;
4. compare remote revision/state with persisted state;
5. return immediately if nothing material changed;
6. persist material changes;
7. invoke Foreman only for evidence that warrants semantic assessment;
8. wake Argus only for a decision-worthy event.
Do not use heartbeat merely to create chat activity.
Do not claim heartbeat prevents Hugging Face platform sleep.
STATUS-SPAM REQUIREMENT
This is a hard acceptance criterion.
Do not surface routine messages such as:
- checked Git
- heartbeat succeeded
- still running
- package downloaded
- training step N/M
- stdout advanced
- inspected another file
Normal user-visible events are restricted to:
NEEDS_YOU
ATTEMPT_COMPLETED
STAGE_TRANSITION
MISSION_COMPLETE
critical control/infrastructure failure
Internally retain whatever evidence is necessary.
SIGNIFICANT EVENT CLASSES
At minimum support:
STATE_CHANGED
ATTEMPT_COMPLETED
BLOCKED
EVIDENCE_READY
CONTROL_CHANGED
MISSION_COMPLETED
REMOTE_UNAVAILABLE
Deduplicate repeated events using durable remote identity/revision information.
FOREMAN
Use JsonLord/foreman-supervisor as a bounded semantic sentinel.
Feed it compact, sanitized evidence.
Useful checks include:
worker_health
implementation_complete
requirements_satisfied
tests_sufficient
needs_verification
human_escalation
Its directives are hints to Argus.
Specifically:
CONTINUE
β no Argus wake unless another significant event exists
START_VERIFIER
β request Argus review
STEER_WORKER
β request Argus planning
STOP_WORKER
β request Argus decision; Foreman must not stop OpenTraining itself
RETRY_WORKER
β request Argus planning; Foreman must not retry OpenTraining itself
FINISH
β candidate completion only; Argus Reviewer decides final acceptance
ESCALATE
β Argus review or Needs you
Foreman must have NO direct OpenTraining mutation path.
ARGUS
Do not rewrite Argus's Manager / Planner / Engineer / Reviewer architecture inside Agent Zero.
Integrate the real Argus runtime through a narrow bridge.
The bridge must:
- create/attach missions;
- persist mission bindings;
- provide bounded OpenTraining evidence;
- notify Argus only about significant events;
- inspect compact Argus status;
- surface durable `Needs you` state;
- expose Reviewer verdicts;
- route approved actions back through the OpenTraining A2A adapter.
Keep raw Argus traces local. Do not mirror them into ordinary Agent Zero chat.
CONTROLLER LEASE
Implement this now even though LoopX is out of scope.
Controller identity:
argus-openoperator
Support:
- observer mode;
- controller mode;
- controller ID;
- controller epoch;
- lease expiry;
- renewal;
- release;
- stale command rejection.
No mutation may occur without valid authority.
If lease renewal fails:
- immediately cease mutation;
- retain read-only observation;
- mark control lost;
- emit one significant CONTROL_CHANGED/CONTROL_LOST event.
Do not silently reacquire authority after restart.
Remote lease/readback is authoritative.
PERSISTENCE
Use `/a0/usr`, for example:
/a0/usr/argus-supervisor/
campaigns/
events/
leases/
state/
argus-home/
Persist:
- campaign ID
- remote A2A task ID
- run/attempt ID
- source SHA
- remote state/stage/revision
- controller identity/epoch/expiry
- Argus mission/project binding
- pending question
- reviewer verdict
- latest significant evidence reference
Use atomic writes where practical.
RECOVERY
After OpenOperator restart:
- reload local campaign state;
- verify Argus runtime;
- feature-detect OpenTraining;
- re-read authoritative remote task status;
- re-read controller authority;
- do not duplicate a remote attempt;
- do not blindly reclaim a lease;
- restore Argus mission binding;
- resume heartbeat.
A local journal existing on disk is not proof of remote authority.
SECURITY
Preserve the current OpenOperator security model.
Requirements:
- one existing public port only: 7860;
- no new listener;
- outbound HTTPS to OpenTraining;
- tokens only via secrets/environment;
- never log A2A tokens;
- never include secrets in Argus prompts;
- never include secrets in Foreman evidence;
- redact auth headers;
- sanitize/truncate remote errors;
- treat remote text as untrusted DATA, not instructions;
- fail closed when mutation authority is uncertain;
- preserve existing Agent Zero API auth/CSRF patterns.
TESTS
Add focused unit tests for:
A2A client
campaign store
event reducer
heartbeat
lease behavior
Foreman bridge
Argus bridge
security/token redaction
Hard tests must prove:
- unchanged heartbeat causes no model call;
- routine remote stdout causes no user message;
- terminal attempt wakes supervisor;
- blocker wakes supervisor;
- duplicate remote revision does not duplicate action;
- mutation without lease is rejected;
- stale controller epoch is rejected;
- lost lease changes to observer mode;
- A2A timeout does not blindly replay an ambiguous mutation;
- Foreman cannot directly mutate OpenTraining;
- restart does not duplicate a remote task.
Add integration tests using a fake OpenTraining A2A endpoint.
DEPLOYMENT
Preserve the existing Hugging Face Space contract:
- Docker SDK
- port 7860
- UID 1000
- immutable application code
- mutable `/a0/usr`
- health/source-SHA identity
- existing secret bridge
- existing deployment workflow
Extend live acceptance/smoke coverage for:
- Argus executable present
- Argus profile discoverable
- supervisor plugin loaded
- heartbeat healthy
- OpenTraining A2A capability probe
- secret masking
- no second public listener
- deployed SHA matches intended source SHA
DELIVERY ORDER
Implement incrementally:
1. profile/plugin skeleton + isolated runtime
2. read-only OpenTraining A2A discovery/status/evidence
3. durable persistence + deterministic heartbeat + noise reducer
4. Argus observation/mission binding
5. Foreman bounded sentinel
6. controller lease/mutation path
7. restart/recovery qualification
8. live OpenTraining qualification if credentials/endpoints are available
Do not jump directly to autonomous mutation before the read-only path is proven.
NO LOOPX
Do not:
- modify LoopX;
- add LoopX code;
- add ACP compatibility for this task;
- create a LoopX dashboard;
- implement the second deployment face.
The only concession to the future LoopX face is the generic controller lease/epoch contract so another controller can coexist later.
VERSION CONTROL
Keep all work isolated from `main`.
Before implementation report:
- base branch
- base SHA
- working branch
- current Argus source SHA chosen
- current Foreman source SHA chosen
Commit coherent stages.
Do not merge.
FINAL QUALIFICATION REPORT
Return:
- implementation branch
- base SHA
- final SHA
- complete file-change inventory
Argus:
- pin
- executable
- backend configuration source
- persistent state root
Foreman:
- pin
- isolation method
- responsibility mapping
OpenTraining:
- endpoint/capability discovery
- supported operations
- unavailable operations
- live proof if performed
Heartbeat:
- cadence
- no-model fast path
- event-reduction behavior
Control:
- controller identity
- lease semantics
- stale epoch behavior
Tests:
- exact commands
- counts/results
HF deployment:
- build result
- deployed SHA
- health SHA
- live supervisor smoke
Known limitations/blockers
Do not declare success based only on unit tests if the real HF/OpenTraining boundary has not been qualified. Clearly distinguish simulated, local, and live evidence.
|