lite-agent-sdk 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.
- lite_agent_sdk-0.1.0/.github/CODEOWNERS +1 -0
- lite_agent_sdk-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- lite_agent_sdk-0.1.0/.github/dependabot.yml +10 -0
- lite_agent_sdk-0.1.0/.github/workflows/ci.yml +30 -0
- lite_agent_sdk-0.1.0/.github/workflows/release.yml +80 -0
- lite_agent_sdk-0.1.0/.gitignore +224 -0
- lite_agent_sdk-0.1.0/.python-version +1 -0
- lite_agent_sdk-0.1.0/AGENTS.md +131 -0
- lite_agent_sdk-0.1.0/CHANGELOG.md +13 -0
- lite_agent_sdk-0.1.0/LICENSE +21 -0
- lite_agent_sdk-0.1.0/Makefile +19 -0
- lite_agent_sdk-0.1.0/PKG-INFO +81 -0
- lite_agent_sdk-0.1.0/README.md +65 -0
- lite_agent_sdk-0.1.0/docs/lite_agent_sdk_tdd.md +915 -0
- lite_agent_sdk-0.1.0/docs/releasing.md +68 -0
- lite_agent_sdk-0.1.0/docs/structured-output.md +26 -0
- lite_agent_sdk-0.1.0/docs/usage.md +174 -0
- lite_agent_sdk-0.1.0/pyproject.toml +40 -0
- lite_agent_sdk-0.1.0/release-notes.md +7 -0
- lite_agent_sdk-0.1.0/ruff.toml +27 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/__init__.py +41 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/agent.py +562 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/errors.py +19 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/providers/__init__.py +29 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/providers/anthropic_provider.py +332 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/providers/base.py +74 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/providers/openai_provider.py +376 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/tools/__init__.py +4 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/tools/base.py +20 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/tools/decorator.py +143 -0
- lite_agent_sdk-0.1.0/src/lite_agent_sdk/types.py +107 -0
- lite_agent_sdk-0.1.0/tests/__init__.py +0 -0
- lite_agent_sdk-0.1.0/tests/integration/__init__.py +0 -0
- lite_agent_sdk-0.1.0/tests/integration/conftest.py +16 -0
- lite_agent_sdk-0.1.0/tests/integration/test_anthropic_provider.py +96 -0
- lite_agent_sdk-0.1.0/tests/integration/test_openai_provider.py +96 -0
- lite_agent_sdk-0.1.0/tests/unit/__init__.py +0 -0
- lite_agent_sdk-0.1.0/tests/unit/fake_adapter.py +36 -0
- lite_agent_sdk-0.1.0/tests/unit/test_agent.py +558 -0
- lite_agent_sdk-0.1.0/tests/unit/test_anthropic_provider.py +199 -0
- lite_agent_sdk-0.1.0/tests/unit/test_openai_provider.py +212 -0
- lite_agent_sdk-0.1.0/tests/unit/test_tools.py +102 -0
- lite_agent_sdk-0.1.0/tests/unit/test_types.py +107 -0
- lite_agent_sdk-0.1.0/uv.lock +572 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @Zander073
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
ci:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
14
|
+
|
|
15
|
+
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
16
|
+
|
|
17
|
+
- name: Install Python
|
|
18
|
+
run: uv python install 3.13
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: uv sync --group dev
|
|
22
|
+
|
|
23
|
+
- name: Lint
|
|
24
|
+
run: make lint
|
|
25
|
+
|
|
26
|
+
- name: Test
|
|
27
|
+
run: make test
|
|
28
|
+
|
|
29
|
+
- name: Build
|
|
30
|
+
run: uv build
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: pypi
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
17
|
+
|
|
18
|
+
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
|
|
19
|
+
|
|
20
|
+
- name: Install Python
|
|
21
|
+
run: uv python install 3.13
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: uv sync --group dev
|
|
25
|
+
|
|
26
|
+
- name: Check tag and changelog
|
|
27
|
+
run: |
|
|
28
|
+
uv run python - <<'PY'
|
|
29
|
+
import os
|
|
30
|
+
import re
|
|
31
|
+
import tomllib
|
|
32
|
+
from pathlib import Path
|
|
33
|
+
|
|
34
|
+
with open("pyproject.toml", "rb") as handle:
|
|
35
|
+
version = tomllib.load(handle)["project"]["version"]
|
|
36
|
+
tag = os.environ["GITHUB_REF_NAME"].removeprefix("v")
|
|
37
|
+
if tag != version:
|
|
38
|
+
raise SystemExit(f"tag {tag} does not match pyproject version {version}")
|
|
39
|
+
text = Path("CHANGELOG.md").read_text()
|
|
40
|
+
pattern = rf"^## {re.escape(version)}(?: [^\n]+)?\n(.*?)(?=^## |\Z)"
|
|
41
|
+
match = re.search(pattern, text, flags=re.M | re.S)
|
|
42
|
+
if match is None:
|
|
43
|
+
raise SystemExit(f"CHANGELOG.md has no section for {version}")
|
|
44
|
+
Path("release-notes.md").write_text(match.group(1).strip() + "\n")
|
|
45
|
+
PY
|
|
46
|
+
|
|
47
|
+
- name: Lint
|
|
48
|
+
run: make lint
|
|
49
|
+
|
|
50
|
+
- name: Test
|
|
51
|
+
run: make test
|
|
52
|
+
|
|
53
|
+
- name: Build
|
|
54
|
+
run: uv build
|
|
55
|
+
|
|
56
|
+
- name: Publish
|
|
57
|
+
run: uv publish --trusted-publishing always
|
|
58
|
+
|
|
59
|
+
- name: Install from PyPI
|
|
60
|
+
run: |
|
|
61
|
+
version="${GITHUB_REF_NAME#v}"
|
|
62
|
+
for _ in $(seq 1 12); do
|
|
63
|
+
rm -rf /tmp/smoke
|
|
64
|
+
if uv venv --python 3.13 /tmp/smoke \
|
|
65
|
+
&& uv pip install --python /tmp/smoke/bin/python \
|
|
66
|
+
--index-url https://pypi.org/simple \
|
|
67
|
+
"lite-agent-sdk==${version}" \
|
|
68
|
+
&& /tmp/smoke/bin/python -c \
|
|
69
|
+
"import importlib.metadata as meta; assert meta.version('lite-agent-sdk') == '${version}'"; then
|
|
70
|
+
exit 0
|
|
71
|
+
fi
|
|
72
|
+
sleep 10
|
|
73
|
+
done
|
|
74
|
+
echo "lite-agent-sdk==${version} was not installable from PyPI"
|
|
75
|
+
exit 1
|
|
76
|
+
|
|
77
|
+
- name: Create GitHub release
|
|
78
|
+
env:
|
|
79
|
+
GH_TOKEN: ${{ github.token }}
|
|
80
|
+
run: gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file release-notes.md
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
# temp implementation plan
|
|
221
|
+
open_items_to_address.md
|
|
222
|
+
|
|
223
|
+
# live api test script with pasted keys
|
|
224
|
+
scripts/live_test.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Conventions for working in this repo. Applies to humans and any AI
|
|
4
|
+
coding agent making changes here.
|
|
5
|
+
|
|
6
|
+
## Implementation
|
|
7
|
+
|
|
8
|
+
- Target API: `docs/lite_agent_sdk_tdd.md`. Follow the TDD when implementing.
|
|
9
|
+
|
|
10
|
+
## Releases
|
|
11
|
+
|
|
12
|
+
- Version, changelog, and publish steps live in `docs/releasing.md`.
|
|
13
|
+
- Do not tag or publish unless that protocol says to.
|
|
14
|
+
|
|
15
|
+
## Project layout
|
|
16
|
+
|
|
17
|
+
- `src/lite_agent_sdk/` - the package. Import name is `lite_agent_sdk`
|
|
18
|
+
(underscore); the PyPI distribution name is `lite-agent-sdk` (hyphen).
|
|
19
|
+
These are allowed to differ and both are intentional.
|
|
20
|
+
- `src/` layout on purpose: it prevents tests or local scripts from
|
|
21
|
+
silently importing the source tree directly. Every test run goes
|
|
22
|
+
through the actual installed package, the same way a real consumer of
|
|
23
|
+
the library would get it.
|
|
24
|
+
- `tests/` and `docs/` at the repo root, alongside `src/`.
|
|
25
|
+
|
|
26
|
+
## Environment
|
|
27
|
+
|
|
28
|
+
- Python 3.13+.
|
|
29
|
+
- `uv` for dependency and environment management. Use `uv add`, `uv
|
|
30
|
+
sync`, `uv run`. No bare `pip`, no manually edited lockfiles.
|
|
31
|
+
- `ruff` (config in `ruff.toml`) for linting and formatting.
|
|
32
|
+
- `ty` for type checking.
|
|
33
|
+
- Both must pass before a change is considered done. Run
|
|
34
|
+
`uv run ruff check .` and `uv run ty check .`.
|
|
35
|
+
|
|
36
|
+
## Code style
|
|
37
|
+
|
|
38
|
+
- Prefer clear, self-explanatory code over comments. If a rename or a
|
|
39
|
+
restructure would make a comment unnecessary, do that instead of
|
|
40
|
+
writing the comment.
|
|
41
|
+
- Comments are lowercase only, including the first word.
|
|
42
|
+
- Only write a comment when the code's behavior isn't obvious from
|
|
43
|
+
reading it, or when it encodes something implicit - a provider-specific
|
|
44
|
+
workaround, an assumption about input shape, why an edge case is
|
|
45
|
+
handled a particular way. Do not restate what the code already says.
|
|
46
|
+
- Docstrings are rare. Reserve them for genuinely complex logic where a
|
|
47
|
+
reader benefits from a summary before diving into the body. A simple
|
|
48
|
+
function with a clear name and clear arguments does not need one.
|
|
49
|
+
- Absolute imports only. No relative imports (`from .foo import bar`),
|
|
50
|
+
even within `lite_agent_sdk/`. Enforced by ruff (`TID` rules).
|
|
51
|
+
- No emojis, no em dashes, no filler phrases in comments, docstrings, or
|
|
52
|
+
commit messages.
|
|
53
|
+
|
|
54
|
+
## Errors
|
|
55
|
+
|
|
56
|
+
- Provider/API errors (auth, rate limits, network, malformed responses)
|
|
57
|
+
bubble up unmodified. Never catch and re-wrap them in a custom
|
|
58
|
+
exception type.
|
|
59
|
+
- Tool execution errors are the one exception: caught inside the agent's
|
|
60
|
+
resolve step, turned into a tool result the model can see and react
|
|
61
|
+
to. This is a deliberate asymmetry, not an inconsistency.
|
|
62
|
+
- `AgentError` is for programmer-level failures (`unknown_provider`,
|
|
63
|
+
`missing_api_key`, `unknown_tool`, `invalid_output`). It is not used
|
|
64
|
+
for provider errors or tool failures.
|
|
65
|
+
- Human approval is not an error. It lives on `ToolCall.approval`
|
|
66
|
+
(`pending`, `approved`, `denied`) and ends the invocation with
|
|
67
|
+
`finish_reason="waiting_approval"`. Never model it as an exception.
|
|
68
|
+
|
|
69
|
+
## Tests
|
|
70
|
+
|
|
71
|
+
- All tests live under `tests/`, split into:
|
|
72
|
+
- `tests/unit/` - no network calls, no real credentials. Agent tests
|
|
73
|
+
use `FakeAdapter` in `tests/unit/fake_adapter.py`, injected with
|
|
74
|
+
`Agent(..., adapter=...)`. Fast, run on every change.
|
|
75
|
+
- `tests/integration/` - exercises real adapter translation logic
|
|
76
|
+
against recorded, provider-shaped HTTP responses using `vcrpy` (via
|
|
77
|
+
`pytest-recording`, `@pytest.mark.vcr`). No live API key is required
|
|
78
|
+
to run these, in CI or locally. Cassettes live in
|
|
79
|
+
`tests/integration/cassettes/` and are committed.
|
|
80
|
+
- New behavior gets a unit test. New provider-specific translation logic
|
|
81
|
+
gets an integration test against a cassette - a hand-written mock is
|
|
82
|
+
exactly what would hide a translation bug.
|
|
83
|
+
- Cassettes are recorded once, manually, by whoever changes
|
|
84
|
+
provider-specific translation logic, using a real key locally.
|
|
85
|
+
`filter_headers` in the VCR config strips the API key from recorded
|
|
86
|
+
request headers before a cassette is committed. Check the diff of any
|
|
87
|
+
new or re-recorded cassette - an unscrubbed cassette is a leaked
|
|
88
|
+
credential in git history.
|
|
89
|
+
- Re-recording a cassette is a deliberate, occasional action, not
|
|
90
|
+
something CI does automatically.
|
|
91
|
+
|
|
92
|
+
## AI writing guidelines
|
|
93
|
+
|
|
94
|
+
Applies to everything in `docs/`, the README, comments, and commit
|
|
95
|
+
messages.
|
|
96
|
+
|
|
97
|
+
### Tone and language
|
|
98
|
+
|
|
99
|
+
- Use Simplified Technical English (STE) with a light, human touch.
|
|
100
|
+
Avoid sounding robotic.
|
|
101
|
+
- Write clearly, simply, and coherently. Prefer short, direct sentences.
|
|
102
|
+
- Be especially clear when explaining concepts, steps, or trade-offs.
|
|
103
|
+
- Say the thing once, clearly, and stop. If a sentence does not add
|
|
104
|
+
information, cut it.
|
|
105
|
+
|
|
106
|
+
### Banned patterns
|
|
107
|
+
|
|
108
|
+
- No emojis.
|
|
109
|
+
- No em dashes. Use a single hyphen ("-") instead.
|
|
110
|
+
- No horizontal rules or page separators (`---`) in markdown.
|
|
111
|
+
- No filler such as "in today's fast-paced world".
|
|
112
|
+
|
|
113
|
+
### Structure
|
|
114
|
+
|
|
115
|
+
- Organize content with headers.
|
|
116
|
+
- Use bullet points and numbered lists where they help.
|
|
117
|
+
- Keep paragraphs to five sentences or fewer.
|
|
118
|
+
- Avoid walls of text. Break up long explanations with code, lists, or
|
|
119
|
+
diagrams.
|
|
120
|
+
|
|
121
|
+
### Code and diagrams
|
|
122
|
+
|
|
123
|
+
- Include code examples when they help. Pseudocode is fine.
|
|
124
|
+
- Prefer Python when using a real language.
|
|
125
|
+
- Prefer short examples over long explanations.
|
|
126
|
+
- Use Mermaid diagrams for flows, architecture, and relationships.
|
|
127
|
+
- For complex documentation, favor code and diagrams over extra prose.
|
|
128
|
+
|
|
129
|
+
### Math
|
|
130
|
+
|
|
131
|
+
- Use LaTeX for equations and mathematical expressions.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.1.0 - 2026-11-04
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Async `Agent.run` and `Agent.stream` for one turn at a time.
|
|
10
|
+
- OpenAI and Anthropic adapters.
|
|
11
|
+
- Tools, with approval that pauses on `waiting_approval`.
|
|
12
|
+
- Structured output through `output_schema`.
|
|
13
|
+
- Usage events for each model hop.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zander Zemliak
|
|
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,19 @@
|
|
|
1
|
+
.PHONY: help lint format test
|
|
2
|
+
|
|
3
|
+
.DEFAULT_GOAL := help
|
|
4
|
+
|
|
5
|
+
help:
|
|
6
|
+
@echo "lint run ruff check, ruff format --check, and ty"
|
|
7
|
+
@echo "format apply ruff formatting"
|
|
8
|
+
@echo "test run the pytest suite"
|
|
9
|
+
|
|
10
|
+
lint:
|
|
11
|
+
uv run ruff check .
|
|
12
|
+
uv run ruff format --check .
|
|
13
|
+
uv run ty check .
|
|
14
|
+
|
|
15
|
+
format:
|
|
16
|
+
uv run ruff format .
|
|
17
|
+
|
|
18
|
+
test:
|
|
19
|
+
uv run pytest
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: lite-agent-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Minimal, lightweight, provider-agnostic LLM agent SDK
|
|
5
|
+
Project-URL: Repository, https://github.com/Zander073/lite-agent-sdk
|
|
6
|
+
Project-URL: Changelog, https://github.com/Zander073/lite-agent-sdk/blob/main/CHANGELOG.md
|
|
7
|
+
Project-URL: Documentation, https://github.com/Zander073/lite-agent-sdk/blob/main/docs/usage.md
|
|
8
|
+
Author: Zander Zemliak
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Python: >=3.13
|
|
12
|
+
Requires-Dist: anthropic<3,>=2.5.0
|
|
13
|
+
Requires-Dist: openai<4,>=3.46.0
|
|
14
|
+
Requires-Dist: pydantic<3,>=2.13.4
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# lite-agent-sdk
|
|
18
|
+
|
|
19
|
+
A small, async, provider-agnostic agent SDK for Python. It runs one agent turn at a time. You own the transcript.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv add lite-agent-sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The OpenAI and Anthropic SDKs are installed with the package.
|
|
28
|
+
|
|
29
|
+
## API keys
|
|
30
|
+
|
|
31
|
+
Pass `api_key=` to `Agent`, or set the provider environment variable:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
export OPENAI_API_KEY=sk-...
|
|
35
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import asyncio
|
|
42
|
+
from datetime import UTC, datetime
|
|
43
|
+
from uuid import uuid4
|
|
44
|
+
|
|
45
|
+
from lite_agent_sdk import Agent, Message
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def main() -> None:
|
|
49
|
+
agent = Agent(
|
|
50
|
+
model="anthropic/claude-haiku-4-5-20251001",
|
|
51
|
+
system_prompt="Be brief.",
|
|
52
|
+
)
|
|
53
|
+
messages = [
|
|
54
|
+
Message(id=str(uuid4()), role="user", content="Hello", created_at=datetime.now(UTC)),
|
|
55
|
+
]
|
|
56
|
+
result = await agent.run(messages)
|
|
57
|
+
print(result.output)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`model` is `provider/model-id`. Supported providers are `openai` and `anthropic`.
|
|
64
|
+
|
|
65
|
+
## Docs
|
|
66
|
+
|
|
67
|
+
- [Usage](docs/usage.md): agents, transcripts, tools, approval, streaming, and errors.
|
|
68
|
+
- [Structured output](docs/structured-output.md): `output_schema` and provider notes.
|
|
69
|
+
- [Technical design](docs/lite_agent_sdk_tdd.md): the target API and design decisions.
|
|
70
|
+
- [Changelog](CHANGELOG.md): published versions.
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv sync
|
|
76
|
+
make lint
|
|
77
|
+
make format
|
|
78
|
+
make test
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Releases follow [docs/releasing.md](docs/releasing.md). Python 3.13 or newer is required.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# lite-agent-sdk
|
|
2
|
+
|
|
3
|
+
A small, async, provider-agnostic agent SDK for Python. It runs one agent turn at a time. You own the transcript.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv add lite-agent-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The OpenAI and Anthropic SDKs are installed with the package.
|
|
12
|
+
|
|
13
|
+
## API keys
|
|
14
|
+
|
|
15
|
+
Pass `api_key=` to `Agent`, or set the provider environment variable:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
export OPENAI_API_KEY=sk-...
|
|
19
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import asyncio
|
|
26
|
+
from datetime import UTC, datetime
|
|
27
|
+
from uuid import uuid4
|
|
28
|
+
|
|
29
|
+
from lite_agent_sdk import Agent, Message
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def main() -> None:
|
|
33
|
+
agent = Agent(
|
|
34
|
+
model="anthropic/claude-haiku-4-5-20251001",
|
|
35
|
+
system_prompt="Be brief.",
|
|
36
|
+
)
|
|
37
|
+
messages = [
|
|
38
|
+
Message(id=str(uuid4()), role="user", content="Hello", created_at=datetime.now(UTC)),
|
|
39
|
+
]
|
|
40
|
+
result = await agent.run(messages)
|
|
41
|
+
print(result.output)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
asyncio.run(main())
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`model` is `provider/model-id`. Supported providers are `openai` and `anthropic`.
|
|
48
|
+
|
|
49
|
+
## Docs
|
|
50
|
+
|
|
51
|
+
- [Usage](docs/usage.md): agents, transcripts, tools, approval, streaming, and errors.
|
|
52
|
+
- [Structured output](docs/structured-output.md): `output_schema` and provider notes.
|
|
53
|
+
- [Technical design](docs/lite_agent_sdk_tdd.md): the target API and design decisions.
|
|
54
|
+
- [Changelog](CHANGELOG.md): published versions.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uv sync
|
|
60
|
+
make lint
|
|
61
|
+
make format
|
|
62
|
+
make test
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Releases follow [docs/releasing.md](docs/releasing.md). Python 3.13 or newer is required.
|