gpu4agents 0.12.0__tar.gz → 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.claude-plugin/plugin.json +1 -1
  2. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.cursor-plugin/plugin.json +1 -1
  3. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/workflows/ci.yml +9 -1
  4. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/CHANGELOG.md +41 -0
  5. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/INSTALL.md +1 -1
  6. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/PKG-INFO +12 -1
  7. gpu4agents-0.14.0/QUEUE.md +217 -0
  8. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/README.md +5 -0
  9. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/ACCEPTANCE.md +37 -4
  10. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/AGENTS.md +6 -5
  11. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/CONFIG.md +32 -3
  12. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/INTEGRATION.md +16 -1
  13. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/LIFECYCLE.md +15 -1
  14. gpu4agents-0.14.0/docs/QUEUE_BACKENDS.md +74 -0
  15. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/USAGE.md +17 -4
  16. gpu4agents-0.14.0/docs/handoff/2026-11-11-video-validation-fixes.md +192 -0
  17. gpu4agents-0.14.0/docs/handoff/2026-11-12-queue-mode-field-run.md +35 -0
  18. gpu4agents-0.14.0/docs/superpowers/plans/2026-11-12-queue-mode.md +489 -0
  19. gpu4agents-0.14.0/docs/superpowers/specs/2026-11-12-queue-mode-design.md +257 -0
  20. gpu4agents-0.14.0/examples/queue-smoke/.env.example +5 -0
  21. gpu4agents-0.14.0/examples/queue-smoke/.gitignore +3 -0
  22. gpu4agents-0.14.0/examples/queue-smoke/gpu.yaml +43 -0
  23. gpu4agents-0.14.0/examples/queue-smoke/job/gpujob.yaml +3 -0
  24. gpu4agents-0.14.0/examples/queue-smoke/job/matmul.py +26 -0
  25. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu.example.yaml +25 -0
  26. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu.models.yaml +46 -0
  27. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/__init__.py +1 -1
  28. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/agent/install.py +33 -0
  29. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/agent/mcp.py +184 -14
  30. {gpu4agents-0.12.0/skills/gpu4agents → gpu4agents-0.14.0/gpu4agents/agent/skill}/SKILL.md +33 -11
  31. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/_common.py +48 -0
  32. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/account.py +8 -3
  33. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/agent.py +20 -1
  34. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/lifecycle.py +32 -0
  35. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/main.py +12 -1
  36. gpu4agents-0.14.0/gpu4agents/cli/queue.py +408 -0
  37. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/setup.py +96 -22
  38. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/timer.py +138 -0
  39. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/beacon.py +3 -0
  40. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/config.py +102 -0
  41. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/engine.py +361 -5
  42. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/events.py +32 -0
  43. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/job.py +29 -1
  44. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/model_inspect.py +20 -0
  45. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/models.py +8 -0
  46. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/paths.py +30 -0
  47. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/policy.py +10 -0
  48. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/sweep.py +185 -1
  49. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/base.py +8 -0
  50. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/gpus.py +64 -0
  51. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/mapper.py +13 -0
  52. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/provider.py +6 -1
  53. gpu4agents-0.14.0/gpu4agents/queue/__init__.py +1 -0
  54. gpu4agents-0.14.0/gpu4agents/queue/api.py +520 -0
  55. gpu4agents-0.14.0/gpu4agents/queue/audit.py +487 -0
  56. gpu4agents-0.14.0/gpu4agents/queue/backend.py +120 -0
  57. gpu4agents-0.14.0/gpu4agents/queue/backends/__init__.py +1 -0
  58. gpu4agents-0.14.0/gpu4agents/queue/backends/local.py +336 -0
  59. gpu4agents-0.14.0/gpu4agents/queue/backends/redis.py +500 -0
  60. gpu4agents-0.14.0/gpu4agents/queue/coordinator.py +1860 -0
  61. gpu4agents-0.14.0/gpu4agents/queue/models.py +121 -0
  62. gpu4agents-0.14.0/gpu4agents/queue/observe.py +129 -0
  63. gpu4agents-0.14.0/gpu4agents/queue/outputs.py +428 -0
  64. gpu4agents-0.14.0/gpu4agents/queue/pool.py +1013 -0
  65. gpu4agents-0.14.0/gpu4agents/queue/pool_types.py +40 -0
  66. gpu4agents-0.14.0/gpu4agents/queue/preflight.py +121 -0
  67. gpu4agents-0.14.0/gpu4agents/queue/scaler.py +85 -0
  68. gpu4agents-0.14.0/gpu4agents/queue/spend.py +94 -0
  69. gpu4agents-0.14.0/gpu4agents/queue/testing.py +270 -0
  70. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/agent_body.py +24 -14
  71. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/builder.py +36 -5
  72. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/jobs_ext.py +101 -4
  73. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/install.sh +2 -2
  74. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/pyproject.toml +4 -2
  75. {gpu4agents-0.12.0/gpu4agents/agent/skill → gpu4agents-0.14.0/skills/gpu4agents}/SKILL.md +33 -11
  76. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/conftest.py +32 -0
  77. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/fakes.py +14 -3
  78. gpu4agents-0.14.0/tests/queue_fakes.py +414 -0
  79. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_agent.py +1 -0
  80. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_config.py +44 -0
  81. gpu4agents-0.14.0/tests/test_docs.py +88 -0
  82. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_engine.py +55 -0
  83. gpu4agents-0.14.0/tests/test_field_run.py +557 -0
  84. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_job_outputs.py +5 -5
  85. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_jobs.py +91 -27
  86. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_policy.py +26 -0
  87. gpu4agents-0.14.0/tests/test_queue_audit.py +491 -0
  88. gpu4agents-0.14.0/tests/test_queue_backend_local.py +78 -0
  89. gpu4agents-0.14.0/tests/test_queue_backend_redis.py +169 -0
  90. gpu4agents-0.14.0/tests/test_queue_backend_redis_config.py +80 -0
  91. gpu4agents-0.14.0/tests/test_queue_cli.py +673 -0
  92. gpu4agents-0.14.0/tests/test_queue_coordinator.py +1410 -0
  93. gpu4agents-0.14.0/tests/test_queue_models.py +49 -0
  94. gpu4agents-0.14.0/tests/test_queue_observe.py +49 -0
  95. gpu4agents-0.14.0/tests/test_queue_outputs.py +394 -0
  96. gpu4agents-0.14.0/tests/test_queue_pool.py +669 -0
  97. gpu4agents-0.14.0/tests/test_queue_preflight.py +108 -0
  98. gpu4agents-0.14.0/tests/test_queue_scaler.py +86 -0
  99. gpu4agents-0.14.0/tests/test_queue_spend.py +63 -0
  100. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_serve.py +3 -1
  101. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_sweep.py +161 -0
  102. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_watchdog.py +45 -0
  103. gpu4agents-0.12.0/reports/GPU pr/303/263pria para agentes de c/303/263digo.md" +0 -94
  104. gpu4agents-0.12.0/research_notes/GPU pr/303/263pria para agentes de c/303/263digo/capabilities_unlocked.md" +0 -128
  105. gpu4agents-0.12.0/research_notes/GPU pr/303/263pria para agentes de c/303/263digo/market.md" +0 -140
  106. gpu4agents-0.12.0/research_notes/GPU pr/303/263pria para agentes de c/303/263digo/user_pain.md" +0 -132
  107. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.claude-plugin/marketplace.json +0 -0
  108. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.env.example +0 -0
  109. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  110. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  111. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  112. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/dependabot.yml +0 -0
  113. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/pull_request_template.md +0 -0
  114. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.github/workflows/release.yml +0 -0
  115. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/.gitignore +0 -0
  116. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/CODE_OF_CONDUCT.md +0 -0
  117. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/CONTRIBUTING.md +0 -0
  118. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/JOBS.md +0 -0
  119. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/LICENSE +0 -0
  120. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/PROVIDERS.md +0 -0
  121. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/SECURITY.md +0 -0
  122. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/SERVING.md +0 -0
  123. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/ADDING_A_PROVIDER.md +0 -0
  124. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/CHOOSING_A_MODEL.md +0 -0
  125. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/assets/banner.png +0 -0
  126. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/docs/assets/jambu-logo.jpg +0 -0
  127. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/experiment.py +0 -0
  128. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/gpu.yaml +0 -0
  129. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/README.md +0 -0
  130. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/package-lock.json +0 -0
  131. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/package.json +0 -0
  132. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/src/agent.ts +0 -0
  133. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/src/index.ts +0 -0
  134. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/src/tools/weather-tool.ts +0 -0
  135. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/mastra-agent/tsconfig.json +0 -0
  136. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/typescript-client/README.md +0 -0
  137. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/typescript-client/package-lock.json +0 -0
  138. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/typescript-client/package.json +0 -0
  139. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/typescript-client/src/gpu.ts +0 -0
  140. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/typescript-client/src/index.ts +0 -0
  141. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/examples/typescript-client/tsconfig.json +0 -0
  142. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu.yaml +0 -0
  143. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/__main__.py +0 -0
  144. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/agent/__init__.py +0 -0
  145. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/agent/jobs.py +0 -0
  146. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/__init__.py +0 -0
  147. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/inspect.py +0 -0
  148. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/job.py +0 -0
  149. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/providers.py +0 -0
  150. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/run.py +0 -0
  151. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/status.py +0 -0
  152. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/cli/validate.py +0 -0
  153. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/__init__.py +0 -0
  154. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/credentials.py +0 -0
  155. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/durations.py +0 -0
  156. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/errors.py +0 -0
  157. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/execution.py +0 -0
  158. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/health.py +0 -0
  159. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/hosts.py +0 -0
  160. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/state.py +0 -0
  161. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/core/tool_parsers.py +0 -0
  162. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/__init__.py +0 -0
  163. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/http.py +0 -0
  164. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/__init__.py +0 -0
  165. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/client.py +0 -0
  166. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/config.py +0 -0
  167. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/mapper.py +0 -0
  168. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/lambdacloud/provider.py +0 -0
  169. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/registry.py +0 -0
  170. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/__init__.py +0 -0
  171. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/client.py +0 -0
  172. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/config.py +0 -0
  173. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/mapper.py +0 -0
  174. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/runpod/provider.py +0 -0
  175. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/scaffold.py +0 -0
  176. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/__init__.py +0 -0
  177. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/client.py +0 -0
  178. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/providers/vast/config.py +0 -0
  179. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/runtime/__init__.py +0 -0
  180. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/runtime/base.py +0 -0
  181. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/runtime/service.py +0 -0
  182. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/runtime/vllm.py +0 -0
  183. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/__init__.py +0 -0
  184. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/hf/__init__.py +0 -0
  185. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/hf/install.sh +0 -0
  186. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/hf/server.py +0 -0
  187. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/template/__init__.py +0 -0
  188. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/template/gpujob.yaml +0 -0
  189. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/serve/template/server.py +0 -0
  190. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/gpu4agents/watchdog/__init__.py +0 -0
  191. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/jambu_gpu/__init__.py +0 -0
  192. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/jambu_gpu/__main__.py +0 -0
  193. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/skills/gpu4agents/agents/openai.yaml +0 -0
  194. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_cli.py +0 -0
  195. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_engine_sessions.py +0 -0
  196. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_integration.py +0 -0
  197. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_lambda_provider.py +0 -0
  198. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_model_inspect.py +0 -0
  199. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_paths.py +0 -0
  200. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_runpod_provider.py +0 -0
  201. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_runtime_vllm.py +0 -0
  202. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_state.py +0 -0
  203. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_vast_mapper.py +0 -0
  204. {gpu4agents-0.12.0 → gpu4agents-0.14.0}/tests/test_vast_provider.py +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gpu4agents",
3
3
  "description": "Your agent rents the GPU it needs, serves a model on it and runs the experiment. You pay only while it works.",
4
- "version": "0.12.0",
4
+ "version": "0.14.0",
5
5
  "author": {
6
6
  "name": "João Gabriel Lima",
7
7
  "url": "https://www.linkedin.com/in/joaogabriellima"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gpu4agents",
3
3
  "description": "Your agent rents the GPU it needs, serves a model on it and runs the experiment. You pay only while it works.",
4
- "version": "0.12.0",
4
+ "version": "0.14.0",
5
5
  "author": {
6
6
  "name": "João Gabriel Lima"
7
7
  },
@@ -15,13 +15,21 @@ jobs:
15
15
  fail-fast: false
16
16
  matrix:
17
17
  python: ["3.10", "3.11", "3.12", "3.13"]
18
+ services:
19
+ redis:
20
+ image: redis:7
21
+ ports: ["6379:6379"]
22
+ options: >-
23
+ --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10
24
+ env:
25
+ GPU_TEST_REDIS_URL: redis://localhost:6379/15
18
26
  steps:
19
27
  - uses: actions/checkout@v4
20
28
  - uses: actions/setup-python@v5
21
29
  with:
22
30
  python-version: ${{ matrix.python }}
23
31
  cache: pip
24
- - run: pip install -e ".[dev]"
32
+ - run: pip install -e ".[dev,queue-redis]"
25
33
  - run: python -m pytest -q
26
34
 
27
35
  build:
@@ -2,6 +2,47 @@
2
2
 
3
3
  All notable changes to this project. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## [0.14.0] - 2026-11-12
6
+
7
+ ### Added
8
+ - **Queue mode** for applications that send jobs over the day. A `queue:` section in `gpu.yaml` turns it on; a project without one behaves exactly as 0.13.0. Full guide: [QUEUE.md](QUEUE.md).
9
+ - `gpu queue submit | status | ls | cancel | retry | pull | pause | resume | drain | audit | stats | run | install-service`, a Python API (`gpu4agents.queue.api`) and the MCP tools `gpu_queue_submit`, `gpu_queue_status`, `gpu_queue_cancel`, `gpu_queue_pull` and `gpu_queue_control`. Every control action is recorded with who did it.
10
+ - A **coordinator** (`gpu queue run`) opens machines when the oldest queued job has waited `scale_up_after`, within `max_machines` and `max_usd_per_hour`, checks each machine's health, runs jobs back to back on a warm machine, and retires machines that have nothing to do. A second coordinator waits as a standby.
11
+ - **Retries**: a job whose machine vanished, went silent or failed its health check runs again on another machine, up to `max_attempts`, then fails with every attempt's reason. A retried attempt finds the earlier attempt's outputs in `$JAMBU_PREVIOUS_OUTPUT_DIR`.
12
+ - **Deadlines instead of lifetimes**: the coordinator moves each machine's deadline in its own watchdog (`POST /deadline`) to cover the job it took. With the coordinator dead, the pool drains to zero by itself.
13
+ - **Preflight** per job (`timeout`, and the new optional `max_cost_usd` and `min_vram_gb` in `gpujob.yaml`), or your own `module:function`.
14
+ - **Backends**: `local` (SQLite) and `redis` (Redis 5 or newer, one node), and outputs to a local directory or S3, each checked against a sha256 manifest. Others plug in through [the contract](docs/QUEUE_BACKENDS.md); `QueueBackendContract` is the suite a backend runs. Addresses and keys come from `GPU_QUEUE_URL`, `GPU_OUTPUTS_URL` and `AWS_*` in the environment or `~/.gpu/credentials`, never `gpu.yaml`. `redis` and `boto3` are optional extras (`queue-redis`, `queue-s3`).
15
+ - **An auditor** (`gpu queue audit`) checks eight invariants (I1 to I8) and repairs what is safe; events, metrics and alert thresholds are in QUEUE.md.
16
+ - `gpu sweep` and the sweep timer cover pool machines, so a dead coordinator still ends in a destroy with finished jobs' outputs saved, and a pool machine is never taken for an orphan.
17
+ - Acceptance guarantees 24 to 31, one for each thing queue mode must never do (docs/ACCEPTANCE.md).
18
+
19
+ ### Notes
20
+ - Set `queue.namespace` when you use Redis: without it the keyspace follows the config fingerprint and changes when the runtime part of `gpu.yaml` changes.
21
+ - After a takeover by a coordinator whose pool is different, a job on a machine it cannot see waits until that attempt's deadline plus a grace before it runs again.
22
+ - Redis Cluster is not supported.
23
+
24
+ ## [0.13.0] - 2026-11-11
25
+
26
+ The first real, filmed use of 0.12.0 (an agent making images with SDXL and running a CUDA benchmark) found these. Each is fixed and tested.
27
+
28
+ ### Fixed
29
+ - **A machine stopped by hand no longer bills forever without a word.** The agent ended its session with `gpu stop`; on Vast.ai that keeps billing the disk, and with no sweep timer installed nothing would ever destroy it.
30
+ - `gpu stop` and the MCP `gpu_stop` say so: `still_billing`, the disk's cost per day, and whether the sweep timer will remove it after `stopped_ttl`.
31
+ - Every `gpu` command, in any directory, warns about a registered machine left stopped and billing. It reads state files only, so it costs no API call.
32
+ - `gpu agent install` asks once to install the sweep timer (`--sweep-timer` / `--no-sweep-timer`). The timer is the only thing that enforces `stopped_ttl` on a stopped machine.
33
+ - The skill now says to destroy once the work is done and the results are home, the same choice the watchdog makes. Stop only when the user will be back soon or keeps the disk on purpose.
34
+ - **The card the user approved is the one rented.** The agent quoted an RTX 3060 at about $0.08/h and got an RTX 2060 at $0.094/h when the quoted offer was taken. `gpu offers` remembers what it showed, and `gpu setup --offer ID` (MCP `gpu_setup(offer_id)`) rents only that card at no more than that price, host retries included, or nothing. Every setup reports `rented`, `quoted` and `matches_quote`, and warns when they differ.
35
+ - **A project is never kept where it will be lost.** The agent kept `gpu.yaml` in its session scratchpad; the next session saw the machine as an orphan it could not use. `gpu init` refuses a temporary or scratchpad folder (`--allow-temp` overrides), and the skill puts the project at the root of the user's repository.
36
+ - **A machine that vanished leaves a reason.** The log said only "instance missing at provider". Now the reconcile replays the project's rules on what it last knew and records `instance_destroyed reason=idle_timeout by=watchdog inferred=true` when they called for it, or `likely_reason: unknown` when they did not. `gpu setup` also fetches the watchdog's own events as soon as the machine is ready.
37
+
38
+ ### Added
39
+ - `gpu adopt <instance-id>` (MCP `gpu_adopt`) takes over an orphan this account owns. On Vast.ai the boot script the provider kept gives back its watchdog token and model key, so `gpu setup` reuses it when gpu.yaml matches; otherwise it can still be destroyed from there. The provider key in that script is never read back.
40
+ - `gpu offers --for <minutes on an RTX 4090>` (MCP `for_minutes_on_4090`) ranks offers by the estimated cost of the whole job, not the price per hour.
41
+ - Image models are sized for their peak: `gpu init` gives SDXL 16 GB and FLUX 24 GB, and `gpu validate` warns below that (a 12 GB card ran out of memory with SDXL at 1344x768). `gpu.models.yaml` has `sdxl-base`, `flux-dev` and `flux-schnell` profiles.
42
+
43
+ ### Changed
44
+ - The skill and the MCP instructions: size for the peak with 1.5 to 2 times headroom; stop a server before a job that shares its card; compare offers per job; say that `idle_timeout` is 15 minutes by default and the user's to change; the only credentials check is `gpu login --check`, never listing environment variables or a secret store, never another provider's key.
45
+
5
46
  ## [0.12.0] - 2026-11-07
6
47
 
7
48
  ### Fixed
@@ -20,7 +20,7 @@ curl -fsSL https://raw.githubusercontent.com/jambuai/gpu4agents/main/install.sh
20
20
 
21
21
  The script needs only `curl` (Linux or macOS; on Windows, run it inside WSL). It installs [uv](https://docs.astral.sh/uv/) if missing, uses it to install the `gpu4agents` package with a Python it downloads by itself, and then installs the skill and registers the `gpu` MCP server for your runtime. It does not ask for or read any key.
22
22
 
23
- Check: `~/.local/bin/gpu --version` prints 0.12.0 or later.
23
+ Check: `~/.local/bin/gpu --version` prints 0.13.0 or later.
24
24
 
25
25
  For the rest of this session, call the command by its full path, `~/.local/bin/gpu`. Your shell may define `gpu` as an alias: Oh My Zsh's git plugin, on by default, makes `gpu` mean `git push upstream`, and an alias wins over the command, so plain `gpu setup` could run git instead. The installer removes that alias for new shells and says so; tell the user if it did. The same command is also installed as `gpu4agents`.
26
26
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: gpu4agents
3
- Version: 0.12.0
3
+ Version: 0.14.0
4
4
  Summary: GPU for Agents: your coding agent rents the GPU it needs, on its own. You pay only while it works.
5
5
  Project-URL: Homepage, https://gpu4agents.jambu.ai
6
6
  Project-URL: Documentation, https://github.com/jambuai/gpu4agents/tree/main/docs
@@ -34,9 +34,15 @@ Requires-Dist: pyyaml>=6.0.1
34
34
  Requires-Dist: rich>=13.7.0
35
35
  Requires-Dist: typer>=0.12.0
36
36
  Provides-Extra: dev
37
+ Requires-Dist: fakeredis[lua]>=2.23; extra == 'dev'
38
+ Requires-Dist: moto[s3]>=5; extra == 'dev'
37
39
  Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
38
40
  Requires-Dist: pytest>=8.0.0; extra == 'dev'
39
41
  Requires-Dist: respx>=0.21.0; extra == 'dev'
42
+ Provides-Extra: queue-redis
43
+ Requires-Dist: redis>=5; extra == 'queue-redis'
44
+ Provides-Extra: queue-s3
45
+ Requires-Dist: boto3>=1.34; extra == 'queue-s3'
40
46
  Description-Content-Type: text/markdown
41
47
 
42
48
  <p align="center">
@@ -149,6 +155,10 @@ Write this as a GPU for Agents job and run it. Fetch https://gpu4agents.jambu.ai
149
155
 
150
156
  [JOBS.md](JOBS.md) has the contract: the directory, `gpujob.yaml`, the environment a job gets, and the rules its code follows.
151
157
 
158
+ ## Queue mode
159
+
160
+ For an application that sends jobs over the day, `gpu queue submit` puts a job directory in a queue and a coordinator (`gpu queue run`) opens and closes machines for it, retries a job on another machine when one dies, and keeps its verified outputs, within the machine and hourly-spend caps you set. It works with any provider, and the queue can be a local file or Redis. See [QUEUE.md](QUEUE.md).
161
+
152
162
  ## Serve any model
153
163
 
154
164
  Give `gpu` a Hugging Face model id and it serves it behind the OpenAI API shapes, whatever the model does. It reads the model card: chat and vision-language models run on vLLM; image, voice, transcription, embedding and other pipeline models run on gpu's own server. Any OpenAI client then works unchanged.
@@ -218,6 +228,7 @@ A full example is [`gpu.example.yaml`](gpu.example.yaml). `gpu ls` shows every m
218
228
  - [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
219
229
  - [Integrating into an application (any language)](docs/INTEGRATION.md)
220
230
  - [Running your own code as a job](JOBS.md)
231
+ - [Queue mode: jobs on a pool of GPUs](QUEUE.md)
221
232
  - [Commands, workloads, and agents](docs/USAGE.md)
222
233
  - [Every config field](docs/CONFIG.md)
223
234
  - [Choosing a model](docs/CHOOSING_A_MODEL.md)
@@ -0,0 +1,217 @@
1
+ # Queue mode: jobs on a pool of GPUs
2
+
3
+ Agent mode rents one machine for one conversation. Queue mode is for an application that sends jobs over the day: you submit a job directory, a coordinator opens and closes machines as the queue grows and empties, runs the job on one of them, runs it again somewhere else if the machine dies, and keeps the outputs. Any GPU provider works; the pool is rented from the same `gpu.yaml`, through the same provider contract.
4
+
5
+ A project without a `queue:` section behaves exactly as before. Writing a job is unchanged: it is a directory with `gpujob.yaml`, as [jobs.md](https://gpu4agents.jambu.ai/jobs.md) describes. It gains two optional fields, `max_cost_usd` and `min_vram_gb`.
6
+
7
+ Two guarantees from agent mode carry over. A machine with nothing to do for `idle_timeout` (15 minutes) ends, by the same rule as today. And the coordinator is allowed to die: every machine keeps its own watchdog and a hard deadline, so a pool with no coordinator drains to zero by itself.
8
+
9
+ ## Contents
10
+
11
+ - [Quickstart](#quickstart)
12
+ - [The pieces](#the-pieces)
13
+ - [Configuration](#configuration)
14
+ - [Credentials](#credentials)
15
+ - [Submitting and following jobs](#submitting-and-following-jobs)
16
+ - [How a job runs](#how-a-job-runs)
17
+ - [Controls: pause, resume, drain](#controls-pause-resume-drain)
18
+ - [Running the coordinator](#running-the-coordinator)
19
+ - [Observing it: events, metrics, the auditor](#observing-it)
20
+ - [Alerts](#alerts)
21
+ - [What can go wrong](#what-can-go-wrong)
22
+ - [Limits of this version](#limits-of-this-version)
23
+
24
+ ## Quickstart
25
+
26
+ One machine, one host, nothing to install beyond gpu4agents. The local queue is a SQLite file in the project, and outputs land in `gpu-outputs/`.
27
+
28
+ ```yaml
29
+ # gpu.yaml
30
+ gpu_runtime:
31
+ version: 1
32
+ model: {id: Qwen/Qwen2.5-7B-Instruct} # or any model; jobs may use the server over loopback
33
+ compute: {gpu: {min_vram_gb: 24}}
34
+ queue:
35
+ max_machines: 2
36
+ max_usd_per_hour: 2.00
37
+ ```
38
+
39
+ ```bash
40
+ gpu queue submit ./my-job # prints the job id at once; nothing is rented yet
41
+ gpu queue run # the coordinator: opens machines, runs jobs (leave it running)
42
+ gpu queue status # queue counts, pool machines and what they cost per hour
43
+ gpu queue status JOB_ID
44
+ gpu queue pull JOB_ID # verified outputs into gpu-outputs/JOB_ID/
45
+ ```
46
+
47
+ Starting `gpu queue run` rents GPUs and spends money. Decide the caps first (`max_machines`, `max_usd_per_hour`, and each job's `timeout` and `max_cost_usd`).
48
+
49
+ ## The pieces
50
+
51
+ | Piece | What it is |
52
+ | --- | --- |
53
+ | Queue | Where jobs wait. Behind a backend contract. Built in: `local` (SQLite, one host) and `redis` (several hosts share it). Any other queue plugs in through [the contract](https://github.com/jambuai/gpu4agents/blob/main/docs/QUEUE_BACKENDS.md). |
54
+ | Output store | Where job bundles and results live. Built in: `local` (a directory) and `s3` (any S3-compatible bucket). Plugs in the same way. |
55
+ | Coordinator | `gpu queue run`. One process per queue holds a lease; a second one waits as a standby and takes over when the lease expires. Any number of processes may submit. |
56
+ | Pool | The machines, one per slot, labeled `jambu-<name>-<slot>-<fp6>`. They grow when jobs wait and shrink when machines have nothing to do. |
57
+ | Preflight | Runs when a job is claimed. Sets the job's limits (time, cost) and refuses a job that cannot run, with the reason. |
58
+ | Auditor | Checks the queue's guarantees (invariants I1 to I8) and repairs what it safely can. |
59
+
60
+ ## Configuration
61
+
62
+ `gpu_runtime.queue` turns queue mode on. Every field and its default is in [docs/CONFIG.md](https://github.com/jambuai/gpu4agents/blob/main/docs/CONFIG.md#queue). The ones to decide first:
63
+
64
+ | Field | Default | What it controls |
65
+ | --- | --- | --- |
66
+ | `backend` | `local` | `local`, `redis`, or `module:factory` for your own |
67
+ | `outputs` | `local` | `local`, `s3`, or `module:factory` |
68
+ | `namespace` | none | The name of the keyspace on a shared backend |
69
+ | `min_machines` | `0` | Machines kept on with an empty queue (they still time out when idle, see [Controls](#controls-pause-resume-drain)) |
70
+ | `max_machines` | `1` | The most machines at once |
71
+ | `max_usd_per_hour` | none | Cap on what the whole pool bills per hour; blocks opening new machines |
72
+ | `scale_up_after` | `30s` | A machine is opened when the oldest queued job has waited this long |
73
+ | `jobs_per_machine` | `1` | Jobs a machine runs at once |
74
+ | `max_attempts` | `3` | Runs per job before it is failed with every attempt's reason |
75
+ | `unresponsive_after` | `5m` | How long a silent machine is waited for before it is destroyed and its jobs requeued |
76
+ | `max_machine_lifetime` | none | Optional hard ceiling on a machine's age (a warm machine is otherwise never replaced just for being old) |
77
+ | `health_check` | built in | Checked before a machine's first job and between jobs |
78
+ | `defaults` | `timeout: 1h` | Limits for a job that sets none |
79
+
80
+ Set `queue.namespace` when you use Redis. Without it the keyspace is named after the config fingerprint, so it changes when the runtime part of `gpu.yaml` changes, and the new coordinator would look at an empty queue. A name you chose (or the `GPU_QUEUE_NAMESPACE` environment variable) keeps the same keyspace across edits. It is not a secret.
81
+
82
+ The health check is the GPU being visible and a small CUDA operation succeeding. A project may set its own `health_check.command`. That command must not write job outputs: anything it writes under the job outputs counts as activity and holds the idle shutdown.
83
+
84
+ ## Credentials
85
+
86
+ Addresses and keys never go in `gpu.yaml` (a URL there is a config error). They come from the environment or `~/.gpu/credentials`, like provider keys:
87
+
88
+ | Name | Used for |
89
+ | --- | --- |
90
+ | `GPU_QUEUE_URL` | the Redis queue (`redis://` or `rediss://`); logged with the password removed |
91
+ | `GPU_OUTPUTS_URL` | the S3 store, `s3://bucket/prefix` |
92
+ | `AWS_*` | the S3 store's keys and endpoint (`AWS_ENDPOINT_URL` for a non-AWS store), the standard boto3 names |
93
+ | `GPU_QUEUE_NAMESPACE` | optional namespace when `queue.namespace` is not set |
94
+ | `GPU_QUEUE_SUBMITTER` | who is recorded as having submitted or controlled (default `user@host`) |
95
+
96
+ The provider's key never reaches a job, the queue, an output store, an event or a metric. A service started by systemd or launchd does not get your shell's environment, so put the credentials in `~/.gpu/credentials` for it.
97
+
98
+ The Redis and S3 clients are optional extras: `pip install "gpu4agents[queue-redis]"` and `"gpu4agents[queue-s3]"`. Importing gpu4agents without them works.
99
+
100
+ ## Submitting and following jobs
101
+
102
+ ```bash
103
+ gpu queue submit DIR [--key KEY] [--env NAME=VALUE ...]
104
+ gpu queue status [JOB]
105
+ gpu queue ls [--state STATE]
106
+ gpu queue cancel JOB
107
+ gpu queue retry JOB
108
+ gpu queue pull JOB [--to DIR]
109
+ ```
110
+
111
+ - `submit` packs DIR (honouring `exclude`), stores the bundle and returns the job id at once. A bad job (no `run`, a bundle over 2 GB, a `timeout` that does not parse) is rejected before anything is stored. A paused queue still takes the job and says so.
112
+ - `--key` makes a submit idempotent: the same key never queues twice, however many replicas retry it.
113
+ - Job ids are at most 60 characters. `--env` values reach the job but are redacted (shown as `***`) in every status output and never written to the audit trail or the events.
114
+ - Job states: `queued`, `claimed`, `running`, `delivering`, `succeeded`, `failed`, `cancelled`. The last three are final. A job always ends in one of them, with the reason; never "unknown".
115
+ - `cancel` is immediate for a queued job. For a running one the coordinator stops it on its machine and keeps the outputs written so far.
116
+ - `retry` queues a failed job again; it keeps its attempts.
117
+ - `pull` verifies the outputs against their sha256 manifest before it hands them over.
118
+
119
+ From Python, an application does not need to shell out:
120
+
121
+ ```python
122
+ from gpu4agents.queue import api
123
+ job_id = api.submit("train/", key="train-2026-11-12") # idempotent on the key
124
+ info = api.wait(job_id, timeout_s=3600)
125
+ path = api.outputs(job_id)
126
+ ```
127
+
128
+ Agents use the MCP tools `gpu_queue_submit`, `gpu_queue_status`, `gpu_queue_cancel`, `gpu_queue_pull` and `gpu_queue_control`. They never start the coordinator: that rents GPUs and is the user's decision.
129
+
130
+ ## How a job runs
131
+
132
+ 1. The coordinator claims the oldest queued job. The claim is a lease: nobody else sees the job until it expires or the job is settled.
133
+ 2. The preflight decides the job's limits: its `timeout`, its `max_cost_usd` and `min_vram_gb`, with the project's `queue.defaults` filling what it leaves out. A job that cannot run (it needs more VRAM than the pool's card, or its cost limit is below what its timeout costs at the pool's price) fails at once with the reason and rents nothing. A project can name its own preflight (`queue.preflight: module:function`) to decide per job.
134
+ 3. A machine that passed the health check takes the job. The coordinator moves that machine's deadline in its watchdog to cover the job's timeout plus a margin. While work keeps arriving the deadline keeps moving, and a warm machine runs job after job without being set up again. If the coordinator dies nobody moves it: the machine finishes what it has and ends at its deadline at the latest, or after `idle_timeout` with nothing running, whichever comes first.
135
+ 4. When the job ends, the coordinator fetches its outputs, stores them in the output store with a sha256 manifest, verifies them, and only then settles the job as `succeeded`. Nothing on the machine is deleted before that.
136
+
137
+ When a machine disappears, stops answering for `unresponsive_after`, or fails the health check right after a job, the job goes back to the queue and runs on another machine, up to `max_attempts`. A job that exits non-zero while the machine is healthy is the job's fault and is not retried automatically (`gpu queue retry` does it by hand). Every attempt's outcome is recorded: `succeeded`, `job_failed`, `timeout`, `machine_lost`, `unhealthy`, `unresponsive`, `preflight_rejected`, `cancelled`, `delivery_failed`, `drained`, `not_started`.
138
+
139
+ A retried attempt starts from scratch, but its `run` is prefixed with `export JAMBU_PREVIOUS_OUTPUT_DIR=...`: the verified outputs of the earlier attempt are there, so a job that writes checkpoints can resume. The job decides whether to use them. The same directory is described in [jobs.md](https://gpu4agents.jambu.ai/jobs.md).
140
+
141
+ Outputs that could not be stored (the store was down) stay under `<state_dir>/queue/work/` on the coordinator's host and are retried; the auditor reports any that are an hour old (I8). A store outage never retires machines: outputs the machine still holds are kept, not given up on.
142
+
143
+ ## Controls: pause, resume, drain
144
+
145
+ | Command | What it does |
146
+ | --- | --- |
147
+ | `gpu queue pause` | Stops new claims. Running jobs go on. Idle machines, `min_machines` included, time out by the normal idle rule, so a paused queue lets the pool fall to zero |
148
+ | `gpu queue resume` | Starts jobs again, and drops a drain that was requested |
149
+ | `gpu queue drain` | Pauses, and lets the machines idle out and stop |
150
+ | `gpu queue drain --now` | Also sends running jobs back to the queue and retires every machine at once, pulling outputs first. Those jobs are requeued, not failed, and a drained attempt does not count toward `max_attempts` |
151
+
152
+ `drain --now` through MCP needs `confirm=true` and the user's yes. Every control action is recorded in the audit trail with who did it, and a coordinator that holds the lease does the work itself; without one, the command does it directly.
153
+
154
+ ## Running the coordinator
155
+
156
+ ```bash
157
+ gpu queue run [--once] [--metrics-port PORT]
158
+ gpu queue install-service [--uninstall]
159
+ ```
160
+
161
+ `run` stops on Ctrl-C or SIGTERM; machines keep their deadlines. `--once` runs one tick and exits. `--metrics-port` serves `/metrics` on `127.0.0.1` only. `install-service` writes a user service (systemd on Linux, launchd on macOS) for this project and prints the command that enables it; it does not enable it. A systemd timer and a service do not inherit `devrun` or your shell: put credentials in `~/.gpu/credentials`.
162
+
163
+ The coordinator renews its lease from a heartbeat thread, so a long upload does not lose it. Leases use the backend's clock, never the caller's. The coordinator lease is 15 s at the default tick (3 ticks, never less); a job's lease is 60 s (12 ticks, never less).
164
+
165
+ A coordinator that takes over (after a crash or an expired lease) looks for every job its predecessor left in flight. A run its machine lists is adopted, never started twice. When the predecessor died after it recorded an attempt but before the machine got the job, the new coordinator asks that machine's job runner: if the runner has no record of the run, no upload in progress and no code waiting for a start, the run never started. Before the job goes back to the queue, the coordinator fences that remote id on the machine: the runner records it as refused and deletes any code it holds for it, so an upload or a start that the old coordinator still sends late gets a 409 and never runs (an old coordinator that sees the refusal drops the job). If the run did start in the meantime, the runner says so and the run is adopted instead. Once the fence is acknowledged, the job goes back to the queue at once with the outcome `not_started`. Like a drained attempt, it does not count toward `max_attempts`, and the next attempt gets a new remote id; a job whose runs fail to start more than twice `max_attempts` times fails with every reason listed. If the machine lists its jobs but the fence does not get through, nothing is requeued early: the job waits as long as an upload could take, as before. If code for the run is still arriving, the coordinator waits for it. While it waits it sends the machine a keepalive every tick, so the machine does not reach `idle_timeout` with that run still undecided.
166
+
167
+ After a takeover by a host whose pool is different (another computer, a new state directory), a job running on a machine the new coordinator cannot see waits until that attempt's deadline plus a grace before it runs again, because destroying or reaching the machine is the only way to be sure the first run is over.
168
+
169
+ `gpu sweep` and the sweep timer know about pool machines: with a dead coordinator, a stopped machine still ends in a destroy, with finished jobs' outputs saved first, and a pool machine is never treated as an orphan.
170
+
171
+ ## Observing it
172
+
173
+ Every decision is an event in `.gpu/logs/events.jsonl`; metrics are in `.gpu/queue/metrics.prom` and on `/metrics`; the auditor checks the guarantees. `gpu queue stats` shows the metrics as of the coordinator's last tick; `gpu queue audit [--repair]` runs the auditor (exit 1 while a violation remains).
174
+
175
+ | Concern | Events | Metrics | Invariant or alert |
176
+ | --- | --- | --- | --- |
177
+ | Coordinator | `coordinator_started`, `coordinator_lease_acquired`, `coordinator_lease_lost`, `coordinator_stopped` | `gpu_queue_coordinator_heartbeat_age_seconds`, `gpu_queue_lease_renew_failures_total` | I7 lease fresh |
178
+ | Machines | `pool_machine_requested`, `_ready`, `_unhealthy`, `_unresponsive`, `_gone`, `_retired` | `gpu_pool_machines{state}`, `gpu_pool_cold_start_seconds`, `gpu_pool_health_failures_total` | I4 no orphan machine |
179
+ | Deadlines | `pool_deadline_extended`, `instance_destroyed reason=deadline` | `gpu_pool_deadline_remaining_seconds{slot}` | remaining below 0 with a job running |
180
+ | Retries | `queue_job_retried`, `queue_job_dead` | `gpu_queue_attempts_total{outcome}`, `gpu_queue_retries_total{cause}` | retry rate |
181
+ | Ownership | `queue_job_claimed`, `queue_lease_expired`, `queue_stale_write_refused` | `gpu_queue_stale_writes_total` | I1 every running job is on a live machine; I2 no job on two machines |
182
+ | State | `queue_invariant_violated` | `gpu_queue_invariant_violations_total{code}` | any violation |
183
+ | Outputs | `queue_outputs_stored`, `queue_outputs_delivery_failed`, `queue_outputs_lost` | `gpu_queue_outputs_pending`, `gpu_queue_outputs_oldest_pending_seconds`, `gpu_queue_outputs_bytes_total` | I3 manifests verify; I8 outputs stored |
184
+ | Latency | `queue_job_submitted`, `queue_job_started`, `queue_job_succeeded`, `queue_job_failed` | `gpu_queue_depth`, `gpu_queue_oldest_queued_seconds`, `gpu_queue_job_wait_seconds`, `gpu_queue_job_run_seconds` | I6 no job past its deadline plus grace |
185
+ | Money | `pool_scale_decision`, `pool_cap_blocked`, `queue_preflight_rejected` | `gpu_pool_usd_per_hour`, `gpu_pool_spend_usd_total`, `gpu_queue_job_cost_usd` | I5 spend within `max_usd_per_hour` |
186
+ | Who and what | `queue_job_submitted` (submitted_by), `queue_control` (action, actor) | `gpu_queue_jobs_total{final_state}` | the audit trail is append-only |
187
+ | Control | `queue_control` | `gpu_queue_paused` | pause honored within one tick |
188
+
189
+ The invariants: I1 running job without a machine, I2 duplicate execution, I3 outputs unverified, I4 orphan machine, I5 spend over the cap, I6 job past its deadline, I7 stale coordinator, I8 outputs not stored.
190
+
191
+ ## Alerts
192
+
193
+ Page someone when any of these holds:
194
+
195
+ - the coordinator heartbeat age is more than 3 ticks;
196
+ - any invariant violation (`gpu_queue_invariant_violations_total` rises, or `gpu queue audit` exits 1);
197
+ - the oldest pending output delivery is older than 10 minutes;
198
+ - the retry rate is above 20% over 1 hour (`gpu_queue_retries_total` leaves out attempts sent back by `drain --now` and runs that never started, which are not failures);
199
+ - the pool's spend is at or above 90% of `max_usd_per_hour`;
200
+ - the oldest queued job is older than 2 × `scale_up_after` plus the cold start p50 while `blocked_by` is set (the last `pool_scale_decision` says which cap: `max_machines`, `max_usd_per_hour`, `no_offer` or `backoff`).
201
+
202
+ ## What can go wrong
203
+
204
+ | Symptom | What it means |
205
+ | --- | --- |
206
+ | Jobs stay queued and `blocked_by` is `no_offer` or `backoff` | The provider has no matching capacity. Jobs wait, they do not fail, and the opening of machines backs off up to 5 minutes |
207
+ | A job is `delivering` for a long time | The output store is unreachable or the manifest does not verify. Nothing is marked delivered; it retries. The machine's outputs are held |
208
+ | The queue looks empty after a `gpu.yaml` edit | The Redis keyspace followed the config fingerprint. Set `queue.namespace` |
209
+ | `gpu queue status` says no coordinator holds the lease | Start `gpu queue run` (or enable the service). Machines already running end by their deadlines |
210
+ | Exit 4 from a `gpu queue` command | The queue or its output store is unreachable; the message names it, without the password |
211
+
212
+ ## Limits of this version
213
+
214
+ - Redis must be 5 or newer and a single node. Redis Cluster is not supported (its atomic steps are Lua scripts over several keys).
215
+ - One pool per project: one `gpu.yaml`, one provider, one kind of card. No priorities, schedules or job dependencies.
216
+ - It is for batch work, not for autoscaling a live model endpoint.
217
+ - There is no Jambu server. The queue and the store are ones you run or rent.
@@ -108,6 +108,10 @@ Write this as a GPU for Agents job and run it. Fetch https://gpu4agents.jambu.ai
108
108
 
109
109
  [JOBS.md](JOBS.md) has the contract: the directory, `gpujob.yaml`, the environment a job gets, and the rules its code follows.
110
110
 
111
+ ## Queue mode
112
+
113
+ For an application that sends jobs over the day, `gpu queue submit` puts a job directory in a queue and a coordinator (`gpu queue run`) opens and closes machines for it, retries a job on another machine when one dies, and keeps its verified outputs, within the machine and hourly-spend caps you set. It works with any provider, and the queue can be a local file or Redis. See [QUEUE.md](QUEUE.md).
114
+
111
115
  ## Serve any model
112
116
 
113
117
  Give `gpu` a Hugging Face model id and it serves it behind the OpenAI API shapes, whatever the model does. It reads the model card: chat and vision-language models run on vLLM; image, voice, transcription, embedding and other pipeline models run on gpu's own server. Any OpenAI client then works unchanged.
@@ -177,6 +181,7 @@ A full example is [`gpu.example.yaml`](gpu.example.yaml). `gpu ls` shows every m
177
181
  - [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
178
182
  - [Integrating into an application (any language)](docs/INTEGRATION.md)
179
183
  - [Running your own code as a job](JOBS.md)
184
+ - [Queue mode: jobs on a pool of GPUs](QUEUE.md)
180
185
  - [Commands, workloads, and agents](docs/USAGE.md)
181
186
  - [Every config field](docs/CONFIG.md)
182
187
  - [Choosing a model](docs/CHOOSING_A_MODEL.md)
@@ -1,6 +1,6 @@
1
1
  # Acceptance criteria: where each one is implemented and tested
2
2
 
3
- Eighteen guarantees, mapped to the code and the test that holds each one.
3
+ Thirty-one guarantees, mapped to the code and the test that holds each one.
4
4
 
5
5
  | # | Guarantee | Implementation | Test |
6
6
  | --- | --- | --- | --- |
@@ -22,6 +22,19 @@ Eighteen guarantees, mapped to the code and the test that holds each one.
22
22
  | 16 | Orphans are found account-wide, each project keeps its own rules, and nothing else is touched | `GPUProvider.list_instances` (capability `list_instances`) returns only `jambu-` labels; `gpu setup` registers the project in `~/.gpu/projects.json`; `core/sweep.py::guard_projects` runs each registered project's own `Engine.guard_tick`; only untracked instances are orphans: running past `--orphan-max-age` is stopped (never destroyed), stopped past `--stopped-ttl` (from the sweep's own first sighting in `~/.gpu/sweep.json`) is destroyed; `gpu sweep --install-timer` schedules one working-directory-independent unit and refuses a key that is only in the shell | `test_sweep.py::test_vast_lists_only_jambu_labelled_instances`, `::test_non_jambu_instances_are_never_touched`, `::test_another_projects_restarted_and_locked_instance_is_not_destroyed`, `::test_each_project_is_judged_by_its_own_max_lifetime`, `::test_a_running_orphan_past_orphan_max_age_is_stopped_never_destroyed`, `::test_a_stopped_orphan_is_destroyed_once_seen_stopped_past_stopped_ttl`, `::test_install_timer_writes_one_unit_independent_of_the_project`, `::test_install_timer_refuses_a_key_only_in_the_shell_environment` |
23
23
  | 17 | The CLI guard never stops a serving endpoint it cannot see | `Engine._idle_blind`: with the watchdog enabled and installed but unreachable, `guard_tick` evaluates without `idle_timeout` and records `idle_skipped`; `max_lifetime`, budget and `stopped_ttl` still apply | `test_engine_sessions.py::test_guard_leaves_idle_to_an_unreachable_watchdog`, `::test_max_lifetime_still_applies_when_the_watchdog_is_unreachable` |
24
24
  | 18 | A fresh stop or a short API outage never costs the disk | `RuntimeState.mark_stopped` restarts `stopped_since` on evidence the instance ran since; the watchdog escalates a failing stop to destroy only after `escalate_after_s` (30m) of continuous failure and resets on renewed use | `test_engine_sessions.py::test_a_stale_stopped_since_does_not_destroy_a_fresh_stop`, `test_watchdog.py::test_an_api_blip_does_not_destroy_the_disk`, `::test_failures_reset_when_the_instance_is_back_in_use` |
25
+ | 19 | A manual stop that keeps billing is never silent, and something removes it | `Engine.stop` returns `still_billing`, `stopped_cost_usd_per_day` (Vast: `storage_cost` x disk) and a `warning` naming the bill and whether the sweep timer will remove it; every `gpu` command warns on stderr about a registered machine stopped and billing (`core/sweep.py::stopped_and_billing`, state files only); `gpu agent install` asks once to install the sweep timer, the only thing that enforces `stopped_ttl` on a stopped machine | `test_field_run.py::test_stop_where_a_stopped_machine_bills_says_so_and_names_the_bill`, `::test_every_command_warns_about_a_stopped_machine_still_billing`, `::test_acceptance_manual_stop_then_only_the_timer_runs`, `::test_agent_install_asks_once_for_the_sweep_timer` |
26
+ | 20 | A project is never kept where it will be lost, and a lost project's machine can be taken over | `gpu init` refuses a temporary or scratchpad folder (`core/paths.py::ephemeral_reason`, `--allow-temp` overrides); `gpu adopt` (`Engine.adopt`) takes over an orphan, recovering its watchdog token and model key from the boot script the provider kept (`GPUProvider.boot_script`, `watchdog/builder.py::recover_boot_secrets`, which never returns the provider key) | `test_field_run.py::test_init_refuses_a_temp_or_scratchpad_directory`, `::test_adopt_takes_over_an_orphan_with_its_watchdog_and_key`, `::test_adopt_refuses_another_projects_machine_or_a_foreign_one`, `::test_boot_script_recovery_reads_the_token_and_key_but_never_the_provider_key` |
27
+ | 21 | The card the user approved is the card rented, at no more than the price quoted | `gpu offers` remembers its offers in `.gpu/offers.json`; `gpu setup --offer ID` pins the card's name and caps the price at the quote, host retries included, and rents nothing if it is gone; every setup reports `rented`, `quoted` and `matches_quote` | `test_field_run.py::test_a_pinned_setup_never_falls_back_to_another_card`, `::test_a_pinned_setup_never_pays_more_than_the_quote`, `::test_a_pinned_host_retry_stays_on_the_quoted_card`, `::test_an_unpinned_setup_says_when_it_rented_something_else` |
28
+ | 22 | A machine that vanished leaves a reason | `Engine._why_missing` replays this project's rules on what was last known; when they called for a destroy, the reconcile records `instance_destroyed reason=<rule> by=watchdog inferred=true`, else `likely_reason: unknown`; setup brings the watchdog's own events home as soon as the machine is ready | `test_field_run.py::test_a_machine_gone_after_its_idle_timeout_is_recorded_as_the_watchdogs_doing`, `::test_a_machine_gone_while_in_use_is_not_blamed_on_the_watchdog`, `::test_setup_brings_the_watchdogs_own_events_home` |
29
+ | 23 | The GPU is sized for the peak and offers can be compared per job | `model_inspect.known_vram_floor` (SDXL 16/24 GB, FLUX 24/32 GB) raises `gpu init`'s default and makes `validate` warn; `gpu offers --for <minutes on an RTX 4090>` ranks by estimated job cost (`providers/gpus.py::relative_speed`) | `test_field_run.py::test_validate_warns_when_the_card_is_sized_for_the_weights_not_the_peak`, `::test_init_sizes_a_known_image_model_for_its_peak`, `::test_offers_for_a_job_rank_by_the_cost_of_the_whole_job` |
30
+ | 24 | Queue mode never leaves a GPU billing idle: the watchdog's idle rule is unchanged, a paused queue lets idle machines (`min_machines` too) time out, and a dead coordinator still ends in a destroy | `core/policy.py` (idle rule untouched, queued work counts as activity); `queue/pool.py` retires through the same engine; `core/sweep.py::guard_projects` guards pool slots and pulls finished jobs' outputs before a destroy | `test_policy.py::test_queued_workload_counts_as_activity`, `test_sweep.py::test_sweep_guards_pool_slots_of_a_registered_project`, `::test_sweep_pulls_a_pool_job_s_outputs_before_destroying`, `::test_stopped_billing_warning_counts_pool_machines`, `test_queue_coordinator.py::test_pause_stops_claims_but_not_running_jobs`, `::test_a_paused_queue_passes_no_min_machines_to_the_scaler` |
31
+ | 25 | A coordinator crash leaves no machine running: each machine has a hard deadline in its own watchdog that only the coordinator moves | `policy.REASON_DEADLINE`, `watchdog/agent_body.py` `/deadline`, `Pool.extend_deadline`; a restarted pool resets its deadlines | `test_policy.py::test_deadline_ends_a_machine_even_with_work_running`, `::test_a_lock_does_not_override_the_deadline`, `test_watchdog.py::test_deadline_route_refuses_moving_backwards`, `test_queue_pool.py::test_extend_deadline_reaches_the_watchdog`, `::test_a_restarted_pool_reloads_its_machines_and_resets_their_deadline`, `test_queue_coordinator.py::test_the_deadline_moves_with_each_job` |
32
+ | 26 | A warm, healthy machine is not replaced to reset a counter: jobs run back to back, the deadline moves with the work, and only `max_machine_lifetime` (off by default) caps age | `queue/coordinator.py` dispatch and deadline extension; `queue/scaler.py` | `test_queue_coordinator.py::test_jobs_run_back_to_back_on_one_warm_machine`, `::test_the_deadline_moves_with_each_job`, `test_engine.py::test_queue_mode_policy_drops_lifetime_and_session_budget` (a pool machine's only age cap is `max_machine_lifetime`; the project's `max_lifetime` and session budget do not apply), `test_config.py::test_queue_defaults_match_the_spec` (off by default) |
33
+ | 27 | No job is lost silently: every job ends `succeeded`, `failed` (with every attempt's reason) or `cancelled`, a lost machine requeues its job, and a run that never started goes back at once without using an attempt (up to twice `max_attempts` times) | `queue/coordinator.py` outcomes, `max_attempts`, recover (`start_pending`); `watchdog/jobs_ext.py` uploads in `GET /jobs`; `queue/audit.py` I1, I6, I7 | `test_queue_coordinator.py::test_a_lost_machine_requeues_the_job_on_another`, `::test_max_attempts_ends_in_failed_with_every_reason`, `::test_a_job_lost_with_its_coordinator_and_machine_is_requeued`, `::test_a_run_that_never_reached_its_machine_goes_back_at_once_without_using_an_attempt`, `::test_a_job_whose_runs_keep_not_starting_gives_up`, `test_jobs.py::test_the_job_list_says_which_uploads_never_started`, `test_queue_audit.py::test_i1_a_running_job_whose_machine_is_gone_is_requeued_machine_lost`, `::test_i6_a_job_running_past_its_deadline_is_cancelled_and_requeued_timeout` |
34
+ | 28 | A job never runs on two machines at once: claims are leases with fencing tokens, an already-started remote run is adopted, a run that never started is fenced on its machine (refused: a late upload or start gets a 409) before it is requeued, a dispatch checks it still holds the job between the upload and the start, and the auditor cancels a duplicate | `queue/backend.py` claim, renew and settle with a token; `queue/coordinator.py` adoption and `_fence`; `watchdog/jobs_ext.py` `POST /jobs/<id>/refuse`; `queue/audit.py` I2 | `test_queue_coordinator.py::test_crash_after_dispatch_adopts_the_running_job_instead_of_starting_it_twice`, `::test_a_stale_lease_write_is_dropped_not_retried`, `::test_a_dispatch_that_outlives_its_lease_cancels_its_run`, `::test_an_upload_that_outlives_its_lease_never_starts_the_run`, `::test_an_upload_still_arriving_is_waited_for_with_its_machine_kept_awake`, `::test_a_late_start_from_the_coordinator_that_lost_the_job_is_refused_and_never_runs`, `::test_a_fence_that_does_not_get_through_falls_back_to_the_timing_rules`, `::test_a_refused_record_is_never_adopted`, `test_jobs.py::test_a_refused_job_never_runs_and_a_started_one_is_returned`, `test_queue_pool.py::test_a_fenced_run_is_refused_on_dispatch_and_hidden_from_the_listing`, `test_queue_audit.py::test_i2_a_remote_run_the_queue_does_not_place_there_is_cancelled`, `test_queue_pool.py::test_dispatch_twice_returns_already_running` |
35
+ | 29 | Outputs are never deleted before they are verified and stored: a success is settled only after the sha256 manifest verifies, a failed store keeps the files, and a machine is not retired for a store outage | `queue/outputs.py` manifest and `verify`; `queue/coordinator.py` delivery and `queue/work/`; `queue/audit.py` I3, I8 | `test_queue_outputs.py::test_a_truncated_upload_fails_verification`, `test_queue_coordinator.py::test_delivery_failure_keeps_the_job_delivering_and_retries`, `::test_a_store_that_does_not_verify_keeps_the_job_delivering`, `::test_fetched_outputs_survive_a_crash_and_are_delivered`, `::test_a_store_outage_does_not_blame_the_machine`, `test_queue_audit.py::test_i8_fetched_outputs_not_stored_for_an_hour` |
36
+ | 30 | Spend stays within the caps the user set, even catching up on a long queue: the scaler counts everything the pool bills, `max_usd_per_hour` blocks opening, a job's cost limit is checked at preflight | `queue/scaler.py`, `queue/spend.py`, `queue/preflight.py`; `queue/audit.py` I5 | `test_queue_scaler.py::test_stops_at_the_spend_cap`, `::test_stops_at_max_machines`, `test_queue_spend.py::test_stopped_machines_count_their_disk`, `::test_held_machines_count_full_rate`, `test_queue_preflight.py::test_rejects_a_cost_limit_its_timeout_cannot_meet`, `test_queue_audit.py::test_i5_spend_over_the_cap_is_an_alert` |
37
+ | 31 | The queue contract is neither too narrow nor too loose: both built-in backends pass one conformance suite, and so does any third-party backend | `queue/testing.py::QueueBackendContract`; [QUEUE_BACKENDS.md](QUEUE_BACKENDS.md) | `test_queue_backend_local.py::TestLocalBackend` and `test_queue_backend_redis.py::TestRedisBackend` (both subclass the suite), `test_queue_backend_redis.py::test_lease_expiry_uses_the_server_clock` |
25
38
 
26
39
  ## Validated on real hardware
27
40
 
@@ -75,6 +88,24 @@ The first attempt found problems the unit tests had missed. Each is fixed and te
75
88
  - the host that failed last when setup gave up was not remembered as bad, so the next setup rented it again;
76
89
  - on Vast, three hosts in a row stalled 30 minutes each pulling the 12 GB Docker Hub image, and setup gave up after 90 minutes with nothing left billing. Vast now defaults to `vastai/vllm:v0.32.0-cuda-13.0`, the same vLLM that Vast's hosts cache: in the cancel test the container was running within a minute.
77
90
 
91
+ ## A real session, filmed (0.12.0, 2026-11-11)
92
+
93
+ A Claude Code session used GPU for Agents 0.12.0 end to end to make images for the home page with SDXL and to run a CUDA benchmark, filmed for the home page video. It was real use, not a test, and it found the problems fixed in 0.13.0 (guarantees 19 to 23). These held, and must keep holding:
94
+
95
+ | What held | Evidence |
96
+ | --- | --- |
97
+ | The agent asked before renting, with the model, the card, its price per hour, the $1/h cap and the $5 session cap | the transcript (`video/public/footage/with.screens.txt`) |
98
+ | It reused the running machine for a second task (the benchmark) instead of renting another | take 2's events: `job_submitted` on the same instance after the image workloads |
99
+ | It reported the cost (about $0.06) and what was still billing | the transcript |
100
+ | It recovered by itself from an out-of-memory error and from missing NVRTC headers | the transcript; `workload_finished` failed then finished in take 2's events |
101
+ | After the session was killed, take 1's machine was gone within about 30 minutes | take 1 was idle from 00:32:56; with `idle_timeout` 15m and a Vast.ai stop that bills, the watchdog destroys. Its local log said only "instance missing at provider", because the watchdog's events had not been fetched before the machine went. 0.13.0 records the inferred reason (guarantee 22) and fetches the watchdog's events at setup |
102
+
103
+ What it got wrong, and the fix:
104
+ - the agent ended with `gpu stop`, which on Vast.ai keeps billing the disk, and nothing would ever destroy it: no sweep timer was installed (19);
105
+ - the project lived in the agent's session scratchpad, so a later session saw the machine as an orphan it could not use (20);
106
+ - `min_vram_gb: 9` for SDXL: the 12 GB card ran out of memory decoding 1344x768, and the idle server held 11 GB the benchmark needed (23);
107
+ - the approval quoted an RTX 3060 at about $0.08/h; an RTX 2060 at $0.094/h was rented, and the agent noticed only in its final report (21).
108
+
78
109
  ## The MVP command surface
79
110
 
80
111
  `gpu.yaml` schema, CLI, provider contract, provider registry, Vast.ai adapter,
@@ -82,6 +113,8 @@ vLLM runtime, `setup`, `run`, `status`, `stop`, `destroy`, `lock`/`unlock`, idle
82
113
  timeout, max lifetime, remote watchdog and structured logs are all present. On top
83
114
  of that, `ls` and `sweep` handle orphan control across the account.
84
115
 
85
- Deliberately not implemented: multi-instance scheduling, multi-GPU
86
- orchestration, Kubernetes, distributed inference, provider optimization, automatic
87
- provider selection, job queues, web dashboard.
116
+ Added since the MVP: job queues and a machine pool (queue mode, 0.14.0, guarantees 24 to 31).
117
+
118
+ Deliberately not implemented: multi-GPU orchestration, Kubernetes, distributed
119
+ inference, provider optimization, automatic provider selection, web dashboard, sharing
120
+ one pool between projects, job priorities, schedules and dependencies.
@@ -77,16 +77,17 @@ Another agent that reads `SKILL.md` files: `gpu agent skill > path/to/skills/gpu
77
77
  | --- | --- | --- |
78
78
  | `gpu_init` | write `gpu.yaml` for a model, with an optional price cap and VRAM | no |
79
79
  | `gpu_validate` | check the config and credentials | no |
80
- | `gpu_offers` | cheapest matching machines and their price | no |
81
- | `gpu_setup` | rent / restart and wait for the model; returns `base_url`, `api_key`, `model` | yes |
80
+ | `gpu_offers` | cheapest matching machines and their price; with `for_minutes_on_4090`, ranked by the estimated cost of the whole job | no |
81
+ | `gpu_setup` | rent / restart and wait for the model; returns `base_url`, `api_key`, `model`, and `rented` next to `quoted`. With `offer_id` only the approved card, at no more than its quoted price, is rented | yes |
82
82
  | `gpu_status` | state, cost so far, idle time, the watchdog's next move, setup progress | no |
83
83
  | `gpu_connection` | `base_url`, `api_key`, `model` without starting anything | no |
84
84
  | `gpu_run` | run a local command with `OPENAI_BASE_URL` / `OPENAI_API_KEY` / `JAMBU_MODEL_ID` set | yes, if it has to start the machine |
85
85
  | `gpu_logs` | runtime, onstart, watchdog or provider log | no |
86
86
  | `gpu_lock` / `gpu_unlock` | keep the machine up through a quiet period | while locked |
87
- | `gpu_stop` | stop now; disk kept, restart takes about a minute | ends billing for compute |
88
- | `gpu_destroy` | delete; needs `confirm=true`; downloads job results first, `discard_outputs=true` deletes them | ends all billing |
87
+ | `gpu_stop` | stop now; disk kept, restart takes about a minute. On Vast.ai the disk keeps billing; the result says how much | ends billing for compute |
88
+ | `gpu_destroy` | delete; needs `confirm=true`; downloads job results first, `discard_outputs=true` deletes them. The default cleanup once the work is done | ends all billing |
89
89
  | `gpu_ls` | every machine in the account, from any project | no |
90
+ | `gpu_adopt` | make an orphan (a machine whose project folder was lost) belong to this project, to reuse or destroy it | no |
90
91
 
91
92
  Each tool runs the `gpu` CLI with `--json` in the project directory, so errors carry the same `exit_code` as the [application contract](INTEGRATION.md#exit-codes), plus `meaning` and `next` for the agent. A tool takes an optional `project_dir`; by default it is the server's `--project`, `$GPU_PROJECT_DIR`, or the directory the client started it in.
92
93
 
@@ -94,7 +95,7 @@ Each tool runs the `gpu` CLI with `--json` in the project directory, so errors c
94
95
 
95
96
  ## What keeps the agent in line
96
97
 
97
- - The skill tells the agent to show the price and ask before renting, wait out a slow setup instead of starting over, never touch the provider key, and offer stop or destroy (and check `gpu_ls`) when done.
98
+ - The skill tells the agent to keep the project in the user's repository, size the card for the peak, show one offer's card and price and ask before renting, rent that offer only (`offer_id`) and report any change, wait out a slow setup instead of starting over, never touch the provider key or go looking for keys, and destroy once the work is done and its results are home (and check `gpu_ls`).
98
99
  - The server's tool annotations mark `gpu_destroy` destructive and the read-only tools read-only, so a client can let `gpu_status` run freely and ask for every `gpu_setup` and `gpu_destroy`. In Claude Code that is the `permissions` list in `.claude/settings.json`, e.g. `"allow": ["mcp__gpu__gpu_status", "mcp__gpu__gpu_offers", "mcp__gpu__gpu_ls"]`.
99
100
  - `gpu.yaml` holds the hard limits the agent cannot exceed without editing the file: `budget.max_hourly_cost_usd`, `budget.max_session_cost_usd`, `lifecycle.max_lifetime`.
100
101
  - The watchdog stops the machine after `idle_timeout` whatever the agent does, and `gpu sweep --install-timer` catches anything left behind.
@@ -113,9 +113,9 @@ which source each number comes from.
113
113
 
114
114
  | Field | Default | Meaning |
115
115
  | --- | --- | --- |
116
- | `gpu.min_vram_gb` | `24` | Minimum VRAM per GPU. |
116
+ | `gpu.min_vram_gb` | `24` | Minimum VRAM per GPU. Size for the peak, not the weights. `gpu init` raises it for image models whose peak the weights hide (SDXL 16, FLUX 24), and `validate` warns below that. |
117
117
  | `gpu.count` | `1` | Number of GPUs on one machine. |
118
- | `gpu.name_filter` | – | Substring match, e.g. `A100`, `RTX 4090`. |
118
+ | `gpu.name_filter` | – | Substring match, e.g. `A100`, `RTX 4090`. `gpu setup --offer ID` pins the approved offer's card the same way for one setup, and caps the price at its quote. |
119
119
  | `gpu.cuda_min` | – | Minimum host CUDA version. `gpu` raises it to what the runtime image needs, read from its tag (`-cu129` means 12.9, vLLM's bare `v0.32+` and `latest` mean 13.0), so an image never lands on a driver too old to run it. |
120
120
  | `gpu.compute_cap_min` | – | Minimum GPU compute capability (architecture), e.g. `8.0` for Ampere. Distinct from `cuda_min`: a Pascal (GTX 10xx, 6.1) or Volta (V100, 7.0) card can sit behind a modern CUDA-13 driver, and so clear `cuda_min`, yet still be too old for a runtime image whose kernels are built for newer architectures. The image then crashes at engine startup. `gpu` raises this to what the runtime needs: a CUDA-13 vLLM image floors it at `8.0` (those wheels drop Volta), a CUDA-12 vLLM image at `7.0`. The cheapest Vast offers are often these old cards, so without the floor the search keeps picking a GPU the image cannot run. |
121
121
  | `disk_gb` | `80` | Disk. Must fit the model weights plus the container. |
@@ -191,7 +191,7 @@ The cost protection. See [the safety invariant](#safety-invariant).
191
191
  | --- | --- | --- |
192
192
  | `max_lifetime` | `6h` | Hard ceiling on instance age. `null` = unbounded. |
193
193
  | `idle_timeout` | `15m` | Shut down after this long with no activity. `null` = unbounded. |
194
- | `stopped_ttl` | `24h` | Destroy an instance that has been `STOPPED` this long. A stopped Vast instance no longer bills GPU time but still bills storage. `null` keeps stopped instances forever. |
194
+ | `stopped_ttl` | `24h` | Destroy an instance that has been `STOPPED` this long. A stopped Vast instance no longer bills GPU time but still bills storage. `null` keeps stopped instances forever. Enforced only from your computer (`gpu sweep --install-timer`, which `gpu agent install` offers); `gpu stop` says whether that is set up. |
195
195
  | `auto_stop` | `true` | The guard may stop the instance. |
196
196
  | `auto_destroy` | `false` | The guard destroys instead of stopping. |
197
197
  | `keep_disk` | `false` | Where a stopped instance still bills storage (Vast.ai, a RunPod pod with a volume), the guard destroys the instance instead of stopping it, because nothing on a stopped machine can remove it later. `true` stops it, keeping the disk for a restart in about a minute, and leaves the removal to `stopped_ttl`, which only `gpu guard` or `gpu sweep` on your computer enforce (`gpu sweep --install-timer`). |
@@ -255,6 +255,35 @@ Override once with `gpu setup --allow-cost-override`.
255
255
  | `env` | `{}` | Extra environment variables for the workload. |
256
256
  | `workdir` | project dir | Working directory for the command. |
257
257
 
258
+ ## `queue`
259
+
260
+ Present means queue mode: a coordinator runs jobs on a pool of machines rented from this same file. Absent, the project behaves exactly as before. The full guide is [QUEUE.md](../QUEUE.md). Nothing here holds an address or a key: `GPU_QUEUE_URL`, `GPU_OUTPUTS_URL` and the `AWS_*` variables come from the environment or `~/.gpu/credentials`, and a URL in this section is a config error.
261
+
262
+ | Field | Default | Meaning |
263
+ | --- | --- | --- |
264
+ | `backend` | `local` | `local` (SQLite in the project), `redis` (Redis 5 or newer, one node, not Cluster) or `module:factory` ([QUEUE_BACKENDS.md](QUEUE_BACKENDS.md)). |
265
+ | `outputs` | `local` | Where bundles and results live: `local` (`gpu-outputs/`), `s3` or `module:factory`. |
266
+ | `namespace` | none | Keyspace name on a shared backend (`[A-Za-z0-9_.-]`, up to 64). Set it for Redis: without it the keyspace follows the config fingerprint and changes when the runtime part of the file changes. `GPU_QUEUE_NAMESPACE` is the fallback. |
267
+ | `min_machines` | `0` | Machines kept on with an empty queue. They still time out by `idle_timeout` while the queue is paused. |
268
+ | `max_machines` | `1` | The most machines at once. Not below `min_machines`. |
269
+ | `max_usd_per_hour` | none | Cap on the whole pool's bill per hour (running machines, stopped ones that still bill their disk, machines held for outputs). It blocks opening machines; it never stops one with a job on it. |
270
+ | `scale_up_after` | `30s` | Open a machine when the oldest queued job has waited this long. |
271
+ | `jobs_per_machine` | `1` | Jobs one machine runs at once. |
272
+ | `max_attempts` | `3` | Runs per job before it is failed with every attempt's reason. Drained attempts do not count. |
273
+ | `unresponsive_after` | `5m` | How long a silent machine is waited for before it is destroyed and its jobs requeued. |
274
+ | `max_machine_lifetime` | none | Optional hard ceiling on a machine's age. Off: a warm machine is never replaced for being old. |
275
+ | `tick` | `5s` | The coordinator's loop period. Leases are 3 ticks (at least 15 s) for the coordinator and 12 ticks (at least 60 s) for a job. |
276
+ | `preflight` | built in | `module:function` that returns a `PreflightResult` with the job's limits, or a reason to refuse. |
277
+ | `health_check.command` | built in | Replaces the built-in check (GPU visible, a small CUDA operation). It must not write job outputs: they would count as activity and hold the idle shutdown. |
278
+ | `health_check.min_free_vram_gb` | none | Free memory threshold. Off by default: a machine serving a model holds most of it. |
279
+ | `health_check.timeout` | `2m` | Time allowed for one check. |
280
+ | `health_check.between_jobs` | `true` | Check again between jobs. |
281
+ | `defaults.timeout` | `1h` | A job's timeout when its `gpujob.yaml` has none. |
282
+ | `defaults.max_cost_usd` | none | A job's cost limit when it has none. |
283
+ | `defaults.deadline_margin` | `10m` | Added to a job's timeout when the machine's deadline is moved. |
284
+
285
+ A job's `gpujob.yaml` gains two optional fields: `max_cost_usd` and `min_vram_gb`.
286
+
258
287
  ## Safety invariant
259
288
 
260
289
  An instance may remain billable only while useful work is running, useful work is
@@ -103,7 +103,7 @@ gpu env --format dotenv > .env.gpu
103
103
  | 1 | unexpected error | log stderr, retry later |
104
104
  | 2 | config error (`gpu.yaml` invalid, or changed since setup) | fix the config; `setup --recreate` replaces a machine built from the old one |
105
105
  | 3 | no instance / no endpoint (from `env`, `endpoint`) | call `setup` |
106
- | 4 | provider API error | retry with backoff |
106
+ | 4 | provider API error, or the queue or its output store is unreachable (queue commands) | retry with backoff |
107
107
  | 5 | provider authentication failed | fix `VAST_API_KEY` |
108
108
  | 6 | no capacity matches the config | retry later, or relax `compute.gpu` / the budget |
109
109
  | 7 | provisioning failed | retry; the failed machine was already destroyed |
@@ -202,6 +202,21 @@ def ask(prompt):
202
202
  conn = ensure_gpu() # stopped while idle: restart it, then retry
203
203
  ```
204
204
 
205
+ ### Python: queue mode
206
+
207
+ For jobs that arrive over the day, not one machine per conversation, `gpu4agents.queue.api` submits to the queue and follows a job without shelling out. It needs `queue:` in `gpu.yaml`; a coordinator (`gpu queue run`, a service you run) does the renting. See [QUEUE.md](../QUEUE.md).
208
+
209
+ ```python
210
+ from gpu4agents.queue import api
211
+
212
+ job_id = api.submit("train/", key="order-1234") # idempotent on the key
213
+ info = api.wait(job_id, timeout_s=3600) # a dict; "timed_out": true if still running
214
+ if info["state"] == "succeeded":
215
+ path = api.outputs(job_id) # verified outputs, gpu-outputs/<job>/
216
+ ```
217
+
218
+ `api.status`, `listing`, `cancel`, `retry`, `pause`, `resume`, `drain`, `audit_queue`, `stats` and `summary` match the `gpu queue` commands. Credentials (`GPU_QUEUE_URL`, `GPU_OUTPUTS_URL`, `AWS_*`) come from the environment or `~/.gpu/credentials`. An unreachable queue or store raises; handle it like exit code 4.
219
+
205
220
  ### Shell / curl
206
221
 
207
222
  ```bash