LAVS Python SDK
Python SDK for the LAVS (Local Agent View Service) protocol. Provides type definitions, server-side runtime components, and a client for calling LAVS endpoints.
Structure
python/
├── lavs_types/ # Protocol type definitions (Pydantic v2)
├── lavs_runtime/ # Server-side runtime
├── lavs_client/ # Client SDK
├── tests/
└── pyproject.toml
Installation
cd platform/lavs/sdk/python
uv sync
Packages
lavs_types
Pydantic v2 models for all protocol types:
from lavs_types import (
LAVSManifest,
Endpoint,
Handler,
ScriptHandler,
Permissions,
ExecutionContext,
LAVSError,
LAVSErrorCode,
)
lavs_runtime
Server-side components for loading manifests, validating inputs/outputs, checking permissions, executing scripts, and rate limiting:
from lavs_runtime import (
ManifestLoader,
LAVSValidator,
PermissionChecker,
ScriptExecutor,
LAVSRateLimiter,
)
# Load manifest
loader = ManifestLoader()
manifest = loader.load("/path/to/lavs.json")
# Validate input
validator = LAVSValidator()
validator.assert_valid_input(endpoint, input_data, manifest.types)
# Check permissions
checker = PermissionChecker()
perms = checker.merge_permissions(manifest.permissions, endpoint.permissions)
checker.assert_allowed(handler, perms, agent_dir)
# Execute script handler
executor = ScriptExecutor()
result = executor.execute(handler, input_data, context)
# Rate limiting
limiter = LAVSRateLimiter()
if limiter.check(f"{agent_id}:{endpoint_id}").allowed:
# proceed
lavs_client
Client for calling LAVS endpoints:
from lavs_client import LAVSClient
client = LAVSClient(
agent_id="jarvis",
base_url="http://localhost:3000",
project_path="/path/to/project",
auth_token="optional-token",
)
# Get manifest
manifest = client.get_manifest()
# Call endpoint
result = client.call("listTodos")
result = client.call("addTodo", {"text": "Buy milk", "priority": 1})
# Subscribe to updates (SSE)
unsubscribe = client.subscribe(
"todoUpdates",
callback=lambda data: print("Update:", data),
on_connected=lambda info: print("Connected:", info),
)
# ... later ...
unsubscribe()
Development
# Install with dev dependencies
uv sync --all-extras
# Run tests
uv run pytest
# Lint
uv run ruff check .
Conventions
- PEP 8 naming (snake_case)
- Type hints everywhere
- Google-style docstrings
- uv as package manager
- ruff for linting
Protocol Reference
See docs/SPEC.md for the full LAVS protocol specification.
Release files for lavs-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lavs_sdk-0.2.0.tar.gz | 60.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lavs_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.6 kB
Release files / lavs_sdk-0.2.0.tar.gz
| Download URL | lavs_sdk-0.2.0.tar.gz |
|---|---|
| Size | 60.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
856697bb6ea6e7b3038434ca159914b31ce794653bef0c2a639efd3fa724c9e6
|
|
BLAKE2b-256 checksum How to use checksums |
d00ae5c711cdc2b7a254d6b438e7ea5afb2c1e6c9433896f457e60ea9dd016cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / lavs_sdk-0.2.0-py3-none-any.whl
| Download URL | lavs_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c11af1bae9b4391c5db81e4f63698900d762d9660817b36de5b5e137a828e93
|
|
BLAKE2b-256 checksum How to use checksums |
734f40843596436736cac4be07a901334439a864669da3bf2b2f55a90fcdde75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|