aios-runtime 0.1.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.
- aios_runtime-0.1.0/.github/workflows/ci.yml +68 -0
- aios_runtime-0.1.0/.github/workflows/publish.yml +85 -0
- aios_runtime-0.1.0/.gitignore +15 -0
- aios_runtime-0.1.0/.vscode/settings.json +1 -0
- aios_runtime-0.1.0/CHANGELOG.md +101 -0
- aios_runtime-0.1.0/CONTRIBUTING.md +112 -0
- aios_runtime-0.1.0/LICENSE +21 -0
- aios_runtime-0.1.0/PKG-INFO +320 -0
- aios_runtime-0.1.0/README.md +284 -0
- aios_runtime-0.1.0/aios/__init__.py +21 -0
- aios_runtime-0.1.0/aios/agent.py +282 -0
- aios_runtime-0.1.0/aios/cli/__init__.py +0 -0
- aios_runtime-0.1.0/aios/cli/main.py +505 -0
- aios_runtime-0.1.0/aios/cli/templates.py +56 -0
- aios_runtime-0.1.0/aios/config.py +83 -0
- aios_runtime-0.1.0/aios/identity/__init__.py +3 -0
- aios_runtime-0.1.0/aios/identity/core.py +107 -0
- aios_runtime-0.1.0/aios/memory/__init__.py +3 -0
- aios_runtime-0.1.0/aios/memory/store.py +120 -0
- aios_runtime-0.1.0/aios/models/__init__.py +3 -0
- aios_runtime-0.1.0/aios/models/router.py +96 -0
- aios_runtime-0.1.0/aios/runtime/__init__.py +4 -0
- aios_runtime-0.1.0/aios/runtime/checkpoint.py +138 -0
- aios_runtime-0.1.0/aios/runtime/process.py +97 -0
- aios_runtime-0.1.0/aios/scheduling.py +90 -0
- aios_runtime-0.1.0/aios/tools/__init__.py +3 -0
- aios_runtime-0.1.0/aios/tools/builtin/__init__.py +27 -0
- aios_runtime-0.1.0/aios/tools/builtin/filesystem.py +115 -0
- aios_runtime-0.1.0/aios/tools/builtin/github.py +215 -0
- aios_runtime-0.1.0/aios/tools/builtin/http.py +88 -0
- aios_runtime-0.1.0/aios/tools/builtin/shell.py +108 -0
- aios_runtime-0.1.0/aios/tools/builtin/web.py +89 -0
- aios_runtime-0.1.0/aios/tools/registry.py +111 -0
- aios_runtime-0.1.0/aios/web/__init__.py +3 -0
- aios_runtime-0.1.0/aios/web/app.py +318 -0
- aios_runtime-0.1.0/examples/coder.py +156 -0
- aios_runtime-0.1.0/examples/monitor.py +79 -0
- aios_runtime-0.1.0/examples/researcher.py +126 -0
- aios_runtime-0.1.0/pyproject.toml +70 -0
- aios_runtime-0.1.0/tests/__init__.py +0 -0
- aios_runtime-0.1.0/tests/conftest.py +13 -0
- aios_runtime-0.1.0/tests/test_agent.py +165 -0
- aios_runtime-0.1.0/tests/test_builtin_tools.py +202 -0
- aios_runtime-0.1.0/tests/test_checkpoint.py +90 -0
- aios_runtime-0.1.0/tests/test_memory.py +78 -0
- aios_runtime-0.1.0/tests/test_tools.py +80 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
cache: pip
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest tests/ -v --tb=short
|
|
32
|
+
|
|
33
|
+
lint:
|
|
34
|
+
name: Lint
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
|
|
39
|
+
- uses: actions/setup-python@v5
|
|
40
|
+
with:
|
|
41
|
+
python-version: "3.11"
|
|
42
|
+
cache: pip
|
|
43
|
+
|
|
44
|
+
- name: Install ruff
|
|
45
|
+
run: pip install ruff
|
|
46
|
+
|
|
47
|
+
- name: Ruff check
|
|
48
|
+
run: ruff check aios/
|
|
49
|
+
|
|
50
|
+
- name: Ruff format check
|
|
51
|
+
run: ruff format --check aios/
|
|
52
|
+
|
|
53
|
+
typecheck:
|
|
54
|
+
name: Type check
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v4
|
|
58
|
+
|
|
59
|
+
- uses: actions/setup-python@v5
|
|
60
|
+
with:
|
|
61
|
+
python-version: "3.11"
|
|
62
|
+
cache: pip
|
|
63
|
+
|
|
64
|
+
- name: Install dependencies
|
|
65
|
+
run: pip install -e ".[dev]" mypy
|
|
66
|
+
|
|
67
|
+
- name: mypy
|
|
68
|
+
run: mypy aios/ --ignore-missing-imports
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build distribution
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.11"
|
|
18
|
+
|
|
19
|
+
- name: Install build tools
|
|
20
|
+
run: pip install build twine
|
|
21
|
+
|
|
22
|
+
- name: Build wheel and sdist
|
|
23
|
+
run: python -m build
|
|
24
|
+
|
|
25
|
+
- name: Check dist
|
|
26
|
+
run: twine check dist/*
|
|
27
|
+
|
|
28
|
+
- name: Upload artifacts
|
|
29
|
+
uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
|
|
34
|
+
publish-pypi:
|
|
35
|
+
name: Publish to PyPI
|
|
36
|
+
needs: build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: pypi
|
|
40
|
+
url: https://pypi.org/project/aios-runtime/
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write # OIDC trusted publishing — no API token needed
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download artifacts
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
|
|
51
|
+
- name: Publish to PyPI
|
|
52
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
53
|
+
|
|
54
|
+
publish-github:
|
|
55
|
+
name: Create GitHub Release
|
|
56
|
+
needs: build
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
permissions:
|
|
59
|
+
contents: write
|
|
60
|
+
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- name: Download artifacts
|
|
65
|
+
uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: dist
|
|
68
|
+
path: dist/
|
|
69
|
+
|
|
70
|
+
- name: Extract changelog entry
|
|
71
|
+
id: changelog
|
|
72
|
+
run: |
|
|
73
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
74
|
+
NOTES=$(awk "/## \[$VERSION\]/,/## \[/" CHANGELOG.md | head -n -1 | tail -n +2)
|
|
75
|
+
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
|
76
|
+
echo "$NOTES" >> $GITHUB_OUTPUT
|
|
77
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
78
|
+
|
|
79
|
+
- name: Create release
|
|
80
|
+
uses: softprops/action-gh-release@v2
|
|
81
|
+
with:
|
|
82
|
+
body: ${{ steps.changelog.outputs.notes }}
|
|
83
|
+
files: dist/*
|
|
84
|
+
draft: false
|
|
85
|
+
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Ai.os are documented here.
|
|
4
|
+
Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
5
|
+
Versioning: [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
### Planned
|
|
12
|
+
- Built-in GitHub tool mixin (repos, issues, PRs, search)
|
|
13
|
+
- Built-in Postgres tool mixin (query, insert, schema inspection)
|
|
14
|
+
- Built-in Slack tool mixin (send message, read channel)
|
|
15
|
+
- TypeScript SDK
|
|
16
|
+
- `aios deploy` — self-hosted cloud deployment
|
|
17
|
+
- Visual workflow builder
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## [0.1.0] — 2026-06-28
|
|
22
|
+
|
|
23
|
+
First public release.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
**Core runtime**
|
|
28
|
+
- `Agent` base class — persistent identity, memory, tools, crash recovery in one class
|
|
29
|
+
- `@tool` decorator — schema inferred automatically from type hints and docstrings
|
|
30
|
+
- `@schedule("every Xh")` decorator — agent repeats on a cron/interval, survives restarts
|
|
31
|
+
- `Agent.think()` — single-shot LLM call
|
|
32
|
+
- `Agent.think_with_tools()` — agentic loop, LLM selects and calls tools until done
|
|
33
|
+
- `Agent.call_agent()` — blocking call to another agent class, returns text
|
|
34
|
+
- `Agent.spawn_agent()` — fire-and-forget agent in background task
|
|
35
|
+
- `Agent.on_start()` / `Agent.on_stop()` — lifecycle hooks
|
|
36
|
+
- `Agent.launch()` — entry point, auto-loads `.env`, validates API key
|
|
37
|
+
|
|
38
|
+
**Checkpoint engine** (`aios/runtime/checkpoint.py`)
|
|
39
|
+
- Caches tool call results by `(run_id, tool_name, args_hash)` in SQLite
|
|
40
|
+
- On restart, `run()` re-executes but completed tool calls replay from cache instantly
|
|
41
|
+
- Agent fast-forwards to the first uncompleted call and continues from there
|
|
42
|
+
- No manual checkpoints required
|
|
43
|
+
|
|
44
|
+
**Memory** (`aios/memory/store.py`)
|
|
45
|
+
- Short-term: in-process key/value, cleared each run
|
|
46
|
+
- Long-term: SQLite-persisted key/value, survives forever
|
|
47
|
+
- Timeline: append-only event log per agent
|
|
48
|
+
|
|
49
|
+
**Identity** (`aios/identity/core.py`)
|
|
50
|
+
- Persistent UUID per agent name — same agent, same ID across restarts
|
|
51
|
+
- Tracks name, model, version, config
|
|
52
|
+
|
|
53
|
+
**Model router** (`aios/models/router.py`)
|
|
54
|
+
- Any model in one line: Claude, GPT-4o, Gemini, Mistral, Ollama
|
|
55
|
+
- Powered by [litellm](https://github.com/BerriAI/litellm)
|
|
56
|
+
- Streaming support via `ModelRouter.stream()`
|
|
57
|
+
|
|
58
|
+
**Built-in tool mixins** (`aios/tools/builtin/`)
|
|
59
|
+
- `WebSearchMixin` — `web_search()` (DuckDuckGo, no key), `fetch_url()` with HTML stripping
|
|
60
|
+
- `FilesystemMixin` — `read_file()`, `write_file()`, `list_directory()`, `delete_file()`, `file_exists()` with cwd sandboxing
|
|
61
|
+
- `ShellMixin` — `run_command()` (allowlist support), `run_python()` with timeout
|
|
62
|
+
- `HttpMixin` — `http_get()`, `http_post()`, `http_put()`, `http_delete()`
|
|
63
|
+
|
|
64
|
+
**CLI** (`aios` command)
|
|
65
|
+
- `aios init [name]` — scaffold new agent project
|
|
66
|
+
- `aios run <file>` — run agent (foreground, `--detach`, `--watch`)
|
|
67
|
+
- `aios list` — list all agents with status
|
|
68
|
+
- `aios status <name>` — status + run history
|
|
69
|
+
- `aios logs <name>` — show logs (`-f` to follow, cross-platform)
|
|
70
|
+
- `aios stop <name>` — stop agent
|
|
71
|
+
- `aios restart <name>` — stop + restart (resumes from checkpoint)
|
|
72
|
+
- `aios memory <name>` — inspect long-term memory
|
|
73
|
+
- `aios ui` — open web dashboard
|
|
74
|
+
- `aios version` — show version
|
|
75
|
+
|
|
76
|
+
**Web UI** (`aios/web/`)
|
|
77
|
+
- FastAPI backend with SSE log streaming
|
|
78
|
+
- Live dashboard: running agents, logs, memory inspector, run history
|
|
79
|
+
- Auto-refreshes every 5 seconds
|
|
80
|
+
|
|
81
|
+
**Config** (`aios/config.py`)
|
|
82
|
+
- Auto-discovers and loads `.env` from cwd upward
|
|
83
|
+
- Validates API key for the configured model on startup
|
|
84
|
+
- Clear error messages with setup instructions when keys are missing
|
|
85
|
+
|
|
86
|
+
**Testing**
|
|
87
|
+
- 54 tests across 5 test files
|
|
88
|
+
- `pytest-asyncio` for async tests
|
|
89
|
+
- Covers: memory store, checkpoint engine (including crash-resume), tool registry, agent lifecycle, built-in tools, scheduling, config
|
|
90
|
+
|
|
91
|
+
**Project**
|
|
92
|
+
- `pyproject.toml` with hatchling build, ruff, mypy config
|
|
93
|
+
- GitHub Actions CI: test (3.10/3.11/3.12), lint (ruff), type check (mypy)
|
|
94
|
+
- `CONTRIBUTING.md` with dev setup, commit conventions, testing guide
|
|
95
|
+
- `.env.example` with all supported variables
|
|
96
|
+
- MIT license
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
[Unreleased]: https://github.com/aios-runtime/aios/compare/v0.1.0...HEAD
|
|
101
|
+
[0.1.0]: https://github.com/aios-runtime/aios/releases/tag/v0.1.0
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Contributing to Ai.os
|
|
2
|
+
|
|
3
|
+
Thank you for contributing. This document covers everything you need to go from zero to a merged pull request.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/aios-runtime/aios
|
|
9
|
+
cd aios
|
|
10
|
+
python -m venv .venv
|
|
11
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
12
|
+
pip install -e ".[dev]"
|
|
13
|
+
cp .env.example .env # add your API key
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Verify everything works:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pytest tests/ # 37 tests, all green
|
|
20
|
+
ruff check aios/ # no lint errors
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Project structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
aios/
|
|
27
|
+
agent.py Base Agent class — the core API
|
|
28
|
+
config.py .env loading, API key validation
|
|
29
|
+
scheduling.py @schedule decorator
|
|
30
|
+
identity/ Persistent agent UUID and config
|
|
31
|
+
memory/ Short-term + long-term SQLite memory
|
|
32
|
+
models/ litellm model router
|
|
33
|
+
runtime/ Checkpoint engine + process manager
|
|
34
|
+
tools/ @tool decorator and registry
|
|
35
|
+
web/ FastAPI dashboard
|
|
36
|
+
cli/ Typer CLI (aios run/list/logs/…)
|
|
37
|
+
tests/
|
|
38
|
+
examples/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Making changes
|
|
42
|
+
|
|
43
|
+
1. Fork the repo and create a branch: `git checkout -b feat/your-feature`
|
|
44
|
+
2. Write your code. Write tests for it.
|
|
45
|
+
3. Run `pytest tests/` — all tests must pass.
|
|
46
|
+
4. Run `ruff check aios/ && ruff format aios/` — no lint errors.
|
|
47
|
+
5. Open a pull request against `main`.
|
|
48
|
+
|
|
49
|
+
## Commit conventions
|
|
50
|
+
|
|
51
|
+
Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
feat: add @schedule decorator
|
|
55
|
+
fix: agent crash on empty tool response
|
|
56
|
+
docs: add multi-agent example
|
|
57
|
+
test: cover checkpoint resume semantics
|
|
58
|
+
refactor: simplify tool schema inference
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Keep subject lines under 72 characters. No period at the end.
|
|
62
|
+
|
|
63
|
+
## Writing tests
|
|
64
|
+
|
|
65
|
+
Tests live in `tests/`. All tests are async-friendly via `pytest-asyncio`.
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
async def test_my_feature(tmp_path: Path) -> None:
|
|
69
|
+
store = MemoryStore(agent_id="test-001", db_path=tmp_path / "test.db")
|
|
70
|
+
await store.setup()
|
|
71
|
+
await store.save("key", "value")
|
|
72
|
+
assert await store.load("key") == "value"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Rules:
|
|
76
|
+
- Every new feature needs at least one test.
|
|
77
|
+
- Every bug fix needs a regression test.
|
|
78
|
+
- Use `tmp_path` for all file I/O — never write to real `~/.aios` in tests.
|
|
79
|
+
- Mock LLM calls — never make real API calls in tests.
|
|
80
|
+
|
|
81
|
+
## What we accept
|
|
82
|
+
|
|
83
|
+
**Yes:**
|
|
84
|
+
- Bug fixes with regression tests
|
|
85
|
+
- Performance improvements with benchmarks
|
|
86
|
+
- New built-in tools (GitHub, Slack, Postgres, S3…)
|
|
87
|
+
- Documentation improvements
|
|
88
|
+
- New example agents
|
|
89
|
+
|
|
90
|
+
**Discuss first (open an issue):**
|
|
91
|
+
- New runtime targets (TypeScript SDK, edge runtime)
|
|
92
|
+
- Breaking changes to the Agent API
|
|
93
|
+
- New CLI commands
|
|
94
|
+
- Web UI changes
|
|
95
|
+
|
|
96
|
+
**Not now:**
|
|
97
|
+
- Visual workflow builder
|
|
98
|
+
- Marketplace
|
|
99
|
+
- Blockchain
|
|
100
|
+
- Mobile runtime
|
|
101
|
+
|
|
102
|
+
## Code style
|
|
103
|
+
|
|
104
|
+
- Python 3.10+, `from __future__ import annotations` in every file
|
|
105
|
+
- Type hints on all public functions
|
|
106
|
+
- No comments that describe *what* the code does — only *why*
|
|
107
|
+
- `ruff` for formatting and linting — run `ruff format aios/` before committing
|
|
108
|
+
- Function names are verbs, class names are nouns
|
|
109
|
+
|
|
110
|
+
## Questions
|
|
111
|
+
|
|
112
|
+
Open an issue or join the Discord. We respond within 24 hours.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ai.os contributors
|
|
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.
|