gpu4agents 0.6.0__tar.gz → 0.8.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 (136) hide show
  1. gpu4agents-0.8.0/.claude-plugin/marketplace.json +18 -0
  2. gpu4agents-0.8.0/.claude-plugin/plugin.json +14 -0
  3. gpu4agents-0.8.0/.cursor-plugin/plugin.json +12 -0
  4. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/CHANGELOG.md +35 -0
  5. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/CONTRIBUTING.md +1 -1
  6. gpu4agents-0.8.0/INSTALL.md +56 -0
  7. gpu4agents-0.8.0/JOBS.md +82 -0
  8. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/PKG-INFO +91 -21
  9. gpu4agents-0.8.0/PROVIDERS.md +85 -0
  10. gpu4agents-0.8.0/README.md +199 -0
  11. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/ACCEPTANCE.md +5 -5
  12. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/ADDING_A_PROVIDER.md +52 -13
  13. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/AGENTS.md +24 -12
  14. gpu4agents-0.8.0/docs/CHOOSING_A_MODEL.md +193 -0
  15. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/CONFIG.md +47 -68
  16. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/INTEGRATION.md +10 -10
  17. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/LIFECYCLE.md +4 -4
  18. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/USAGE.md +6 -6
  19. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/__init__.py +1 -1
  20. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/agent/install.py +1 -1
  21. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/agent/mcp.py +107 -4
  22. gpu4agents-0.8.0/gpu4agents/agent/skill/SKILL.md +147 -0
  23. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/account.py +83 -52
  24. gpu4agents-0.8.0/gpu4agents/cli/job.py +295 -0
  25. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/main.py +3 -2
  26. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/providers.py +76 -3
  27. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/setup.py +44 -3
  28. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/config.py +53 -2
  29. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/engine.py +227 -2
  30. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/events.py +4 -0
  31. gpu4agents-0.8.0/gpu4agents/core/job.py +378 -0
  32. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/base.py +14 -0
  33. gpu4agents-0.8.0/gpu4agents/providers/registry.py +146 -0
  34. gpu4agents-0.8.0/gpu4agents/providers/scaffold.py +258 -0
  35. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/config.py +1 -0
  36. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/provider.py +18 -2
  37. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/runtime/base.py +15 -2
  38. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/watchdog/agent_body.py +81 -0
  39. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/watchdog/builder.py +13 -9
  40. gpu4agents-0.8.0/gpu4agents/watchdog/jobs_ext.py +470 -0
  41. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/install.sh +9 -8
  42. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/pyproject.toml +1 -1
  43. gpu4agents-0.8.0/skills/gpu4agents/SKILL.md +147 -0
  44. gpu4agents-0.8.0/skills/gpu4agents/agents/openai.yaml +4 -0
  45. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_agent.py +29 -2
  46. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_cli.py +171 -10
  47. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_engine.py +4 -4
  48. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_integration.py +71 -0
  49. gpu4agents-0.8.0/tests/test_jobs.py +335 -0
  50. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_runtime_vllm.py +1 -1
  51. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_watchdog.py +1 -1
  52. gpu4agents-0.6.0/INSTALL.md +0 -53
  53. gpu4agents-0.6.0/README.md +0 -129
  54. gpu4agents-0.6.0/docs/CHOOSING_A_MODEL.md +0 -198
  55. gpu4agents-0.6.0/gpu4agents/agent/skill/SKILL.md +0 -117
  56. gpu4agents-0.6.0/gpu4agents/providers/registry.py +0 -63
  57. gpu4agents-0.6.0/skills/gpu4agents/SKILL.md +0 -117
  58. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.env.example +0 -0
  59. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  60. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  61. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  62. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/dependabot.yml +0 -0
  63. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/pull_request_template.md +0 -0
  64. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/workflows/ci.yml +0 -0
  65. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.github/workflows/release.yml +0 -0
  66. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/.gitignore +0 -0
  67. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/CODE_OF_CONDUCT.md +0 -0
  68. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/LICENSE +0 -0
  69. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/SECURITY.md +0 -0
  70. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/assets/banner.png +0 -0
  71. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/docs/assets/jambu-logo.jpg +0 -0
  72. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/experiment.py +0 -0
  73. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/jambu.yaml +0 -0
  74. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/README.md +0 -0
  75. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/package-lock.json +0 -0
  76. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/package.json +0 -0
  77. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/src/agent.ts +0 -0
  78. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/src/index.ts +0 -0
  79. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/src/tools/weather-tool.ts +0 -0
  80. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/mastra-agent/tsconfig.json +0 -0
  81. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/typescript-client/README.md +0 -0
  82. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/typescript-client/package-lock.json +0 -0
  83. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/typescript-client/package.json +0 -0
  84. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/typescript-client/src/gpu.ts +0 -0
  85. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/typescript-client/src/index.ts +0 -0
  86. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/examples/typescript-client/tsconfig.json +0 -0
  87. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/__main__.py +0 -0
  88. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/agent/__init__.py +0 -0
  89. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/agent/jobs.py +0 -0
  90. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/__init__.py +0 -0
  91. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/_common.py +0 -0
  92. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/agent.py +0 -0
  93. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/inspect.py +0 -0
  94. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/lifecycle.py +0 -0
  95. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/run.py +0 -0
  96. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/status.py +0 -0
  97. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/timer.py +0 -0
  98. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/cli/validate.py +0 -0
  99. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/__init__.py +0 -0
  100. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/beacon.py +0 -0
  101. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/credentials.py +0 -0
  102. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/durations.py +0 -0
  103. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/errors.py +0 -0
  104. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/execution.py +0 -0
  105. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/health.py +0 -0
  106. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/hosts.py +0 -0
  107. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/model_inspect.py +0 -0
  108. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/models.py +0 -0
  109. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/paths.py +0 -0
  110. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/policy.py +0 -0
  111. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/state.py +0 -0
  112. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/sweep.py +0 -0
  113. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/core/tool_parsers.py +0 -0
  114. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/__init__.py +0 -0
  115. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/__init__.py +0 -0
  116. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/client.py +0 -0
  117. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/mapper.py +0 -0
  118. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/runtime/__init__.py +0 -0
  119. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/runtime/vllm.py +0 -0
  120. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/gpu4agents/watchdog/__init__.py +0 -0
  121. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/jambu.example.yaml +0 -0
  122. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/jambu.models.yaml +0 -0
  123. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/jambu.yaml +0 -0
  124. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/jambu_gpu/__init__.py +0 -0
  125. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/jambu_gpu/__main__.py +0 -0
  126. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/conftest.py +0 -0
  127. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/fakes.py +0 -0
  128. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_config.py +0 -0
  129. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_engine_sessions.py +0 -0
  130. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_model_inspect.py +0 -0
  131. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_paths.py +0 -0
  132. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_policy.py +0 -0
  133. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_state.py +0 -0
  134. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_sweep.py +0 -0
  135. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_vast_mapper.py +0 -0
  136. {gpu4agents-0.6.0 → gpu4agents-0.8.0}/tests/test_vast_provider.py +0 -0
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-marketplace.json",
3
+ "name": "gpu4agents",
4
+ "owner": {
5
+ "name": "Jambu.ai",
6
+ "url": "https://github.com/jambuai"
7
+ },
8
+ "description": "Install GPU for Agents as a Claude Code plugin.",
9
+ "plugins": [
10
+ {
11
+ "name": "gpu4agents",
12
+ "source": "./",
13
+ "description": "Your agent rents the GPU it needs, serves a model on it and runs the experiment. You pay only while it works.",
14
+ "license": "MIT",
15
+ "keywords": ["gpu", "llm", "vllm", "mcp", "experiments", "cloud"]
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "gpu4agents",
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.8.0",
5
+ "author": {
6
+ "name": "João Gabriel Lima",
7
+ "url": "https://www.linkedin.com/in/joaogabriellima"
8
+ },
9
+ "homepage": "https://gpu4agents.jambu.ai",
10
+ "repository": "https://github.com/jambuai/gpu4agents",
11
+ "license": "MIT",
12
+ "keywords": ["gpu", "llm", "vllm", "mcp", "experiments", "cloud"],
13
+ "skills": ["./skills/"]
14
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "gpu4agents",
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.8.0",
5
+ "author": {
6
+ "name": "João Gabriel Lima"
7
+ },
8
+ "homepage": "https://gpu4agents.jambu.ai",
9
+ "repository": "https://github.com/jambuai/gpu4agents",
10
+ "license": "MIT",
11
+ "keywords": ["gpu", "llm", "vllm", "mcp", "experiments", "cloud"]
12
+ }
@@ -2,6 +2,41 @@
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.8.0] - 2026-11-04
6
+
7
+ ### Added
8
+ - **Jobs: your own code on the GPU.** `gpu job run` packs a directory, uploads it to the rented machine, runs a shell command there, streams the log and downloads whatever the job wrote to `$JAMBU_OUTPUT_DIR` into `gpu-outputs/<job id>/`. Use it for anything that needs CUDA and is not a request to a served model: training or fine-tuning, image, audio or video models, batches, benchmarks. `gpu job status | logs -f | pull | cancel | ls` follow it.
9
+ - A running job counts as work: the watchdog on the machine heartbeats it, so the machine stays up with no laptop connected and becomes idle when the job ends. `max_lifetime` and the session budget still apply. Jobs survive a watchdog respawn; their exit code is written by the job's own shell.
10
+ - `gpujob.yaml` next to the code declares `run`, `setup`, `env`, `timeout`, `exclude` and `label`. `.git`, virtualenvs, caches, `.env` files and earlier outputs never upload.
11
+ - [`JOBS.md`](JOBS.md), served at `gpu4agents.jambu.ai/jobs.md`: the contract an agent follows to write a job.
12
+ - `gpu init --jobs` writes a `jambu.yaml` for a machine that serves no model (`runtime.engine: none`, PyTorch 2.8 with CUDA 12.8). `model` is now optional when nothing is served. `--min-vram-gb` sets the GPU size.
13
+ - MCP tools `gpu_job_run`, `gpu_job_status`, `gpu_job_pull` and `gpu_job_cancel`.
14
+ - The watchdog loads extensions the CLI uploads once the machine is up (`POST /extend`), so the boot script stays under Vast.ai's 16 KB limit. The job runner is the first one.
15
+
16
+ ### Changed
17
+ - The boot payload is base85 instead of base64, about 700 bytes smaller.
18
+ - The default image for `runtime.engine: none` is `pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime` (was 2.4.0 with CUDA 12.1).
19
+
20
+ ### Fixed
21
+ - A machine with `runtime.engine: none` stayed in "starting" until the boot grace ran out (about 45 minutes), so an unused one could not idle out sooner.
22
+
23
+ ### Upgrading
24
+ - Machines rented by an earlier version have a watchdog that cannot load the job runner. `gpu job run` says so; `gpu setup --recreate` replaces the machine.
25
+
26
+ ## [0.7.0] - 2026-11-02
27
+
28
+ ### Added
29
+ - Any GPU provider. An adapter can live in the project (`provider.plugin: ./gpu_providers/acme.py:AcmeProvider` in `jambu.yaml`) or in an installed package that declares a `gpu4agents.providers` entry point. Neither needs a change to gpu4agents. Vast.ai stays built in.
30
+ - `gpu providers new NAME` writes an adapter skeleton with every method that needs the provider's API marked. `gpu init --provider NAME` writes a `jambu.yaml` that loads it.
31
+ - [`PROVIDERS.md`](PROVIDERS.md), served at `gpu4agents.jambu.ai/providers.md`: the steps an agent follows to add a provider, from the skeleton to one test rental with the user's approval.
32
+ - The provider contract has `credentials_url` and `verify_credentials()`, which `gpu login` uses for every provider.
33
+ - Plugin manifests in the style of [Humanizer](https://github.com/blader/humanizer): a Claude Code marketplace (`/plugin marketplace add jambuai/gpu4agents`), a Cursor plugin, and Codex metadata in `skills/gpu4agents/agents/openai.yaml`. Each release attaches `gpu4agents-skill.zip` for Claude.ai and Claude Desktop.
34
+
35
+ ### Changed
36
+ - `gpu login` works with any provider: `--provider NAME` picks it (default: the project's, else `GPU_PROVIDER`, else Vast.ai), it prompts for each credential the adapter declares, and it saves `GPU_PROVIDER` so account-wide commands outside a project use that provider. `--json` output now includes `provider`.
37
+ - The skill, `INSTALL.md`, the MCP server's instructions and the installer no longer assume Vast.ai. When no account is connected, the agent asks which provider the user wants.
38
+ - Docs and the website were edited for plain language.
39
+
5
40
  ## [0.6.0] - 2026-11-02
6
41
 
7
42
  ### Added
@@ -54,7 +54,7 @@ with the right reason.
54
54
 
55
55
  The core must not branch on a provider name. Branch on `provider.capabilities`.
56
56
  If a provider feature requires an `if provider == "..."` in `core/`, the contract
57
- is wrong — extend the contract instead.
57
+ is wrong. Extend the contract instead.
58
58
 
59
59
  Out of scope: multi-instance scheduling, multi-GPU
60
60
  orchestration, Kubernetes, distributed inference, automatic provider selection,
@@ -0,0 +1,56 @@
1
+ # Install GPU for Agents (instructions for the agent)
2
+
3
+ You are a coding agent (Claude Code, Codex, Gemini CLI, Cursor, or another) and the user asked you to set up GPU for Agents. It gives you a `gpu` command, a skill and MCP tools to rent a cloud GPU, serve a model on it and run experiments. A watchdog on the machine shuts it down when idle, so the user pays only while it works. Vast.ai is the built-in GPU provider, and any other provider can be added with an adapter.
4
+
5
+ Follow these steps in order. Run the commands yourself, and tell the user briefly what each step did.
6
+
7
+ ## 1. Install the `gpu` command and give it to this agent
8
+
9
+ Pick the name of the runtime you are running in: `claude` (Claude Code), `codex` (Codex), `gemini` (Gemini CLI) or `cursor` (Cursor). If you are none of these, use `auto`.
10
+
11
+ ```bash
12
+ curl -fsSL https://gpu4agents.jambu.ai/install.sh | sh -s -- --agent <runtime>
13
+ ```
14
+
15
+ If that address does not resolve, use the copy in the repository:
16
+
17
+ ```bash
18
+ curl -fsSL https://raw.githubusercontent.com/jambuai/gpu4agents/main/install.sh | sh -s -- --agent <runtime>
19
+ ```
20
+
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
+
23
+ Check: `~/.local/bin/gpu --version` prints 0.8.0 or later. Use `~/.local/bin/gpu` for the rest of this session if plain `gpu` is not found.
24
+
25
+ ## 2. Connect a GPU provider account
26
+
27
+ Run `gpu login --check`.
28
+
29
+ - Exit code 0: an account is connected. Go to step 3.
30
+ - Exit code 5: no working key yet. Ask the user which GPU provider they want to use.
31
+ - Vast.ai, or no preference: tell the user, in these words or close:
32
+
33
+ > Create an API key at https://cloud.vast.ai/manage-keys/ and add a few dollars of credit. Then open your own terminal, run `gpu login`, and paste the key into the hidden prompt.
34
+
35
+ - Another provider (RunPod, Lambda, their company's cluster, ...): `gpu` needs an adapter for it first. Tell the user you can write one, and do it after this installation by following https://gpu4agents.jambu.ai/providers.md. The user then runs `gpu login --provider <name>`.
36
+
37
+ Wait until the user says it is done, then run `gpu login --check` again. If the user wants to connect later, go on to step 3.
38
+
39
+ Never ask the user to paste a key into this conversation, never read `~/.gpu/credentials` or `.env` files, and never print a key.
40
+
41
+ ## 3. Learn how to use it
42
+
43
+ Run `gpu agent skill` and read the output. It is the skill you just installed: the rules (ask before renting, wait out a slow setup, clean up), the commands, monitoring, adding a provider, and error codes. Follow it for the rest of this session.
44
+
45
+ The MCP tools (`gpu_setup`, `gpu_status`, ...) appear after the user restarts the agent. Until then, the CLI does everything: `gpu --json <command>`.
46
+
47
+ ## 4. Tell the user it is ready
48
+
49
+ Summarize in a few lines:
50
+
51
+ - what was installed (the `gpu` command, the skill, the MCP server for this runtime);
52
+ - whether a provider account is connected, or what they still need to do (`gpu login`, or an adapter for their provider);
53
+ - that they should restart the agent to get the tools;
54
+ - an example request: "Compare Qwen 7B and Llama 8B on 50 prompts", and that you will show the price and ask before renting anything.
55
+
56
+ Do not rent a GPU as part of the installation.
@@ -0,0 +1,82 @@
1
+ # Run your own code on the GPU (instructions for the agent)
2
+
3
+ You are a coding agent and the work needs a GPU: training or fine-tuning, an image, audio or video model, a batch over a dataset, a kernel benchmark, anything that wants CUDA. GPU for Agents (`gpu`) rents the machine, runs your code on it as a **job**, brings back the files it writes, and stops the machine once nothing runs. This page is the contract a job follows. Follow it exactly.
4
+
5
+ ## 1. The machine
6
+
7
+ The job runs on the project's machine, described by `jambu.yaml`. For a machine that only runs jobs:
8
+
9
+ ```bash
10
+ gpu init --jobs --min-vram-gb 24 # runtime.engine: none, image pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime
11
+ ```
12
+
13
+ Size `--min-vram-gb` for the job (a 7B model in bf16 needs about 16 GB to run and much more to fully fine-tune; LoRA on 7B fits in 24 GB). To use a different image, set `compute.image`. It needs `bash` and `python3`.
14
+
15
+ A project that serves a model with vLLM can run jobs too. The job then reaches the model over loopback through `OPENAI_BASE_URL`, `OPENAI_API_KEY` and `JAMBU_MODEL_ID`, which are already set, and vLLM holds most of the GPU memory.
16
+
17
+ ## 2. The job directory
18
+
19
+ Put everything the job needs in one directory (the project directory by default):
20
+
21
+ ```
22
+ my-job/
23
+ gpujob.yaml # what to run (optional; flags override it)
24
+ train.py # your code
25
+ requirements.txt # installed by setup:
26
+ ```
27
+
28
+ `gpujob.yaml`:
29
+
30
+ ```yaml
31
+ run: python train.py --epochs 3 # required here or as `gpu job run -- CMD`
32
+ setup: pip install -r requirements.txt # runs first; if it fails, run does not
33
+ env: # extra environment variables
34
+ EPOCHS: "3"
35
+ timeout: 2h # killed after this long (exit 124)
36
+ exclude: [data/raw, "*.ckpt"] # left out of the upload
37
+ label: lora-qwen-7b
38
+ ```
39
+
40
+ These never upload: `.git`, virtualenvs, `__pycache__`, `node_modules`, `.gpu`, `.env` and `.env.*`, and `gpu-outputs/`. The upload limit is 2 GB. Have the job download large data itself (Hugging Face, a URL) instead of shipping it.
41
+
42
+ ## 3. What the job can count on
43
+
44
+ - It runs in its own copy of the directory, with that copy as the working directory.
45
+ - `JAMBU_OUTPUT_DIR`: write every result here (files, checkpoints, images, metrics). Nothing else comes back.
46
+ - `JAMBU_JOB_ID` and `JAMBU_JOB_DIR` are set.
47
+ - `HF_HOME` points to a cache on the machine's disk, so a model downloaded once is reused by the next job on that machine. `HF_TOKEN` is set when the project has one (`gpu login` or `.env`).
48
+ - stdout and stderr go into one log. Python output is unbuffered.
49
+ - The exit code is the job's result: 0 means succeeded, anything else means failed.
50
+ - The provider credential the machine uses to stop itself is removed from the environment.
51
+
52
+ ## 4. Rules for the code you write
53
+
54
+ 1. Write results only to `$JAMBU_OUTPUT_DIR`. Write checkpoints there as you go, so a pull mid-run or a cut-off job still leaves something.
55
+ 2. Print progress lines (step, loss, items done). The log is the only way anyone sees the job running.
56
+ 3. Exit non-zero on failure. Do not catch every exception and exit 0.
57
+ 4. Never print secrets, and never write them into outputs.
58
+ 5. Install dependencies in `setup:`, pinned (`torch` comes with the default image; do not reinstall it).
59
+ 6. Keep the job under `lifecycle.max_lifetime` (6 h by default) and the session budget: those stop the machine even while a job runs. Set `timeout:` below them.
60
+
61
+ ## 5. Running it
62
+
63
+ With the user's yes (renting costs money; show `gpu offers` first):
64
+
65
+ ```bash
66
+ gpu job run # pack, upload, run, stream the log, download the outputs
67
+ gpu job run -- python eval.py # the command, without gpujob.yaml
68
+ gpu job run --detach # return once it starts
69
+ gpu job status # state, exit code, time, cost, output files (latest job)
70
+ gpu job logs -f # follow the log
71
+ gpu job pull # outputs into gpu-outputs/<job id>/ (works mid-run)
72
+ gpu job cancel # TERM, then KILL after 10 s
73
+ gpu job ls
74
+ ```
75
+
76
+ Through MCP: `gpu_setup` until ready, `gpu_job_run`, then `gpu_job_status(job_id)` until the state is no longer `running`, then `gpu_job_pull(job_id)`.
77
+
78
+ States: `running`, `succeeded`, `failed`, `timeout`, `cancelled`, `lost` (the machine restarted under it). `gpu job run` exits with the job's code, 124 on timeout and 130 on cancel.
79
+
80
+ ## 6. Afterwards
81
+
82
+ The machine stops by itself after `idle_timeout` (15 min) once no job runs. A stopped machine keeps its disk, so `gpu setup` restarts it and `gpu job pull` still works. `gpu destroy` deletes the disk and every job file on it, so pull the outputs first. Tell the user what ran, how long it took, what it cost (`gpu job status` reports `cost_usd`) and where the outputs are.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: gpu4agents
3
- Version: 0.6.0
3
+ Version: 0.8.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
@@ -65,38 +65,109 @@ Description-Content-Type: text/markdown
65
65
  **Your agent rents the GPU it needs, on its own.**
66
66
  **You pay only while it works: we watch every machine and shut down the idle ones.**
67
67
 
68
- Ask Claude Code, Cursor or any MCP client to "compare Qwen 7B and Llama 8B on these 50 prompts". The agent finds a GPU under your budget, serves the model behind an OpenAI-compatible API with vLLM, and runs the experiment. A watchdog runs on the machine itself, so when nothing uses it for `idle_timeout` (15 minutes by default) it shuts down, even if the agent forgot, the chat closed or your laptop is asleep.
68
+ Ask Claude Code, Codex, Gemini CLI or Cursor to "compare Qwen 7B and Llama 8B on these 50 prompts". The agent finds a GPU under your budget, serves the model with vLLM behind an OpenAI-compatible API, and runs the experiment. A watchdog on the machine shuts it down after `idle_timeout` (15 minutes by default) with nothing using it, even if the agent forgot, the chat closed or your laptop is asleep.
69
69
 
70
- - **Self-service GPUs for agents.** Claude Code, Codex, Gemini CLI and Cursor install it themselves from one pasted line. A skill and local MCP tools (`gpu_offers`, `gpu_setup`, `gpu_run`, `gpu_status`, `gpu_destroy`, ...) give the agent the whole lifecycle. The skill tells it to show you the price and ask before renting.
71
- - **Billing that ends when the work does.** Idle timeout, maximum lifetime, hourly and session budgets, and a sweep that cleans up anything left behind.
72
- - **Any app, any language.** `gpu --json setup` returns `base_url`, `api_key` and `model` for any OpenAI SDK.
70
+ The agent installs it from one pasted line. A skill and local MCP tools (`gpu_offers`, `gpu_setup`, `gpu_run`, `gpu_status`, `gpu_destroy`, ...) cover the whole lifecycle, and the skill tells the agent to show you the price and ask before renting. Budgets, a maximum lifetime and an account-wide sweep catch anything left behind. Apps in any language get the endpoint from `gpu --json setup`.
73
71
 
74
- Vast.ai is the first provider; another provider is a new adapter, and the lifecycle rule stays the same.
72
+ Vast.ai is built in. Any other GPU provider takes one adapter file, and your agent can write it: see [Use any GPU provider](#use-any-gpu-provider).
75
73
 
76
- ## Quickstart: let your agent install it
74
+ ## Installation
77
75
 
78
- Paste this into Claude Code, Codex, Gemini CLI or Cursor (say which one you use):
76
+ The quickest way works in every agent. Paste this, naming the agent you use:
79
77
 
80
78
  ```text
81
79
  Set up GPU for Agents for me. I'm using Claude Code. Fetch https://gpu4agents.jambu.ai/install.md with curl and follow its steps.
82
80
  ```
83
81
 
84
- The agent installs the `gpu` command (with [uv](https://docs.astral.sh/uv/), which brings its own Python), the `gpu4agents` skill and the `gpu` MCP tools. Then you connect your GPU account in your own terminal, so the agent never sees the key:
82
+ The agent installs the `gpu` command (with [uv](https://docs.astral.sh/uv/), which brings its own Python), the `gpu4agents` skill and the `gpu` MCP tools. It rents nothing.
83
+
84
+ You can also install the skill the way your agent installs other skills. The skill installs the `gpu` command the first time it runs.
85
+
86
+ ### Claude Code
87
+
88
+ ```text
89
+ /plugin marketplace add jambuai/gpu4agents
90
+ /plugin install gpu4agents@gpu4agents
91
+ ```
92
+
93
+ On Claude Code 2.1.275 or newer, one line does both: `/plugin install gpu4agents --marketplace jambuai/gpu4agents`.
94
+
95
+ ### Codex
96
+
97
+ ```bash
98
+ npx skills add jambuai/gpu4agents --global --agent codex
99
+ ```
100
+
101
+ ### Gemini CLI, Cursor and other agents
102
+
103
+ ```bash
104
+ npx skills add jambuai/gpu4agents --global --agent '*'
105
+ ```
106
+
107
+ This installs the skill for every agent the [Skills CLI](https://skills.sh) supports. Leave off `--global` to install it only in the current project.
108
+
109
+ ### Claude.ai and Claude Desktop
110
+
111
+ Download [`gpu4agents-skill.zip`](https://github.com/jambuai/gpu4agents/releases/latest/download/gpu4agents-skill.zip) and upload it under Settings > Capabilities > Skills.
112
+
113
+ ### From a terminal
114
+
115
+ ```bash
116
+ curl -fsSL https://gpu4agents.jambu.ai/install.sh | sh # uv, Python and gpu, then every agent it finds
117
+ uv tool install gpu4agents && gpu agent install -t auto --global # the same, by hand
118
+ ```
119
+
120
+ ## Connect a GPU provider
121
+
122
+ Run this in your own terminal, so the agent never sees the key:
85
123
 
86
124
  ```bash
87
- gpu login # paste your Vast.ai key (https://cloud.vast.ai/manage-keys/) into the hidden prompt
125
+ gpu login # Vast.ai: paste a key from https://cloud.vast.ai/manage-keys/
126
+ gpu login --provider runpod # a provider you added an adapter for
127
+ gpu login --check # which account gpu finds, and its balance
88
128
  ```
89
129
 
90
- Restart the agent and ask for an experiment. It shows the price and asks before renting anything. See [Letting a coding agent rent GPUs](docs/AGENTS.md).
130
+ `gpu login` checks the key with the provider, then saves it in `~/.gpu/credentials` (mode 600). Keys in the environment or a project `.env` work too. They never go in `jambu.yaml`.
131
+
132
+ Restart the agent and ask for an experiment. See [Letting a coding agent rent GPUs](docs/AGENTS.md).
91
133
 
92
- Prefer a terminal? These do the same:
134
+ ## Run your own code on the GPU
135
+
136
+ Serving a model is one use. A **job** is any program: training a LoRA, generating images or audio with an open model, a batch over a dataset, a CUDA benchmark. The agent writes the code in a directory, and `gpu` uploads it, runs it on the rented machine, streams the log and brings back whatever it wrote to `$JAMBU_OUTPUT_DIR`. The machine stays up while the job runs and stops by itself after it ends.
93
137
 
94
138
  ```bash
95
- curl -fsSL https://gpu4agents.jambu.ai/install.sh | sh # uv + Python + gpu, then every agent it finds
96
- npx skills add jambuai/gpu4agents # just the skill; it installs gpu on first use
97
- uv tool install gpu4agents && gpu agent install -t codex --global # by hand: claude | codex | gemini | cursor | auto
139
+ gpu init --jobs --min-vram-gb 24 # a machine that runs jobs, no model server
140
+ gpu job run -- python train.py --epochs 3 # upload, run, follow, download to gpu-outputs/<job id>/
141
+ gpu job status # state, exit code, time, cost
98
142
  ```
99
143
 
144
+ To have the agent write one, paste:
145
+
146
+ ```text
147
+ Write this as a GPU for Agents job and run it. Fetch https://gpu4agents.jambu.ai/jobs.md with curl and follow its contract.
148
+ ```
149
+
150
+ [JOBS.md](JOBS.md) has the contract: the directory, `gpujob.yaml`, the environment a job gets, and the rules its code follows.
151
+
152
+ ## Use any GPU provider
153
+
154
+ `gpu` talks to providers through a small contract: find offers, rent, report status, stop, destroy, and two calls the watchdog makes from the machine to shut itself down. Vast.ai ships with it. For anything else, such as RunPod, Lambda or your company's cluster, paste this into your agent:
155
+
156
+ ```text
157
+ Add <provider> to GPU for Agents. Fetch https://gpu4agents.jambu.ai/providers.md with curl and follow its steps.
158
+ ```
159
+
160
+ The agent runs `gpu providers new <name>`, fills in the adapter from the provider's API docs, checks it with `gpu validate` and `gpu offers`, and asks you before a test rental. The adapter is one file in your project, selected in `jambu.yaml`:
161
+
162
+ ```yaml
163
+ gpu_runtime:
164
+ provider:
165
+ name: runpod
166
+ plugin: ./gpu_providers/runpod.py:RunpodProvider
167
+ ```
168
+
169
+ To reuse an adapter across projects, publish it as a package with a `gpu4agents.providers` entry point. The watchdog, budgets, CLI and MCP tools work the same with every provider. See [PROVIDERS.md](PROVIDERS.md) and [Adding a provider](docs/ADDING_A_PROVIDER.md).
170
+
100
171
  ## Quickstart: from a shell or an app
101
172
 
102
173
  ```bash
@@ -127,23 +198,22 @@ gpu_runtime:
127
198
  pull_stall_timeout: 10m # a host whose image pull stalls is replaced
128
199
  ```
129
200
 
130
- A full example is [`jambu.example.yaml`](jambu.example.yaml). As a last line of defense, `gpu ls` shows every machine billing in the account and `gpu sweep --install-timer` guards every project on the machine and cleans up orphans. See [Keeping the account clean](docs/USAGE.md#keeping-the-account-clean).
131
-
132
- `gpu login` saves the API key in `~/.gpu/credentials` (mode 600) after checking it; the environment and a project `.env` work too. It never goes in the manifest, and the agent never sees it.
201
+ A full example is [`jambu.example.yaml`](jambu.example.yaml). `gpu ls` shows every machine billing in the account, and `gpu sweep --install-timer` guards every project on the machine and cleans up orphans. See [Keeping the account clean](docs/USAGE.md#keeping-the-account-clean).
133
202
 
134
203
  ## Docs
135
204
 
136
205
  - [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
137
206
  - [Integrating into an application (any language)](docs/INTEGRATION.md)
207
+ - [Running your own code as a job](JOBS.md)
138
208
  - [Commands, workloads, and agents](docs/USAGE.md)
139
209
  - [Every config field](docs/CONFIG.md)
140
210
  - [Choosing a model](docs/CHOOSING_A_MODEL.md)
141
211
  - [How shutdown works](docs/LIFECYCLE.md)
142
- - [Adding a provider](docs/ADDING_A_PROVIDER.md)
212
+ - [Adding a provider](docs/ADDING_A_PROVIDER.md), and [the steps for an agent](PROVIDERS.md)
143
213
 
144
214
  ## Coming from `jambu-gpu`
145
215
 
146
- The package was called `jambu-gpu` until 0.4.1. Same code, same `gpu` command, same `jambu.yaml`, same machines:
216
+ The package was called `jambu-gpu` until 0.4.1. The code, the `gpu` command, `jambu.yaml` and the machines are the same:
147
217
 
148
218
  ```bash
149
219
  pipx uninstall jambu-gpu && pipx install gpu4agents
@@ -165,6 +235,6 @@ Created by [João Gabriel Lima](https://www.linkedin.com/in/joaogabriellima) at
165
235
 
166
236
  <p align="center">
167
237
  <a href="https://jambu.ai">
168
- <img src="docs/assets/jambu-logo.jpg" alt="Jambu.ai — Applied Intelligence Lab" width="240">
238
+ <img src="docs/assets/jambu-logo.jpg" alt="Jambu.ai, Applied Intelligence Lab" width="240">
169
239
  </a>
170
240
  </p>
@@ -0,0 +1,85 @@
1
+ # Add a GPU provider to GPU for Agents (instructions for the agent)
2
+
3
+ You are a coding agent, and the user wants GPU for Agents (`gpu`) to rent from a provider it does not ship with, such as RunPod, Lambda, Paperspace, a company cluster or their own servers. Vast.ai is built in. Any other provider is one Python file that implements the provider contract. The core, the watchdog that stops idle machines, the CLI and the MCP tools stay the same.
4
+
5
+ Follow these steps in the user's project directory. Do not rent anything until step 6, and ask first.
6
+
7
+ ## 1. Make sure `gpu` is installed
8
+
9
+ `gpu --version` must print 0.7.0 or later. If it does not, follow https://gpu4agents.jambu.ai/install.md first.
10
+
11
+ ## 2. Write the adapter skeleton
12
+
13
+ ```bash
14
+ gpu providers new <name> --display-name "<Provider name>"
15
+ gpu init --provider <name> --model <org/model> # skip if jambu.yaml exists
16
+ ```
17
+
18
+ The first command writes `gpu_providers/<name>.py`. The second writes a `jambu.yaml` that selects it:
19
+
20
+ ```yaml
21
+ gpu_runtime:
22
+ provider:
23
+ name: <name>
24
+ plugin: ./gpu_providers/<name>.py:<Name>Provider
25
+ ```
26
+
27
+ In an existing `jambu.yaml`, add those two lines under `gpu_runtime.provider` yourself.
28
+
29
+ ## 3. Read the provider's API docs, then fill in the file
30
+
31
+ Every `todo(...)` call marks a part that needs the provider's API; until you write it, that part fails with a clear error (exit 9). Read the contract in `gpu4agents/providers/base.py` (run `python -c "import gpu4agents.providers.base as b; print(b.__file__)"` to find it) and the guide at https://github.com/jambuai/gpu4agents/blob/main/docs/ADDING_A_PROVIDER.md. The Vast.ai adapter in `gpu4agents/providers/vast/` is a full working example.
32
+
33
+ What each part must do:
34
+
35
+ | Part | What it does |
36
+ | --- | --- |
37
+ | `capabilities` | Declare only what the API supports. Set `stop_eliminates_billing=False` if a stopped machine still bills for disk. |
38
+ | `verify_credentials` | Call an account endpoint with the key the user typed into `gpu login`. Return only safe fields, such as `{"balance_usd": 12.5}`. Never return an email, a name or the key. |
39
+ | `find_offers` | List GPUs for rent that fit `spec.gpu.min_vram_gb`, `spec.gpu.count`, `spec.disk_gb` and `spec.max_hourly_cost_usd`, cheapest first. |
40
+ | `setup` | Rent one machine: image `spec.image`, environment `spec.env`, label `spec.label`, every port in `spec.ports` published, and `spec.onstart` run at boot. That script starts the model server and the watchdog. |
41
+ | `status`, `_to_instance` | Map the provider's states onto `InstanceState` and its published ports onto `endpoints["model"]` and `endpoints["watchdog"]`. |
42
+ | `stop`, `destroy` | Succeed when the machine is already stopped or gone. |
43
+ | `list_instances` | Return only machines whose label starts with `jambu-`. Never touch anything else in the account. |
44
+ | `WATCHDOG_ACTIONS` | Python, stdlib only, that runs on the machine itself: `provider_stop(ctx)` and `provider_destroy(ctx)` call the provider's API so an idle machine stops even when no laptop is on. |
45
+
46
+ Raise only the errors in `gpu4agents.core.errors`: `AuthenticationError`, `CapacityUnavailableError`, `ProvisioningError`, `ProviderTimeoutError`, `ProviderError`. The CLI turns them into the usual exit codes.
47
+
48
+ If the provider has no API for something (no stop, no price list), set that capability to `False` and leave its `todo(...)` in place. Tell the user which features that turns off.
49
+
50
+ ## 4. Connect the account
51
+
52
+ Ask the user to run this in their own terminal and paste the key into the hidden prompt:
53
+
54
+ ```bash
55
+ gpu login --provider <name>
56
+ ```
57
+
58
+ Never ask for the key in the chat. `gpu login --check` then exits 0.
59
+
60
+ ## 5. Check without renting
61
+
62
+ ```bash
63
+ gpu --json validate
64
+ gpu --json offers
65
+ gpu providers
66
+ ```
67
+
68
+ `offers` must list real GPUs with real prices. Fix the adapter until it does.
69
+
70
+ ## 6. One real run, with the user's yes
71
+
72
+ Show the user the cheapest offer and ask before renting. Use a small model to keep it cheap (`Qwen/Qwen2.5-0.5B-Instruct` on a 16 to 24 GB GPU). Then:
73
+
74
+ ```bash
75
+ gpu --json setup # rent, boot, serve the model; can take 5 to 15 minutes
76
+ gpu --json status # state ready, endpoint up, watchdog reachable
77
+ gpu --json destroy --yes # with the user's yes
78
+ gpu --json ls # nothing of ours left running
79
+ ```
80
+
81
+ If `watchdog.reachable` is false in `status`, the watchdog port is not published: check `endpoints["watchdog"]` in `_to_instance`.
82
+
83
+ ## 7. Tell the user what changed
84
+
85
+ List the file you wrote, the capabilities you turned off and why, and the result of the test run. To share the adapter with other projects, package it and declare it under the `gpu4agents.providers` entry point group: every `gpu` on that machine then finds it without `plugin:`.