KISS AI Stack's Server stub - Simplify AI Agent Development
Project description
KISS AI Stack - Server
The KISS AI Stack Server is an server stub designed to support RESTful and WebSocket APIs for handling AI-agent sessions with kiss-ai-stack-core tasks like agent lifecycle management, query execution, and document storage.
Features
- REST API for authentication, session actions, queries, and document storage.
- WebSocket API for real-time, event-driven interactions.
- Built-in persistent and temporary session management.
- Flexible architecture to handle server events though AI agent's lifecycle events.
Agent's session lifecycle Events
ON_AUTH: Authenticate a session.ON_INIT: Initialize a session.ON_CLOSE: Close a session.ON_QUERY: Execute a query.ON_STORE: Store documents.
Getting Started
Requirements
- Python 3.12
Installation
-
Install kiss-ai-stack-server package:
pip install kiss-ai-stack-server
-
Set environment variables file
# .env ACCESS_TOKEN_SECRET_KEY = "your-secure-random-secret-key" ACCESS_TOKEN_ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30 SESSION_DB_URL="sqlite://sessions.db"
-
Run the server:
from kiss_ai_stack_server import bootstrap_session_schema, agent_server
REST API Endpoints
1. Authentication
Endpoint: /auth
Method: POST
Request Body:
{
"client_id": "string",
"client_secret": "string"
}
Response:
{
"session_id": "string",
"access_token": "string",
"expires_in": 3600
}
2. Session Actions
Endpoint: /sessions?action={init|close}
Method: POST
Query Parameter:
action(required): Action to perform on the session (initorclose).
Request Body:
{
"session_id": "string"
}
Response: Session-related details or status.
3. Query Execution
Endpoint: /queries
Method: POST
Request Body:
{
"query": "string",
"parameters": {
"key": "value"
}
}
Response: Query results.
4. Document Storage
Endpoint: /documents
Method: POST
Request Body:
{
"documents": [
{
"id": "string",
"content": "string",
"metadata": {}
}
]
}
Response: Document storage confirmation.
WebSocket API
Endpoint: /ws
Workflow
-
Establish a WebSocket connection:
ws://localhost:8080/ws
-
Send a message:
{ "event": "ON_QUERY", "data": { "query": "example query", "parameters": { "key": "value" } } }
-
Receive a response:
{ "event": "ON_QUERY", "result": { "response_key": "response_value" } }
Contributing
Contributions are welcome! Feel free to fork the repository and submit a pull request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kiss_ai_stack_server-0.1.0a8.tar.gz.
File metadata
- Download URL: kiss_ai_stack_server-0.1.0a8.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca11d5834680228d97e8e1b8ad7c7976c66ea2e601fca789d0b49e18b1b699bd
|
|
| MD5 |
07a4142fb27b75961aefb7264382eaa5
|
|
| BLAKE2b-256 |
f738bffb74b12f7f5ced05db24739f5501403326d4ff78be5ad9cf7743ecd703
|
File details
Details for the file kiss_ai_stack_server-0.1.0a8-py3-none-any.whl.
File metadata
- Download URL: kiss_ai_stack_server-0.1.0a8-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dd53e2e8564fd258cbb96a1fe956c7212bbcaf4da90f22d30aa0e1206409039
|
|
| MD5 |
3c92cc0ddd0cd9403ec218f5c23f6da9
|
|
| BLAKE2b-256 |
d1da644d216526827172a22af28a7b26622109effc584352a9f7215dc740adac
|