Metadata-Version: 2.5
Name: agi-diy
Version: 0.2.0
Summary: api.agi.diy client: lease a VLA policy, run it over the LeRobot remote-inference protocol.
Project-URL: Homepage, https://api.agi.diy
Project-URL: Source, https://github.com/cagataycali/api-agi-diy
Author: agi.diy
License-Expression: Apache-2.0
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Provides-Extra: numpy
Requires-Dist: numpy; extra == 'numpy'
Description-Content-Type: text/markdown

# agi-diy

Python client for [api.agi.diy](https://api.agi.diy). Lease a VLA policy, run it over the LeRobot
remote-inference protocol (zenoh). One call = one token per action in the chunk.

```
pip install agi-diy
agi login
agi run act/so101 --probe      # first run: "installing lerobot[remote] from source (~2 min, once)…", then the chunks
```

```python
import agi

with agi.Policy("act/so101") as session:
    actions = session.predict(
        {"observation.state": state, "observation.images.top": top, "observation.images.wrist": wrist},
        task="pick up the cube",
    )  # np.ndarray [action_horizon, dof] — 100×6 for act/so101, 50×6 for smolvla/so101
```

The key comes from `AGI_API_KEY` or `~/.agi/credentials` (`AGI_API_KEY=agi_sk_live_…`).

## Surface

```python
agi.Policy("act/so101")          # POST /v1/sessions → lease; raises agi.NoSlots / agi.InsufficientCredits / agi.AuthError
session.endpoint                 # "tcp/bore.pub:35706"  (verbatim from the runner; session.encoding = "jpeg")
session.deployment               # "d_…"
session.url                      # "zenoh://bore.pub:35706/d_…"  → strands_robots.Policy(session.url)
session.connect()                # admitted lerobot.remote_inference.RemoteClient
session.predict(obs, task="…")   # one chunk, np.ndarray
session.policy()                 # strands-robots policy: arm.run(session.policy(), seconds=30)
session.rollout_args()           # flags for lerobot-rollout
session.close()                  # DELETE /v1/sessions/:id (also a context manager; atexit ends forgotten leases)
session.detach()                 # keep the lease past process exit
agi.ensure_lerobot()             # install lerobot[remote] now instead of on the first call
agi.models(); agi.me(); agi.usage(); agi.sessions(); agi.health()
```

CLI (`agi` or `agi-diy`, so `uvx agi-diy login` works): `agi login` · `agi models` · `agi session act/so101` ·
`agi run act/so101 --probe` · `agi rollout act/so101 -- --robot.type=so101_follower …` · `agi usage`.

`connect()`, `predict()`, `agi run` and `agi rollout` speak LeRobot's remote-inference protocol, which is on lerobot
main only (PyPI 0.6.1 lacks it, and PyPI forbids git dependencies). The first call installs
`lerobot[remote] @ git+https://github.com/huggingface/lerobot@d3793b7e` into the running interpreter
(`GIT_LFS_SKIP_SMUDGE=1`; `uv pip` when there is no pip), replaces a `transformers` outside `>=5.4.0,<5.6.0` first,
prints one line, and continues. `AGI_NO_INSTALL=1` prints the command instead. Python 3.10–3.12 is what lerobot tests
on; 3.13+ gets a one-line note. `agi rollout` runs `python -m lerobot.scripts.lerobot_rollout` in that same
interpreter. The REST part has no dependencies.

Errors subclass `agi.Error` with `.error`, `.status`, `.retry_after_s`.
