vectros-sdk 2.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Vectros authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: vectros-sdk
3
+ Version: 2.0.0
4
+ Summary: Build AI agents that run on the AIOS kernel (Vectros OS)
5
+ Author: The Vectros authors
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/vectros/vectros-sdk
8
+ Project-URL: Issues, https://github.com/vectros/vectros-sdk/issues
9
+ Keywords: agents,llm,aios,kernel,vectros
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ # Vectros SDK
27
+
28
+ Build AI agents that run on the AIOS kernel (`aios.ko`) in a few lines, then
29
+ deploy them to a Vectros OS host.
30
+
31
+ ```python
32
+ from vectros import Agent, tool
33
+
34
+ @tool
35
+ def weather(city: str) -> str:
36
+ """Current weather for a city."""
37
+ return f"{city}: 31 C, clear sky"
38
+
39
+ agent = Agent("helper", tools=[weather])
40
+ print(agent.run("What is the weather in Pune?"))
41
+ ```
42
+
43
+ The SDK registers the agent with the kernel, sets up its cores, runs the tool
44
+ loop, streams output, emits traces and unregisters the agent at exit.
45
+
46
+ ## What the kernel gives every agent
47
+
48
+ - **Scheduling and quotas.** Every model call is an AIOS LLM syscall. The kernel
49
+ queues it fairly with other agents and enforces per-agent limits.
50
+ - **Model allowlist.** `model=` must be on the administrator's allowlist.
51
+ - **Tool control.** Every tool call is a kernel syscall, including your own
52
+ `@tool` functions. The kernel checks permission, applies the deadline and
53
+ records the call.
54
+ - **Approvals.** Kernel tools flagged as side-effecting, and `@tool(approval=True)`
55
+ functions, are held until the owner approves them, through `approve=` or in
56
+ AIOS Manager.
57
+ - **Stable identity.** The agent ID comes from your UID and the agent name.
58
+ Only one agent with that name runs per user, and its storage survives
59
+ restarts.
60
+ - **Tracing.** When the administrator enables tracing for the agent
61
+ (`sudo aiosctl trace enable <agent-id>`), runs appear in AIOS Trace with
62
+ kernel queue and lease timings. Tracing is off by default.
63
+ - **Storage.** `agent.storage` is private, versioned and quota-limited.
64
+
65
+ The SDK needs `aios.ko` loaded and `libaios.so` installed. There is no
66
+ userspace fallback. Without the kernel, the SDK raises `KernelUnavailable`.
67
+
68
+ ## Requirements
69
+
70
+ - Python 3.11 or later
71
+ - `aios.ko` loaded, with the LLM worker running. Storage and kernel tools also
72
+ need the storage and tool workers.
73
+ - Your user in the `aios` group
74
+ - `libaios.so` in `/usr/lib`, or its path in `VECTROS_LIBAIOS`
75
+
76
+ ```sh
77
+ pip install vectros-sdk
78
+ ```
79
+
80
+ The package installs as `vectros-sdk` and imports as `vectros`. On Vectros OS
81
+ it is preinstalled as the `python-vectros` package.
82
+
83
+ ## Agent
84
+
85
+ ```python
86
+ Agent(
87
+ name, # shown in AIOS Manager and Trace
88
+ model=None, # default: the LLM worker's model
89
+ tools=[], # @tool functions and/or kernel tool names
90
+ system=None, # system prompt
91
+ session=None, # keep the conversation across runs and restarts
92
+ max_steps=10, # maximum model calls per run
93
+ approve=None, # approve(tool_name, args) -> bool
94
+ timeout=120, # seconds per model or tool call
95
+ tool_protocol="native", # or "json" for models without function calling
96
+ )
97
+ ```
98
+
99
+ | Call | Result |
100
+ | --- | --- |
101
+ | `agent.run(prompt)` | Final answer as `str` |
102
+ | `agent.stream(prompt)` | `Event`s: `token`, `tool_call`, `tool_result`, `answer` |
103
+ | `agent.storage.write(path, data)` / `.read(path)` | Kernel storage |
104
+ | `agent.reset()` | Forget the session |
105
+ | `agent.close()` or `with Agent(...)` | Unregister now, not at exit |
106
+
107
+ ```python
108
+ for event in agent.stream("Plan my day"):
109
+ if event.kind == "token":
110
+ print(event.data, end="")
111
+ ```
112
+
113
+ ## Tools
114
+
115
+ ```python
116
+ @tool
117
+ def search(query: str, limit: int = 5) -> list[str]:
118
+ """Search the docs.
119
+
120
+ Args:
121
+ query: What to look for.
122
+ """
123
+
124
+ @tool(approval=True) # runs only if approve() returns True
125
+ def send_email(to: str, body: str) -> str: ...
126
+
127
+ agent = Agent("ops", tools=[search, send_email, "search_web"], approve=ask_terminal)
128
+ ```
129
+
130
+ - The SDK builds the parameter schema from type hints, and descriptions from
131
+ the docstring and its `Args:` section.
132
+ - A string names a tool registered in the kernel, for example an admin tool or
133
+ an MCP tool such as `github__create_issue`. These run in the AIOS tool worker.
134
+ - `@tool` functions run in the agent's own process. Each call is first
135
+ submitted as a kernel client tool call (ABI 4.3). The function runs only
136
+ after the kernel hands the call back, which can be after owner approval.
137
+ - When a tool raises an error, the error goes back to the model, and the model
138
+ can try again.
139
+ - Tool calls use the model's native function calling. For models without
140
+ function calling, set `tool_protocol="json"`: the agent then asks for JSON
141
+ replies.
142
+
143
+ ## Sessions
144
+
145
+ ```python
146
+ agent = Agent("support", session="customer-42")
147
+ ```
148
+
149
+ History is stored in `$XDG_STATE_HOME/vectros/sessions/<agent>/<session>.json`
150
+ and survives restarts. Only user prompts and final answers are kept, up to 40
151
+ messages.
152
+
153
+ ## CLI
154
+
155
+ ```sh
156
+ vectros init helper # helper/vectros.toml + helper/agent.py
157
+ cd helper
158
+ vectros chat # interactive; or: vectros chat "one question"
159
+ vectros run # run the entry script
160
+ vectros deploy me@host # deploy to a Vectros OS host
161
+ vectros logs -f # follow the deployed agent's journal
162
+ vectros status
163
+ vectros stop
164
+ ```
165
+
166
+ `vectros.toml`:
167
+
168
+ ```toml
169
+ [agent]
170
+ name = "helper"
171
+ entry = "agent.py" # script run by `vectros run` and by the service
172
+ object = "agent" # Agent variable used by `vectros chat`
173
+
174
+ [deploy]
175
+ host = "me@vectros-host"
176
+ ```
177
+
178
+ `vectros deploy` does the following:
179
+
180
+ 1. Checks that the host has `/dev/aios` and the `vectros` package.
181
+ 2. Copies the project with rsync to `~/.local/share/vectros/agents/<name>`.
182
+ 3. Creates a venv with system site packages and installs `requirements.txt`
183
+ if the project has one.
184
+ 4. Starts the systemd user service `vectros-agent@<name>`, which runs
185
+ `python -m vectros run`.
186
+
187
+ To keep the agent running after you log out, run `loginctl enable-linger` on
188
+ the host.
189
+
190
+ ## Tests
191
+
192
+ ```sh
193
+ pytest # unit tests, fake kernel
194
+ VECTROS_E2E=1 pytest -m kernel # real aios.ko and workers
195
+ ```
196
+
197
+ ## Kernel versions
198
+
199
+ The SDK needs ABI 4. Kernels before 4.3 still work with these limits:
200
+
201
+ - Agent IDs are random, so `agent.storage` data is not readable after a restart.
202
+ - `@tool` functions run in-process without kernel mediation. The SDK enforces
203
+ `approval=True` itself and denies the call when no `approve=` is set.
204
+
205
+ ## Limits
206
+
207
+ - The kernel sees that a `@tool` function ran, but it cannot see what the
208
+ function does inside the agent process.
209
+ - Sessions are local files on the host, not kernel storage. Kernel storage
210
+ files are limited to 64 KiB.
211
+ - Native tool calls need the LLM worker that returns the tool envelope
212
+ (vectros-kernel with ABI 4.3). An older worker returns plain text, so the
213
+ agent treats the reply as the final answer.
@@ -0,0 +1,188 @@
1
+ # Vectros SDK
2
+
3
+ Build AI agents that run on the AIOS kernel (`aios.ko`) in a few lines, then
4
+ deploy them to a Vectros OS host.
5
+
6
+ ```python
7
+ from vectros import Agent, tool
8
+
9
+ @tool
10
+ def weather(city: str) -> str:
11
+ """Current weather for a city."""
12
+ return f"{city}: 31 C, clear sky"
13
+
14
+ agent = Agent("helper", tools=[weather])
15
+ print(agent.run("What is the weather in Pune?"))
16
+ ```
17
+
18
+ The SDK registers the agent with the kernel, sets up its cores, runs the tool
19
+ loop, streams output, emits traces and unregisters the agent at exit.
20
+
21
+ ## What the kernel gives every agent
22
+
23
+ - **Scheduling and quotas.** Every model call is an AIOS LLM syscall. The kernel
24
+ queues it fairly with other agents and enforces per-agent limits.
25
+ - **Model allowlist.** `model=` must be on the administrator's allowlist.
26
+ - **Tool control.** Every tool call is a kernel syscall, including your own
27
+ `@tool` functions. The kernel checks permission, applies the deadline and
28
+ records the call.
29
+ - **Approvals.** Kernel tools flagged as side-effecting, and `@tool(approval=True)`
30
+ functions, are held until the owner approves them, through `approve=` or in
31
+ AIOS Manager.
32
+ - **Stable identity.** The agent ID comes from your UID and the agent name.
33
+ Only one agent with that name runs per user, and its storage survives
34
+ restarts.
35
+ - **Tracing.** When the administrator enables tracing for the agent
36
+ (`sudo aiosctl trace enable <agent-id>`), runs appear in AIOS Trace with
37
+ kernel queue and lease timings. Tracing is off by default.
38
+ - **Storage.** `agent.storage` is private, versioned and quota-limited.
39
+
40
+ The SDK needs `aios.ko` loaded and `libaios.so` installed. There is no
41
+ userspace fallback. Without the kernel, the SDK raises `KernelUnavailable`.
42
+
43
+ ## Requirements
44
+
45
+ - Python 3.11 or later
46
+ - `aios.ko` loaded, with the LLM worker running. Storage and kernel tools also
47
+ need the storage and tool workers.
48
+ - Your user in the `aios` group
49
+ - `libaios.so` in `/usr/lib`, or its path in `VECTROS_LIBAIOS`
50
+
51
+ ```sh
52
+ pip install vectros-sdk
53
+ ```
54
+
55
+ The package installs as `vectros-sdk` and imports as `vectros`. On Vectros OS
56
+ it is preinstalled as the `python-vectros` package.
57
+
58
+ ## Agent
59
+
60
+ ```python
61
+ Agent(
62
+ name, # shown in AIOS Manager and Trace
63
+ model=None, # default: the LLM worker's model
64
+ tools=[], # @tool functions and/or kernel tool names
65
+ system=None, # system prompt
66
+ session=None, # keep the conversation across runs and restarts
67
+ max_steps=10, # maximum model calls per run
68
+ approve=None, # approve(tool_name, args) -> bool
69
+ timeout=120, # seconds per model or tool call
70
+ tool_protocol="native", # or "json" for models without function calling
71
+ )
72
+ ```
73
+
74
+ | Call | Result |
75
+ | --- | --- |
76
+ | `agent.run(prompt)` | Final answer as `str` |
77
+ | `agent.stream(prompt)` | `Event`s: `token`, `tool_call`, `tool_result`, `answer` |
78
+ | `agent.storage.write(path, data)` / `.read(path)` | Kernel storage |
79
+ | `agent.reset()` | Forget the session |
80
+ | `agent.close()` or `with Agent(...)` | Unregister now, not at exit |
81
+
82
+ ```python
83
+ for event in agent.stream("Plan my day"):
84
+ if event.kind == "token":
85
+ print(event.data, end="")
86
+ ```
87
+
88
+ ## Tools
89
+
90
+ ```python
91
+ @tool
92
+ def search(query: str, limit: int = 5) -> list[str]:
93
+ """Search the docs.
94
+
95
+ Args:
96
+ query: What to look for.
97
+ """
98
+
99
+ @tool(approval=True) # runs only if approve() returns True
100
+ def send_email(to: str, body: str) -> str: ...
101
+
102
+ agent = Agent("ops", tools=[search, send_email, "search_web"], approve=ask_terminal)
103
+ ```
104
+
105
+ - The SDK builds the parameter schema from type hints, and descriptions from
106
+ the docstring and its `Args:` section.
107
+ - A string names a tool registered in the kernel, for example an admin tool or
108
+ an MCP tool such as `github__create_issue`. These run in the AIOS tool worker.
109
+ - `@tool` functions run in the agent's own process. Each call is first
110
+ submitted as a kernel client tool call (ABI 4.3). The function runs only
111
+ after the kernel hands the call back, which can be after owner approval.
112
+ - When a tool raises an error, the error goes back to the model, and the model
113
+ can try again.
114
+ - Tool calls use the model's native function calling. For models without
115
+ function calling, set `tool_protocol="json"`: the agent then asks for JSON
116
+ replies.
117
+
118
+ ## Sessions
119
+
120
+ ```python
121
+ agent = Agent("support", session="customer-42")
122
+ ```
123
+
124
+ History is stored in `$XDG_STATE_HOME/vectros/sessions/<agent>/<session>.json`
125
+ and survives restarts. Only user prompts and final answers are kept, up to 40
126
+ messages.
127
+
128
+ ## CLI
129
+
130
+ ```sh
131
+ vectros init helper # helper/vectros.toml + helper/agent.py
132
+ cd helper
133
+ vectros chat # interactive; or: vectros chat "one question"
134
+ vectros run # run the entry script
135
+ vectros deploy me@host # deploy to a Vectros OS host
136
+ vectros logs -f # follow the deployed agent's journal
137
+ vectros status
138
+ vectros stop
139
+ ```
140
+
141
+ `vectros.toml`:
142
+
143
+ ```toml
144
+ [agent]
145
+ name = "helper"
146
+ entry = "agent.py" # script run by `vectros run` and by the service
147
+ object = "agent" # Agent variable used by `vectros chat`
148
+
149
+ [deploy]
150
+ host = "me@vectros-host"
151
+ ```
152
+
153
+ `vectros deploy` does the following:
154
+
155
+ 1. Checks that the host has `/dev/aios` and the `vectros` package.
156
+ 2. Copies the project with rsync to `~/.local/share/vectros/agents/<name>`.
157
+ 3. Creates a venv with system site packages and installs `requirements.txt`
158
+ if the project has one.
159
+ 4. Starts the systemd user service `vectros-agent@<name>`, which runs
160
+ `python -m vectros run`.
161
+
162
+ To keep the agent running after you log out, run `loginctl enable-linger` on
163
+ the host.
164
+
165
+ ## Tests
166
+
167
+ ```sh
168
+ pytest # unit tests, fake kernel
169
+ VECTROS_E2E=1 pytest -m kernel # real aios.ko and workers
170
+ ```
171
+
172
+ ## Kernel versions
173
+
174
+ The SDK needs ABI 4. Kernels before 4.3 still work with these limits:
175
+
176
+ - Agent IDs are random, so `agent.storage` data is not readable after a restart.
177
+ - `@tool` functions run in-process without kernel mediation. The SDK enforces
178
+ `approval=True` itself and denies the call when no `approve=` is set.
179
+
180
+ ## Limits
181
+
182
+ - The kernel sees that a `@tool` function ran, but it cannot see what the
183
+ function does inside the agent process.
184
+ - Sessions are local files on the host, not kernel storage. Kernel storage
185
+ files are limited to 64 KiB.
186
+ - Native tool calls need the LLM worker that returns the tool envelope
187
+ (vectros-kernel with ABI 4.3). An older worker returns plain text, so the
188
+ agent treats the reply as the final answer.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ # The import package is `vectros`; the PyPI name "vectros" belongs to an
7
+ # unrelated project.
8
+ name = "vectros-sdk"
9
+ version = "2.0.0"
10
+ description = "Build AI agents that run on the AIOS kernel (Vectros OS)"
11
+ readme = "README.md"
12
+ requires-python = ">=3.11"
13
+ license = "MIT"
14
+ license-files = ["LICENSE"]
15
+ authors = [{ name = "The Vectros authors" }]
16
+ keywords = ["agents", "llm", "aios", "kernel", "vectros"]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: POSIX :: Linux",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Topic :: Software Development :: Libraries",
27
+ ]
28
+ dependencies = []
29
+
30
+ [project.urls]
31
+ Repository = "https://github.com/vectros/vectros-sdk"
32
+ Issues = "https://github.com/vectros/vectros-sdk/issues"
33
+
34
+ [project.optional-dependencies]
35
+ dev = ["pytest>=7.0"]
36
+
37
+ [project.scripts]
38
+ vectros = "vectros.cli:main"
39
+
40
+ [tool.setuptools.packages.find]
41
+ include = ["vectros*"]
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
45
+ pythonpath = ["."]
46
+ markers = ["kernel: needs a loaded aios.ko, libaios.so and running workers"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+