commandagi 0.3.0__tar.gz → 0.4.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.
- commandagi-0.4.0/.gitignore +8 -0
- commandagi-0.4.0/PKG-INFO +104 -0
- commandagi-0.4.0/README.md +79 -0
- commandagi-0.4.0/commandagi/__init__.py +43 -0
- commandagi-0.4.0/commandagi/_generated.py +437 -0
- commandagi-0.4.0/commandagi/client.py +276 -0
- {commandagi-0.3.0 → commandagi-0.4.0}/commandagi/gym_env.py +11 -11
- commandagi-0.4.0/commandagi-sdk.schema.json +1572 -0
- commandagi-0.4.0/examples/drive_a_sim.py +19 -0
- {commandagi-0.3.0 → commandagi-0.4.0}/pyproject.toml +3 -3
- commandagi-0.4.0/tests/test_sdk.py +134 -0
- commandagi-0.3.0/.gitignore +0 -65
- commandagi-0.3.0/PKG-INFO +0 -159
- commandagi-0.3.0/README.md +0 -134
- commandagi-0.3.0/commandagi/__init__.py +0 -26
- commandagi-0.3.0/commandagi/agent.py +0 -172
- commandagi-0.3.0/commandagi/bridge.py +0 -133
- commandagi-0.3.0/commandagi/client.py +0 -504
- commandagi-0.3.0/examples/sim_agent.py +0 -44
- {commandagi-0.3.0 → commandagi-0.4.0}/commandagi/lerobot.py +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: commandagi
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: The CommandAGI SDK for Python — agent threads, memory and integrations, and live computers, robots and simulated worlds you watch and control.
|
|
5
|
+
Project-URL: Homepage, https://commandagi.com
|
|
6
|
+
Project-URL: Documentation, https://github.com/CommandAGI/commandagi-sdk-python/blob/main/README.md
|
|
7
|
+
Author: CommandAGI
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: agents,computer-use,physics,reinforcement-learning,robotics,simulation
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: requests>=2.28
|
|
12
|
+
Requires-Dist: websocket-client>=1.5
|
|
13
|
+
Provides-Extra: gym
|
|
14
|
+
Requires-Dist: gymnasium>=0.29; extra == 'gym'
|
|
15
|
+
Requires-Dist: numpy>=1.23; extra == 'gym'
|
|
16
|
+
Requires-Dist: pillow>=9.0; extra == 'gym'
|
|
17
|
+
Provides-Extra: lerobot
|
|
18
|
+
Requires-Dist: numpy>=1.23; extra == 'lerobot'
|
|
19
|
+
Requires-Dist: pillow>=9.0; extra == 'lerobot'
|
|
20
|
+
Requires-Dist: pyarrow>=14.0; extra == 'lerobot'
|
|
21
|
+
Provides-Extra: vision
|
|
22
|
+
Requires-Dist: numpy>=1.23; extra == 'vision'
|
|
23
|
+
Requires-Dist: pillow>=9.0; extra == 'vision'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# commandagi — the CommandAGI Python SDK
|
|
27
|
+
|
|
28
|
+
Drive the whole CommandAGI platform as code: agent threads, memory and integrations, and live
|
|
29
|
+
**embodiments** (cloud computers, robots, simulated worlds) that you watch and control.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install commandagi
|
|
33
|
+
export COMMANDAGI_API_KEY=cagi_... # Settings → API keys
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from commandagi import CommandAGI
|
|
38
|
+
|
|
39
|
+
cagi = CommandAGI() # reads COMMANDAGI_API_KEY
|
|
40
|
+
|
|
41
|
+
# Agents: start one on a goal and follow along.
|
|
42
|
+
t = cagi.threads.create(intent="Summarise this week's robotics news in five bullets")
|
|
43
|
+
cagi.threads.send(t["threadId"], "Add a link for each one.")
|
|
44
|
+
|
|
45
|
+
# Embodiments: launch a world YOU drive (no agent in it), watch it, control it.
|
|
46
|
+
with cagi.launch("simulation/warehouse") as world:
|
|
47
|
+
print(world.controls()) # what it accepts right now, with payload schemas
|
|
48
|
+
world.sim.ik(target=[0.3, 0.0, 0.4]) # typed robot/sim control
|
|
49
|
+
jpeg = world.observe(fresh=True) # the next frame, after the move
|
|
50
|
+
# leaving the block stops the world and releases the machine
|
|
51
|
+
|
|
52
|
+
# Anything else: every platform tool by name.
|
|
53
|
+
cagi.call("list_snapshots")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## One surface, generated
|
|
57
|
+
|
|
58
|
+
This SDK, the TypeScript SDK (`npm i commandagi`) and the `commandagi` CLI all come from **one
|
|
59
|
+
schema**, `commandagi-sdk.schema.json`, so they can't drift apart:
|
|
60
|
+
|
|
61
|
+
- **Tools**: `cagi.threads`, `cagi.embodiments`, `cagi.memory`, `cagi.integrations`,
|
|
62
|
+
`cagi.social(platform, account)`, `whoami`, `search`, `run` and `post`. Each one is a typed wrapper
|
|
63
|
+
over `call(tool, args)`. Options are passed as keyword arguments, e.g. `snapshot_id=…`, and sent
|
|
64
|
+
over the wire as camelCase (`snapshotId`).
|
|
65
|
+
- **Control vocabularies** on a live `Session`:
|
|
66
|
+
- `session.desktop` for computers: `click`, `double_click`, `move`, `scroll`, `type`, `key`, `wait`
|
|
67
|
+
- `session.robot` for physical robots: `joint`, `gripper`, `move`, `turn`, `home`, `stop`, …
|
|
68
|
+
- `session.sim` for simulated worlds: `reset`, `sim_mode`, `ctrl`, `actuator`, `ik`,
|
|
69
|
+
`trajectory`, `grab`, `force`, `add_robot`, …
|
|
70
|
+
|
|
71
|
+
Every method sends one action to that embodiment. The platform checks it against the controls the
|
|
72
|
+
embodiment is currently declaring, which `session.controls()` lists along with their payload
|
|
73
|
+
schemas. For anything a runtime declares that no vocabulary covers, use `session.act(action,
|
|
74
|
+
payload)`.
|
|
75
|
+
|
|
76
|
+
The generated part is `commandagi/_generated.py`. Don't edit it: it is regenerated from the schema in
|
|
77
|
+
the CommandAGI monorepo.
|
|
78
|
+
|
|
79
|
+
## Sessions
|
|
80
|
+
|
|
81
|
+
| | |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `cagi.launch(snapshot_id, title=, wait=True, timeout=600)` | a new agentless thread running that snapshot; waits until it declares controls |
|
|
84
|
+
| `cagi.session(thread_id, embodiment_id)` | attach to an embodiment that already exists |
|
|
85
|
+
| `session.frame(fresh=False)` / `observe()` / `observe_array()` / `frames()` | the latest frame, as `{url, channel_id, at}`, image bytes, or a numpy array (`pip install "commandagi[vision]"`); `frames()` yields each new one |
|
|
86
|
+
| `session.describe()` | the live world a sim or robot runtime reports |
|
|
87
|
+
| `session.close()` / `stop()` | stop watching / also stop a world this session launched |
|
|
88
|
+
|
|
89
|
+
Snapshot ids come from `cagi.call("list_snapshots")`, e.g. `simulation/warehouse` or
|
|
90
|
+
`computer/software-engineer`.
|
|
91
|
+
|
|
92
|
+
## Reinforcement learning
|
|
93
|
+
|
|
94
|
+
`commandagi.gym_env.CommandAGIEnv` wraps a sim session as a Gymnasium env (`pip install
|
|
95
|
+
"commandagi[gym]"`), and `commandagi.lerobot` records rollouts as LeRobot datasets (`pip install
|
|
96
|
+
"commandagi[lerobot]"`).
|
|
97
|
+
|
|
98
|
+
## Environment
|
|
99
|
+
|
|
100
|
+
| variable | meaning |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `COMMANDAGI_API_KEY` | your `cagi_…` key. Its scopes decide what every call may do |
|
|
103
|
+
| `COMMANDAGI_BASE_URL` | API origin (default `https://api.commandagi.com`) |
|
|
104
|
+
| `COMMANDAGI_THREAD_ID` | default thread for self-thread methods. Set automatically when your code runs inside the platform |
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# commandagi — the CommandAGI Python SDK
|
|
2
|
+
|
|
3
|
+
Drive the whole CommandAGI platform as code: agent threads, memory and integrations, and live
|
|
4
|
+
**embodiments** (cloud computers, robots, simulated worlds) that you watch and control.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install commandagi
|
|
8
|
+
export COMMANDAGI_API_KEY=cagi_... # Settings → API keys
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from commandagi import CommandAGI
|
|
13
|
+
|
|
14
|
+
cagi = CommandAGI() # reads COMMANDAGI_API_KEY
|
|
15
|
+
|
|
16
|
+
# Agents: start one on a goal and follow along.
|
|
17
|
+
t = cagi.threads.create(intent="Summarise this week's robotics news in five bullets")
|
|
18
|
+
cagi.threads.send(t["threadId"], "Add a link for each one.")
|
|
19
|
+
|
|
20
|
+
# Embodiments: launch a world YOU drive (no agent in it), watch it, control it.
|
|
21
|
+
with cagi.launch("simulation/warehouse") as world:
|
|
22
|
+
print(world.controls()) # what it accepts right now, with payload schemas
|
|
23
|
+
world.sim.ik(target=[0.3, 0.0, 0.4]) # typed robot/sim control
|
|
24
|
+
jpeg = world.observe(fresh=True) # the next frame, after the move
|
|
25
|
+
# leaving the block stops the world and releases the machine
|
|
26
|
+
|
|
27
|
+
# Anything else: every platform tool by name.
|
|
28
|
+
cagi.call("list_snapshots")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## One surface, generated
|
|
32
|
+
|
|
33
|
+
This SDK, the TypeScript SDK (`npm i commandagi`) and the `commandagi` CLI all come from **one
|
|
34
|
+
schema**, `commandagi-sdk.schema.json`, so they can't drift apart:
|
|
35
|
+
|
|
36
|
+
- **Tools**: `cagi.threads`, `cagi.embodiments`, `cagi.memory`, `cagi.integrations`,
|
|
37
|
+
`cagi.social(platform, account)`, `whoami`, `search`, `run` and `post`. Each one is a typed wrapper
|
|
38
|
+
over `call(tool, args)`. Options are passed as keyword arguments, e.g. `snapshot_id=…`, and sent
|
|
39
|
+
over the wire as camelCase (`snapshotId`).
|
|
40
|
+
- **Control vocabularies** on a live `Session`:
|
|
41
|
+
- `session.desktop` for computers: `click`, `double_click`, `move`, `scroll`, `type`, `key`, `wait`
|
|
42
|
+
- `session.robot` for physical robots: `joint`, `gripper`, `move`, `turn`, `home`, `stop`, …
|
|
43
|
+
- `session.sim` for simulated worlds: `reset`, `sim_mode`, `ctrl`, `actuator`, `ik`,
|
|
44
|
+
`trajectory`, `grab`, `force`, `add_robot`, …
|
|
45
|
+
|
|
46
|
+
Every method sends one action to that embodiment. The platform checks it against the controls the
|
|
47
|
+
embodiment is currently declaring, which `session.controls()` lists along with their payload
|
|
48
|
+
schemas. For anything a runtime declares that no vocabulary covers, use `session.act(action,
|
|
49
|
+
payload)`.
|
|
50
|
+
|
|
51
|
+
The generated part is `commandagi/_generated.py`. Don't edit it: it is regenerated from the schema in
|
|
52
|
+
the CommandAGI monorepo.
|
|
53
|
+
|
|
54
|
+
## Sessions
|
|
55
|
+
|
|
56
|
+
| | |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `cagi.launch(snapshot_id, title=, wait=True, timeout=600)` | a new agentless thread running that snapshot; waits until it declares controls |
|
|
59
|
+
| `cagi.session(thread_id, embodiment_id)` | attach to an embodiment that already exists |
|
|
60
|
+
| `session.frame(fresh=False)` / `observe()` / `observe_array()` / `frames()` | the latest frame, as `{url, channel_id, at}`, image bytes, or a numpy array (`pip install "commandagi[vision]"`); `frames()` yields each new one |
|
|
61
|
+
| `session.describe()` | the live world a sim or robot runtime reports |
|
|
62
|
+
| `session.close()` / `stop()` | stop watching / also stop a world this session launched |
|
|
63
|
+
|
|
64
|
+
Snapshot ids come from `cagi.call("list_snapshots")`, e.g. `simulation/warehouse` or
|
|
65
|
+
`computer/software-engineer`.
|
|
66
|
+
|
|
67
|
+
## Reinforcement learning
|
|
68
|
+
|
|
69
|
+
`commandagi.gym_env.CommandAGIEnv` wraps a sim session as a Gymnasium env (`pip install
|
|
70
|
+
"commandagi[gym]"`), and `commandagi.lerobot` records rollouts as LeRobot datasets (`pip install
|
|
71
|
+
"commandagi[lerobot]"`).
|
|
72
|
+
|
|
73
|
+
## Environment
|
|
74
|
+
|
|
75
|
+
| variable | meaning |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `COMMANDAGI_API_KEY` | your `cagi_…` key. Its scopes decide what every call may do |
|
|
78
|
+
| `COMMANDAGI_BASE_URL` | API origin (default `https://api.commandagi.com`) |
|
|
79
|
+
| `COMMANDAGI_THREAD_ID` | default thread for self-thread methods. Set automatically when your code runs inside the platform |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""CommandAGI — the Python SDK.
|
|
2
|
+
|
|
3
|
+
Drive the whole platform as code: agent threads, memory, integrations — and live embodiments
|
|
4
|
+
(computers, robots, simulated worlds) you watch and control.
|
|
5
|
+
|
|
6
|
+
from commandagi import CommandAGI
|
|
7
|
+
|
|
8
|
+
cagi = CommandAGI() # reads COMMANDAGI_API_KEY
|
|
9
|
+
cagi.threads.create(intent="Summarise this week's robotics news")
|
|
10
|
+
|
|
11
|
+
with cagi.launch("simulation/warehouse") as world: # a world YOU drive (no agent)
|
|
12
|
+
world.sim.ik(target=[0.3, 0.0, 0.4])
|
|
13
|
+
jpeg = world.observe(fresh=True)
|
|
14
|
+
|
|
15
|
+
The typed surface is generated from the CommandAGI SDK schema (``commandagi-sdk.schema.json``),
|
|
16
|
+
identically for every language; ``call(tool, args)`` reaches any tool.
|
|
17
|
+
"""
|
|
18
|
+
from ._generated import (
|
|
19
|
+
DEFAULT_BASE_URL,
|
|
20
|
+
ENV_API_KEY,
|
|
21
|
+
ENV_BASE_URL,
|
|
22
|
+
ENV_THREAD_ID,
|
|
23
|
+
SDK_SCHEMA,
|
|
24
|
+
DesktopControls,
|
|
25
|
+
RobotControls,
|
|
26
|
+
SimControls,
|
|
27
|
+
)
|
|
28
|
+
from .client import CommandAGI, CommandAGIError, Session
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"CommandAGI",
|
|
32
|
+
"CommandAGIError",
|
|
33
|
+
"Session",
|
|
34
|
+
"DesktopControls",
|
|
35
|
+
"RobotControls",
|
|
36
|
+
"SimControls",
|
|
37
|
+
"SDK_SCHEMA",
|
|
38
|
+
"ENV_API_KEY",
|
|
39
|
+
"ENV_BASE_URL",
|
|
40
|
+
"ENV_THREAD_ID",
|
|
41
|
+
"DEFAULT_BASE_URL",
|
|
42
|
+
]
|
|
43
|
+
__version__ = "0.4.0"
|