Metadata-Version: 2.4
Name: aios-kernel-sdk
Version: 0.1.0
Summary: Python SDK for the AIOS AI Kernel — the operating system layer for AI agents
Project-URL: Homepage, https://github.com/stagsz/aios
Project-URL: Issues, https://github.com/stagsz/aios/issues
Project-URL: Documentation, https://github.com/stagsz/aios/tree/main/docs
Author: Stag
License: MIT License
        
        Copyright (c) 2026 Stag
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: agents,ai,aios,kernel,llm
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27
Requires-Dist: litellm>=1.40
Requires-Dist: pydantic>=2
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Provides-Extra: langgraph
Requires-Dist: langchain-core>=0.2; extra == 'langgraph'
Requires-Dist: langgraph>=0.2; extra == 'langgraph'
Description-Content-Type: text/markdown

# aios-kernel-sdk

[![PyPI version](https://img.shields.io/pypi/v/aios-kernel-sdk)](https://pypi.org/project/aios-kernel-sdk/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)

Python SDK for the [AIOS AI Kernel](https://github.com/stagsz/aios) — the operating system layer for AI agents.

## Installation

```bash
pip install aios-kernel-sdk

# With LangGraph adapter:
pip install "aios-kernel-sdk[langgraph]"
```

## Quickstart

```python
import asyncio
from aios_sdk import AIKernel, LLMQuery

async def main():
    async with AIKernel("http://localhost:8000", "my-agent") as kernel:
        response = await kernel.llm(LLMQuery(
            model="anthropic/claude-haiku-4-5-20251001",
            messages=[{"role": "user", "content": "Summarise the Q4 report"}],
        ))
        print(response["content"])

asyncio.run(main())
```

Start the kernel first:

```bash
git clone https://github.com/stagsz/aios && cd aios
docker compose up -d
```

## Features

- Async-first client with graceful fallback to litellm on kernel unavailability
- Typed Pydantic v2 query models
- LangGraph checkpointer adapter (M3 stub — full implementation post-M1)
- OpenAI-compatible adapter stub
- Prompt-injection sanitization on all tool output (M6)

## Error handling

```python
from aios_sdk import KernelError

try:
    response = await kernel.llm(query)
except KernelError as e:
    print(f"Kernel error {e.status_code}: {e.detail}")
```

When the kernel is unreachable and `fallback_to_litellm=True` (default), the SDK calls litellm directly — no code change required.

## Links

- [Main repo](https://github.com/stagsz/aios)
- [Docs](https://github.com/stagsz/aios/tree/main/docs)
- [Issue tracker](https://github.com/stagsz/aios/issues)
