LangGraph-based runtime for emotionally adaptive AI companions.
Project description
Untamed Companion Runtime
LangGraph-based runtime primitives for emotionally adaptive AI companions.
This package exposes reusable graph builders, SSE event adapters, provider interfaces, store interfaces, prompt overrides, FastAPI routes, deterministic tests, and a local demo showcase. It is product-agnostic by design: application copy, private prompts, production deployment config, billing, and secrets stay outside this repository.
Release Status
This package is an alpha runtime. Public APIs, event payload details, and
provider/store extension points may change before 1.0.0. Pin exact versions
for application use.
The FastAPI router is intentionally unauthenticated by default. Production
applications must pass auth_hook to create_chat_router(...) and enforce
their own ownership, session, API key, or tenant policy.
Install
From source:
git clone https://github.com/wkddns40/untamedai-runtime.git
cd untamedai-runtime
pip install -e ".[fastapi,dev]"
From PyPI:
pip install untamedai-runtime
Optional extras:
pip install "untamedai-runtime[fastapi]"
pip install "untamedai-runtime[openai]"
pip install "untamedai-runtime[supabase]"
pip install "untamedai-runtime[postgres]"
Verify:
python -m pytest
Quickstart
from untamed_companion.graph import GraphRuntime, build_chat_graph
from untamed_companion.providers import FakeLLMProvider
runtime = GraphRuntime(llm_provider=FakeLLMProvider())
graph = build_chat_graph(runtime=runtime)
result = await graph.ainvoke(
{
"companion_id": "demo",
"last_user_message": "your name is Luna",
"user_lang": "en",
"companion": {"name": "???"},
}
)
print(result["emit"])
FastAPI
from fastapi import FastAPI
from untamed_companion.fastapi import create_chat_router
from untamed_companion.graph import GraphRuntime
from untamed_companion.store import InMemoryCompanionStore
app = FastAPI()
runtime = GraphRuntime(companion_store=InMemoryCompanionStore())
app.include_router(create_chat_router(runtime=runtime, prefix="/api"))
Routes:
GET /api/chat/{companion_id}/historyGET /api/chat/{companion_id}/greetingPOST /api/chat/{companion_id}/stream
Auth is app-owned. Pass auth_hook to create_chat_router(...) to enforce
ownership, sessions, API keys, or any other policy.
Demo Showcase
pip install -e ".[fastapi,dev]"
python examples/demo_showcase/backend/app.py
Open:
http://127.0.0.1:8000/demo
The showcase uses the public FastAPI router, in-memory store, fake providers, SSE event inspector, Korean/English language toggle, reset endpoint, and daily emotion dry-run.
Prompt Override
from untamed_companion.graph import GraphRuntime
from untamed_companion.prompts import StaticPromptProvider
runtime = GraphRuntime(
prompt_provider=StaticPromptProvider(chat_prompt="Your app-owned prompt.")
)
Event Contract
SSE frames are emitted as JSON in data: lines:
data: {"type": "stream", "content": "Hello"}
Stable event types:
| Type | Purpose |
|---|---|
stream |
Assistant text chunk or complete deterministic message. |
end |
Stream completion marker. May include final content and intent. |
greeting |
First greeting response. |
name_reveal |
Companion name accepted. |
user_name_set |
User display name accepted. |
naming_prompt |
Runtime asks user to name the companion. |
coffee_request |
Coffee-turn shortcut event. |
error |
Stream failure frame. |
Golden fixtures live under tests/golden/fixtures. They compare public event
order and payloads with whitespace-tolerant diffs, using only fake providers
and in-memory state.
Documentation
Intended Scope
- LangGraph chat, greeting, and daily emotion graph builders
- naming ceremony state machine
- SSE event adapter
- store/provider interfaces
- neutral prompt provider with app-owned override support
- in-memory demo and tests
- optional FastAPI, OpenAI, Supabase, and Postgres integrations
Out of Scope
- product frontend
- private prompts and brand copy
- production deployment config
- billing/webhooks
- service role keys or project-specific environment values
License
MIT.
Project details
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 untamedai_runtime-0.1.1.tar.gz.
File metadata
- Download URL: untamedai_runtime-0.1.1.tar.gz
- Upload date:
- Size: 36.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
823ed10e0ad8f3bfa4a1390de5a56ebcdef88990b1f2959db91ffe97554ad607
|
|
| MD5 |
04dbae6cd023a2e4859983ff706469db
|
|
| BLAKE2b-256 |
856ef139d6f2b493b9825d461fee230d2251d1b31ff93f8077d7529379ab43a9
|
Provenance
The following attestation bundles were made for untamedai_runtime-0.1.1.tar.gz:
Publisher:
publish.yml on wkddns40/untamedai-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
untamedai_runtime-0.1.1.tar.gz -
Subject digest:
823ed10e0ad8f3bfa4a1390de5a56ebcdef88990b1f2959db91ffe97554ad607 - Sigstore transparency entry: 1650873459
- Sigstore integration time:
-
Permalink:
wkddns40/untamedai-runtime@c05412bb7988508e2937537ffd490e574d24a2a4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wkddns40
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c05412bb7988508e2937537ffd490e574d24a2a4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file untamedai_runtime-0.1.1-py3-none-any.whl.
File metadata
- Download URL: untamedai_runtime-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31db765c541ed5769457e01ce2682b57d481dfe1de09d977ec1de0baeb66e12f
|
|
| MD5 |
6112dbc041088114120df5480d558b06
|
|
| BLAKE2b-256 |
9600081ec42b554447ce1330d0e81bfec454df2aaadf1791ac932238c9ed247a
|
Provenance
The following attestation bundles were made for untamedai_runtime-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on wkddns40/untamedai-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
untamedai_runtime-0.1.1-py3-none-any.whl -
Subject digest:
31db765c541ed5769457e01ce2682b57d481dfe1de09d977ec1de0baeb66e12f - Sigstore transparency entry: 1650873536
- Sigstore integration time:
-
Permalink:
wkddns40/untamedai-runtime@c05412bb7988508e2937537ffd490e574d24a2a4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wkddns40
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c05412bb7988508e2937537ffd490e574d24a2a4 -
Trigger Event:
workflow_dispatch
-
Statement type: