gpu4agents 0.7.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.
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.claude-plugin/plugin.json +1 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.cursor-plugin/plugin.json +1 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/CHANGELOG.md +21 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/INSTALL.md +1 -1
- gpu4agents-0.8.0/JOBS.md +82 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/PKG-INFO +20 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/README.md +19 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/__init__.py +1 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/agent/mcp.py +101 -0
- {gpu4agents-0.7.0/skills/gpu4agents → gpu4agents-0.8.0/gpu4agents/agent/skill}/SKILL.md +17 -3
- gpu4agents-0.8.0/gpu4agents/cli/job.py +295 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/main.py +2 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/setup.py +16 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/config.py +49 -2
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/engine.py +227 -2
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/events.py +4 -0
- gpu4agents-0.8.0/gpu4agents/core/job.py +378 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/runtime/base.py +15 -2
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/watchdog/agent_body.py +81 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/watchdog/builder.py +13 -9
- gpu4agents-0.8.0/gpu4agents/watchdog/jobs_ext.py +470 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/install.sh +2 -2
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/pyproject.toml +1 -1
- {gpu4agents-0.7.0/gpu4agents/agent/skill → gpu4agents-0.8.0/skills/gpu4agents}/SKILL.md +17 -3
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_agent.py +14 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_engine.py +4 -4
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_integration.py +71 -0
- gpu4agents-0.8.0/tests/test_jobs.py +335 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_runtime_vllm.py +1 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_watchdog.py +1 -1
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.claude-plugin/marketplace.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.env.example +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/dependabot.yml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/pull_request_template.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/workflows/ci.yml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.github/workflows/release.yml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/.gitignore +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/CODE_OF_CONDUCT.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/CONTRIBUTING.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/LICENSE +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/PROVIDERS.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/SECURITY.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/ACCEPTANCE.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/ADDING_A_PROVIDER.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/AGENTS.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/CHOOSING_A_MODEL.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/CONFIG.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/INTEGRATION.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/LIFECYCLE.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/USAGE.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/assets/banner.png +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/docs/assets/jambu-logo.jpg +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/experiment.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/jambu.yaml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/README.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/package-lock.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/package.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/src/agent.ts +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/src/index.ts +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/src/tools/weather-tool.ts +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/mastra-agent/tsconfig.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/typescript-client/README.md +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/typescript-client/package-lock.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/typescript-client/package.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/typescript-client/src/gpu.ts +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/typescript-client/src/index.ts +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/examples/typescript-client/tsconfig.json +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/__main__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/agent/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/agent/install.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/agent/jobs.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/_common.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/account.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/agent.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/inspect.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/lifecycle.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/providers.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/run.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/status.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/timer.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/cli/validate.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/beacon.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/credentials.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/durations.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/errors.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/execution.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/health.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/hosts.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/model_inspect.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/models.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/paths.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/policy.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/state.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/sweep.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/core/tool_parsers.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/base.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/registry.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/scaffold.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/client.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/config.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/mapper.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/providers/vast/provider.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/runtime/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/runtime/vllm.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/gpu4agents/watchdog/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/jambu.example.yaml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/jambu.models.yaml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/jambu.yaml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/jambu_gpu/__init__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/jambu_gpu/__main__.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/skills/gpu4agents/agents/openai.yaml +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/conftest.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/fakes.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_cli.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_config.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_engine_sessions.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_model_inspect.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_paths.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_policy.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_state.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_sweep.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.0}/tests/test_vast_mapper.py +0 -0
- {gpu4agents-0.7.0 → gpu4agents-0.8.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.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "João Gabriel Lima",
|
|
7
7
|
"url": "https://www.linkedin.com/in/joaogabriellima"
|
|
@@ -2,6 +2,27 @@
|
|
|
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
|
+
|
|
5
26
|
## [0.7.0] - 2026-11-02
|
|
6
27
|
|
|
7
28
|
### Added
|
|
@@ -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.
|
|
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
24
|
|
|
25
25
|
## 2. Connect a GPU provider account
|
|
26
26
|
|
gpu4agents-0.8.0/JOBS.md
ADDED
|
@@ -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.
|
|
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
|
|
@@ -131,6 +131,24 @@ gpu login --check # which account gpu finds, and its balance
|
|
|
131
131
|
|
|
132
132
|
Restart the agent and ask for an experiment. See [Letting a coding agent rent GPUs](docs/AGENTS.md).
|
|
133
133
|
|
|
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.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
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
|
|
142
|
+
```
|
|
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
|
+
|
|
134
152
|
## Use any GPU provider
|
|
135
153
|
|
|
136
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:
|
|
@@ -186,6 +204,7 @@ A full example is [`jambu.example.yaml`](jambu.example.yaml). `gpu ls` shows eve
|
|
|
186
204
|
|
|
187
205
|
- [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
|
|
188
206
|
- [Integrating into an application (any language)](docs/INTEGRATION.md)
|
|
207
|
+
- [Running your own code as a job](JOBS.md)
|
|
189
208
|
- [Commands, workloads, and agents](docs/USAGE.md)
|
|
190
209
|
- [Every config field](docs/CONFIG.md)
|
|
191
210
|
- [Choosing a model](docs/CHOOSING_A_MODEL.md)
|
|
@@ -90,6 +90,24 @@ gpu login --check # which account gpu finds, and its balance
|
|
|
90
90
|
|
|
91
91
|
Restart the agent and ask for an experiment. See [Letting a coding agent rent GPUs](docs/AGENTS.md).
|
|
92
92
|
|
|
93
|
+
## Run your own code on the GPU
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
gpu init --jobs --min-vram-gb 24 # a machine that runs jobs, no model server
|
|
99
|
+
gpu job run -- python train.py --epochs 3 # upload, run, follow, download to gpu-outputs/<job id>/
|
|
100
|
+
gpu job status # state, exit code, time, cost
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
To have the agent write one, paste:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
Write this as a GPU for Agents job and run it. Fetch https://gpu4agents.jambu.ai/jobs.md with curl and follow its contract.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
[JOBS.md](JOBS.md) has the contract: the directory, `gpujob.yaml`, the environment a job gets, and the rules its code follows.
|
|
110
|
+
|
|
93
111
|
## Use any GPU provider
|
|
94
112
|
|
|
95
113
|
`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:
|
|
@@ -145,6 +163,7 @@ A full example is [`jambu.example.yaml`](jambu.example.yaml). `gpu ls` shows eve
|
|
|
145
163
|
|
|
146
164
|
- [Letting a coding agent rent GPUs (Claude Code, Codex, Gemini CLI, Cursor, Claude Desktop)](docs/AGENTS.md)
|
|
147
165
|
- [Integrating into an application (any language)](docs/INTEGRATION.md)
|
|
166
|
+
- [Running your own code as a job](JOBS.md)
|
|
148
167
|
- [Commands, workloads, and agents](docs/USAGE.md)
|
|
149
168
|
- [Every config field](docs/CONFIG.md)
|
|
150
169
|
- [Choosing a model](docs/CHOOSING_A_MODEL.md)
|
|
@@ -74,6 +74,10 @@ Rules:
|
|
|
74
74
|
explicit yes. Finish by checking gpu_ls for anything still running.
|
|
75
75
|
- Never print or ask for the provider's API key; the user runs `gpu login`
|
|
76
76
|
in a terminal. The endpoint api_key is per machine.
|
|
77
|
+
- To run your own code on the GPU (training, image or audio models, anything
|
|
78
|
+
that needs CUDA), write it in a directory following
|
|
79
|
+
https://gpu4agents.jambu.ai/jobs.md, then gpu_setup, gpu_job_run,
|
|
80
|
+
gpu_job_status until it ends, and gpu_job_pull for the outputs.
|
|
77
81
|
"""
|
|
78
82
|
|
|
79
83
|
|
|
@@ -393,6 +397,51 @@ class Server:
|
|
|
393
397
|
result["setup_cancelled"] = cancelled
|
|
394
398
|
return result
|
|
395
399
|
|
|
400
|
+
def tool_job_run(self, args: dict[str, Any]) -> Any:
|
|
401
|
+
project_dir = self._project_dir(args)
|
|
402
|
+
argv = ["job", "run", "--detach", "--no-start"]
|
|
403
|
+
if args.get("dir"):
|
|
404
|
+
argv += ["--dir", str(Path(str(args["dir"])).expanduser())]
|
|
405
|
+
for key in ("setup", "timeout", "label"):
|
|
406
|
+
if args.get(key):
|
|
407
|
+
argv += [f"--{key}", str(args[key])]
|
|
408
|
+
for key, value in (args.get("env") or {}).items():
|
|
409
|
+
argv += ["--env", f"{key}={value}"]
|
|
410
|
+
if args.get("command"):
|
|
411
|
+
argv += ["--", str(args["command"])]
|
|
412
|
+
result = self.cli(argv, project_dir)
|
|
413
|
+
if result.returncode == 3:
|
|
414
|
+
error = result.error()
|
|
415
|
+
error["next"] = "start the machine first with gpu_setup (it costs money: ask the user), then call gpu_job_run again"
|
|
416
|
+
raise ToolError(error)
|
|
417
|
+
data = self._ok(result)
|
|
418
|
+
data["next"] = "call gpu_job_status(job_id) to follow it; gpu_job_pull(job_id) once it ends"
|
|
419
|
+
return data
|
|
420
|
+
|
|
421
|
+
def tool_job_status(self, args: dict[str, Any]) -> Any:
|
|
422
|
+
project_dir = self._project_dir(args)
|
|
423
|
+
job_id = args.get("job_id")
|
|
424
|
+
if not job_id:
|
|
425
|
+
return self._ok(self.cli(["job", "ls"], project_dir))
|
|
426
|
+
info = self._ok(self.cli(["job", "status", str(job_id)], project_dir))
|
|
427
|
+
logs = self.cli(["job", "logs", str(job_id)], project_dir)
|
|
428
|
+
if logs.returncode == 0 and isinstance(logs.data, dict):
|
|
429
|
+
info["log_tail"] = _tail_text(logs.data.get("data") or "", int(args.get("log_chars") or OUTPUT_TAIL_CHARS))
|
|
430
|
+
if info.get("state") == "running":
|
|
431
|
+
info["next"] = "still running; call gpu_job_status again later (the machine stays up while it runs)"
|
|
432
|
+
else:
|
|
433
|
+
info["next"] = "gpu_job_pull(job_id) downloads the outputs; then offer gpu_stop"
|
|
434
|
+
return info
|
|
435
|
+
|
|
436
|
+
def tool_job_pull(self, args: dict[str, Any]) -> Any:
|
|
437
|
+
argv = ["job", "pull", str(args["job_id"])]
|
|
438
|
+
if args.get("dest"):
|
|
439
|
+
argv += ["--out", str(Path(str(args["dest"])).expanduser())]
|
|
440
|
+
return self._ok(self.cli(argv, self._project_dir(args)))
|
|
441
|
+
|
|
442
|
+
def tool_job_cancel(self, args: dict[str, Any]) -> Any:
|
|
443
|
+
return self._ok(self.cli(["job", "cancel", str(args["job_id"])], self._project_dir(args)))
|
|
444
|
+
|
|
396
445
|
def tool_ls(self, args: dict[str, Any]) -> Any:
|
|
397
446
|
start = self._start_dir(args)
|
|
398
447
|
config = find_config(start)
|
|
@@ -498,6 +547,58 @@ class Server:
|
|
|
498
547
|
self.tool_run,
|
|
499
548
|
{"readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": True},
|
|
500
549
|
),
|
|
550
|
+
Tool(
|
|
551
|
+
"gpu_job_run",
|
|
552
|
+
"Run code on the GPU",
|
|
553
|
+
"Upload a directory of code to the running GPU machine and start a shell command "
|
|
554
|
+
"there (training, image/audio/video models, anything needing CUDA). Returns job_id "
|
|
555
|
+
"at once; the job keeps the machine up while it runs. Files it writes to "
|
|
556
|
+
"$JAMBU_OUTPUT_DIR come back with gpu_job_pull. Needs a machine started with "
|
|
557
|
+
"gpu_setup. Contract: https://gpu4agents.jambu.ai/jobs.md",
|
|
558
|
+
_schema(
|
|
559
|
+
{
|
|
560
|
+
"dir": {"type": "string", "description": "Directory to upload (default: project_dir). gpujob.yaml there may declare run/setup/env/timeout."},
|
|
561
|
+
"command": {"type": "string", "description": "Shell command, e.g. \"python train.py --epochs 3\". Default: run: in gpujob.yaml."},
|
|
562
|
+
"setup": {"type": "string", "description": "Shell command run first, e.g. \"pip install -r requirements.txt\"."},
|
|
563
|
+
"env": {"type": "object", "additionalProperties": {"type": "string"}},
|
|
564
|
+
"timeout": {"type": "string", "description": "Kill the job after this long, e.g. 2h."},
|
|
565
|
+
"label": {"type": "string"},
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
self.tool_job_run,
|
|
569
|
+
{"readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": True},
|
|
570
|
+
),
|
|
571
|
+
Tool(
|
|
572
|
+
"gpu_job_status",
|
|
573
|
+
"Job status and log",
|
|
574
|
+
"State (running, succeeded, failed, timeout, cancelled), exit code, run time, cost, "
|
|
575
|
+
"output files and the tail of the log of one job. Without job_id, lists this project's jobs.",
|
|
576
|
+
_schema(
|
|
577
|
+
{
|
|
578
|
+
"job_id": {"type": "string"},
|
|
579
|
+
"log_chars": {"type": "integer", "minimum": 100, "maximum": 100000},
|
|
580
|
+
}
|
|
581
|
+
),
|
|
582
|
+
self.tool_job_status,
|
|
583
|
+
read_only,
|
|
584
|
+
),
|
|
585
|
+
Tool(
|
|
586
|
+
"gpu_job_pull",
|
|
587
|
+
"Download job outputs",
|
|
588
|
+
"Download what a job wrote to $JAMBU_OUTPUT_DIR into gpu-outputs/<job_id>/ (or dest). "
|
|
589
|
+
"Works while the job still runs. Do it before gpu_destroy: the files live on the machine's disk.",
|
|
590
|
+
_schema({"job_id": {"type": "string"}, "dest": {"type": "string"}}, ["job_id"]),
|
|
591
|
+
self.tool_job_pull,
|
|
592
|
+
{"readOnlyHint": False, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True},
|
|
593
|
+
),
|
|
594
|
+
Tool(
|
|
595
|
+
"gpu_job_cancel",
|
|
596
|
+
"Cancel a job",
|
|
597
|
+
"Stop a running job (TERM, then KILL after 10 s). Outputs written so far stay.",
|
|
598
|
+
_schema({"job_id": {"type": "string"}}, ["job_id"]),
|
|
599
|
+
self.tool_job_cancel,
|
|
600
|
+
{"readOnlyHint": False, "destructiveHint": True, "idempotentHint": True, "openWorldHint": True},
|
|
601
|
+
),
|
|
501
602
|
Tool(
|
|
502
603
|
"gpu_logs",
|
|
503
604
|
"GPU logs",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gpu4agents
|
|
3
|
-
description: GPU for Agents. Rent a cloud GPU on your own, serve an open-weights model on it behind an OpenAI-compatible API, run experiments or evals, monitor cost and idle time, and shut it down so the user pays only while it works. Works with Vast.ai out of the box and with any other GPU provider through an adapter you can write. Use when the user wants to run, test, benchmark or compare a HuggingFace model (Qwen, Llama, Mistral, ...) on a GPU, needs an LLM endpoint for an experiment, asks what GPUs are running or what they cost, wants to use a specific GPU provider, or asks to install or set up GPU for Agents (gpu4agents, the `gpu` command).
|
|
3
|
+
description: GPU for Agents. Rent a cloud GPU on your own, serve an open-weights model on it behind an OpenAI-compatible API, run experiments or evals, run its own code on the GPU as a job (training, fine-tuning, image/audio/video models, anything that needs CUDA) and bring the outputs back, monitor cost and idle time, and shut it down so the user pays only while it works. Works with Vast.ai out of the box and with any other GPU provider through an adapter you can write. Use when the user wants to run, test, benchmark or compare a HuggingFace model (Qwen, Llama, Mistral, ...) on a GPU, needs an LLM endpoint for an experiment, needs a GPU for code it writes (train a LoRA, generate images or audio, run a CUDA benchmark), asks what GPUs are running or what they cost, wants to use a specific GPU provider, or asks to install or set up GPU for Agents (gpu4agents, the `gpu` command).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# GPU for Agents
|
|
7
7
|
|
|
8
|
-
`gpu` (the `gpu4agents` package) rents a machine from a GPU provider, serves a model on it with vLLM behind an OpenAI-compatible API, and installs a watchdog on the machine. The watchdog shuts the machine down once nothing has used it for `idle_timeout` (15 min by default), so billing ends even if this conversation does.
|
|
8
|
+
`gpu` (the `gpu4agents` package) rents a machine from a GPU provider, serves a model on it with vLLM behind an OpenAI-compatible API or runs your own code on it as a job, and installs a watchdog on the machine. The watchdog shuts the machine down once nothing has used it for `idle_timeout` (15 min by default), so billing ends even if this conversation does.
|
|
9
9
|
|
|
10
10
|
Vast.ai is built in. Any other provider (RunPod, Lambda, a company cluster) plugs in through an adapter: one Python file that implements the provider contract. See "Another provider" below.
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ Do these in order. Skip a step whose check already passes.
|
|
|
17
17
|
|
|
18
18
|
### 1. Install the `gpu` command
|
|
19
19
|
|
|
20
|
-
Check: `gpu --version` prints 0.
|
|
20
|
+
Check: `gpu --version` prints 0.8.0 or later. If the command is missing or older, install it (Linux and macOS; on Windows, use WSL):
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
curl -fsSL https://gpu4agents.jambu.ai/install.sh | sh -s -- --agent <runtime>
|
|
@@ -69,6 +69,10 @@ This writes this skill and registers the `gpu` MCP server for that agent. The to
|
|
|
69
69
|
| keep up through a quiet stretch | `gpu_lock` / `gpu_unlock` | `gpu lock --for 2h` / `gpu unlock` |
|
|
70
70
|
| stop (keep disk) | `gpu_stop` | `gpu --json stop` |
|
|
71
71
|
| delete | `gpu_destroy(confirm=true)` | `gpu --json destroy --yes` |
|
|
72
|
+
| run your code on the GPU | `gpu_job_run(command, dir)` | `gpu job run -- CMD` |
|
|
73
|
+
| job state, log, cost | `gpu_job_status(job_id)` | `gpu job status`, `gpu job logs -f` |
|
|
74
|
+
| download job outputs | `gpu_job_pull(job_id)` | `gpu job pull` |
|
|
75
|
+
| stop a job | `gpu_job_cancel(job_id)` | `gpu job cancel` |
|
|
72
76
|
| everything billing in the account | `gpu_ls` | `gpu --json ls` |
|
|
73
77
|
| providers and what each can do | | `gpu --json providers` |
|
|
74
78
|
|
|
@@ -89,6 +93,16 @@ This writes this skill and registers the `gpu` MCP server for that agent. The to
|
|
|
89
93
|
- single requests: `curl "$base_url/chat/completions" -H "Authorization: Bearer $api_key"` with `"model": model`. Every request counts as activity.
|
|
90
94
|
5. Report results and cost (`gpu_status` has `session_cost_usd`), then rule 4.
|
|
91
95
|
|
|
96
|
+
## Your own code on the GPU (jobs)
|
|
97
|
+
|
|
98
|
+
When the work is code that needs a GPU, not requests to a model (training or fine-tuning, an image, audio or video model, a batch, a benchmark), run it as a job. The full contract is in https://gpu4agents.jambu.ai/jobs.md (copy in the repository: `JOBS.md`). In short:
|
|
99
|
+
|
|
100
|
+
1. A machine that only runs jobs: `gpu init --jobs --min-vram-gb N`. A project serving a model can run jobs too; the job reaches the model on `OPENAI_BASE_URL`.
|
|
101
|
+
2. Put the code in a directory with a `gpujob.yaml`: `run:` (the command), `setup:` (pinned installs), `env:`, `timeout:`, `exclude:`. `.git`, virtualenvs, `.env` files and `gpu-outputs/` never upload; the limit is 2 GB, so the job downloads large data itself.
|
|
102
|
+
3. The code writes every result to `$JAMBU_OUTPUT_DIR` (checkpoints too, as it goes), prints progress, exits non-zero on failure and never prints secrets. `HF_HOME` is a cache on the machine.
|
|
103
|
+
4. With the user's yes: `gpu job run` (uploads, runs, streams the log, downloads to `gpu-outputs/<job id>/`, exits with the job's code). Through MCP: `gpu_setup` until ready, `gpu_job_run`, `gpu_job_status` until the state is not `running`, `gpu_job_pull`.
|
|
104
|
+
5. A running job keeps the machine up; `max_lifetime` and the budget still stop it. Pull outputs before `gpu destroy`, which deletes them.
|
|
105
|
+
|
|
92
106
|
## Another provider
|
|
93
107
|
|
|
94
108
|
When the user wants a provider `gpu providers` does not list, write an adapter for it. The full steps are in https://gpu4agents.jambu.ai/providers.md (copy in the repository: `PROVIDERS.md`). In short:
|