Python API¶
This reference is generated from the source docstrings with mkdocstrings. It starts with the supported public surface, then documents the schema models and the advanced sub-modules.
Public surface¶
The supported, stable API exported from the top-level skeino package:
create_app
¶
create_app(
*,
graphs: Mapping[str, GraphInput],
settings: SkeinoSettings,
) -> FastAPI
Build a FastAPI application that exposes the skeino HTTP surface.
graphs maps assistant id → either a precompiled :class:CompiledStateGraph
or a builder (checkpointer) -> CompiledStateGraph (sync or async). When
a builder is supplied, skeino resolves a checkpointer via
:func:skeino.persistence.open_checkpointer and passes it in.
Source code in src/skeino/app.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
from_langgraph_json
¶
from_langgraph_json(
manifest_path: str | Path,
*,
settings: SkeinoSettings | None = None,
) -> FastAPI
Build a skeino-backed FastAPI app from a langgraph.json manifest.
Parameters¶
manifest_path:
Path to the langgraph.json file.
settings:
Optional :class:SkeinoSettings whose explicit fields override anything
derived from the manifest. Useful for setting graph-specific options
(agent_nodes, status_field) that langgraph.json does not
describe.
Source code in src/skeino/langgraph_json.py
SkeinoSettings
¶
Bases: BaseModel
Configuration record passed to :func:skeino.create_app.
Settings live in your code (typed, validated, version-controlled). For
deployments that read from environment variables, use pydantic-settings
in your project and pass the resulting object into SkeinoSettings.
GraphRegistry
¶
Immutable mapping of assistant id to compiled graph.
Validate the input mapping and freeze the default selection.
Source code in src/skeino/registry.py
Schemas¶
The Pydantic request/response models behind the HTTP API.
Common types¶
common
¶
Shared type aliases and the checkpoint selector model.
CheckpointConfigModel
¶
Bases: BaseModel
Checkpoint selector for thread state or run resumption.
Threads¶
threads
¶
Schemas for thread creation, search, state, and history endpoints.
ThreadTtlConfig
¶
Bases: BaseModel
Time-to-live settings for a thread.
ThreadTtlInfo
¶
Bases: BaseModel
TTL information returned for a thread.
ThreadSuperstepUpdate
¶
Bases: BaseModel
Initial state update applied during thread creation.
ThreadSuperstep
¶
Bases: BaseModel
A superstep container for thread bootstrap updates.
ThreadCreateRequest
¶
Bases: BaseModel
Payload for creating a thread.
ThreadPatchRequest
¶
Bases: BaseModel
Mutable fields updatable on an existing thread.
metadata is optional so an empty body is a no-op; send
{"metadata": {}} to intentionally clear a thread's metadata.
ThreadStateUpdateRequest
¶
Bases: BaseModel
Manually write/patch a thread's state (human-in-the-loop edit).
ThreadModel
¶
Bases: BaseModel
LangGraph-compatible thread representation.
ThreadSearchRequest
¶
Bases: BaseModel
Payload for listing or searching threads.
InterruptModel
¶
Bases: BaseModel
Serialized interrupt entry.
ThreadTaskModel
¶
Bases: BaseModel
Serialized pending task entry.
ThreadStateModel
¶
Bases: BaseModel
Latest checkpointed state for a thread.
ThreadStateSearchRequest
¶
Bases: BaseModel
Payload for retrieving thread history.
Runs¶
runs
¶
Assistants¶
assistants
¶
Server¶
server
¶
Server-info and generic response schemas.
Persistence¶
Advanced
These are importable for advanced use (e.g. registering a custom checkpointer) but are not part of the stability contract. See Persistence & checkpointers and Write a custom checkpointer.
persistence
¶
Persistence layer: metadata store, checkpointer registry, enrichment.
MetadataStoreProtocol
¶
Bases: Protocol
Async CRUD surface for thread and run metadata.
setup
async
¶
create_thread
async
¶
create_thread(
thread_id: str,
*,
metadata: dict[str, JsonValue],
config: dict[str, JsonValue],
ttl: ThreadTtlConfig | None,
if_exists: ThreadIfExists,
) -> ThreadRow
Insert a thread row and return the stored record.
Source code in src/skeino/persistence/base.py
update_thread
async
¶
update_thread(
thread_id: str,
*,
status_value: ThreadStatus | None = None,
config: dict[str, JsonValue] | None = None,
metadata: dict[str, JsonValue] | None = None,
mark_state_updated: bool = False,
) -> None
Update mutable metadata for a thread.
Source code in src/skeino/persistence/base.py
search_thread_rows
async
¶
search_thread_rows(
request: ThreadSearchRequest,
) -> list[ThreadRow]
delete_thread
async
¶
create_run
async
¶
create_run(
run_id: str,
thread_id: str,
assistant_id: str,
metadata: dict[str, JsonValue],
kwargs: dict[str, JsonValue],
multitask_strategy: MultitaskStrategy,
) -> RunRow
Insert a run row and return it.
Source code in src/skeino/persistence/base.py
update_run_status
async
¶
RunRow
¶
Bases: TypedDict
Uniform run row shape every metadata store returns.
ThreadRow
¶
Bases: TypedDict
Uniform thread row shape every metadata store returns.
CheckpointerSpec
dataclass
¶
Declarative request for a checkpointer instance.
InMemoryMetadataStore
¶
Dict-backed thread + run metadata store.
Initialise empty thread and run maps.
Source code in src/skeino/persistence/in_memory_store.py
setup
async
¶
create_thread
async
¶
create_thread(
thread_id: str,
*,
metadata: dict[str, JsonValue],
config: dict[str, JsonValue],
ttl: ThreadTtlConfig | None,
if_exists: ThreadIfExists,
) -> ThreadRow
Insert a thread row and return it.
Source code in src/skeino/persistence/in_memory_store.py
update_thread
async
¶
update_thread(
thread_id: str,
*,
status_value: ThreadStatus | None = None,
config: dict[str, JsonValue] | None = None,
metadata: dict[str, JsonValue] | None = None,
mark_state_updated: bool = False,
) -> None
Update mutable thread fields.
Source code in src/skeino/persistence/in_memory_store.py
search_thread_rows
async
¶
search_thread_rows(
request: ThreadSearchRequest,
) -> list[ThreadRow]
List thread rows respecting basic filter / pagination flags.
Source code in src/skeino/persistence/in_memory_store.py
delete_thread
async
¶
Delete a thread and its run rows.
Source code in src/skeino/persistence/in_memory_store.py
create_run
async
¶
create_run(
run_id: str,
thread_id: str,
assistant_id: str,
metadata: dict[str, JsonValue],
kwargs: dict[str, JsonValue],
multitask_strategy: MultitaskStrategy,
) -> RunRow
Insert a run row and return it.
Source code in src/skeino/persistence/in_memory_store.py
update_run_status
async
¶
Update a run's status field.
Source code in src/skeino/persistence/in_memory_store.py
fetch_run_row
async
¶
fetch_run_row(thread_id: str, run_id: str) -> RunRow | None
Return a run row scoped to thread_id.
Source code in src/skeino/persistence/in_memory_store.py
list_run_rows
async
¶
list_run_rows(
thread_id: str,
*,
limit: int,
offset: int,
status_value: RunStatus | None,
) -> list[RunRow]
List runs for a thread sorted newest-first.
Source code in src/skeino/persistence/in_memory_store.py
MetadataStore
¶
Persist thread and run metadata alongside LangGraph checkpoints.
Store the PostgreSQL connection string used for metadata operations.
Source code in src/skeino/persistence/metadata_store.py
setup
async
¶
Create the metadata tables if they do not already exist.
Source code in src/skeino/persistence/metadata_store.py
fetch_thread_row
async
¶
fetch_thread_row(thread_id: str) -> ThreadRow | None
Return the stored metadata row for a thread.
Source code in src/skeino/persistence/metadata_store.py
create_thread
async
¶
create_thread(
thread_id: str,
*,
metadata: dict[str, JsonValue],
config: dict[str, JsonValue],
ttl: ThreadTtlConfig | None,
if_exists: ThreadIfExists,
) -> ThreadRow
Insert a thread row and return the stored record.
Source code in src/skeino/persistence/metadata_store.py
update_thread
async
¶
update_thread(
thread_id: str,
*,
status_value: ThreadStatus | None = None,
config: dict[str, JsonValue] | None = None,
metadata: dict[str, JsonValue] | None = None,
mark_state_updated: bool = False,
) -> None
Update mutable metadata for a thread.
Source code in src/skeino/persistence/metadata_store.py
delete_thread
async
¶
Delete a thread row and its run rows.
Source code in src/skeino/persistence/metadata_store.py
search_thread_rows
async
¶
search_thread_rows(
request: ThreadSearchRequest,
) -> list[ThreadRow]
Return stored thread rows before graph-state enrichment.
Source code in src/skeino/persistence/metadata_store.py
create_run
async
¶
create_run(
run_id: str,
thread_id: str,
assistant_id: str,
metadata: dict[str, JsonValue],
kwargs: dict[str, JsonValue],
multitask_strategy: MultitaskStrategy,
) -> RunRow
Insert a run row and return it.
Source code in src/skeino/persistence/metadata_store.py
update_run_status
async
¶
Update the persisted run status.
Source code in src/skeino/persistence/metadata_store.py
fetch_run_row
async
¶
fetch_run_row(thread_id: str, run_id: str) -> RunRow | None
Return a single run row for a thread.
Source code in src/skeino/persistence/metadata_store.py
list_run_rows
async
¶
list_run_rows(
thread_id: str,
*,
limit: int,
offset: int,
status_value: RunStatus | None,
) -> list[RunRow]
List run rows for a thread.
Source code in src/skeino/persistence/metadata_store.py
MongoMetadataStore
¶
MongoDB-backed thread + run metadata store (MetadataStoreProtocol).
Store the URI; db_name defaults to the URI's path, else "skeino".
Source code in src/skeino/persistence/mongo_store.py
setup
async
¶
Open the motor client (lazily) and ensure indexes.
Source code in src/skeino/persistence/mongo_store.py
aclose
async
¶
fetch_thread_row
async
¶
fetch_thread_row(thread_id: str) -> ThreadRow | None
Return the stored row for thread_id (or None).
Source code in src/skeino/persistence/mongo_store.py
create_thread
async
¶
create_thread(
thread_id: str,
*,
metadata: dict[str, JsonValue],
config: dict[str, JsonValue],
ttl: ThreadTtlConfig | None,
if_exists: ThreadIfExists,
) -> ThreadRow
Insert a thread document and return its row.
Source code in src/skeino/persistence/mongo_store.py
update_thread
async
¶
update_thread(
thread_id: str,
*,
status_value: ThreadStatus | None = None,
config: dict[str, JsonValue] | None = None,
metadata: dict[str, JsonValue] | None = None,
mark_state_updated: bool = False,
) -> None
Update mutable thread fields.
Source code in src/skeino/persistence/mongo_store.py
search_thread_rows
async
¶
search_thread_rows(
request: ThreadSearchRequest,
) -> list[ThreadRow]
Return stored thread rows (filtered by ids/status, sorted, paginated).
Source code in src/skeino/persistence/mongo_store.py
delete_thread
async
¶
Delete a thread and its run documents.
create_run
async
¶
create_run(
run_id: str,
thread_id: str,
assistant_id: str,
metadata: dict[str, JsonValue],
kwargs: dict[str, JsonValue],
multitask_strategy: MultitaskStrategy,
) -> RunRow
Insert a run document and return its row.
Source code in src/skeino/persistence/mongo_store.py
update_run_status
async
¶
Update a run's status field.
Source code in src/skeino/persistence/mongo_store.py
fetch_run_row
async
¶
fetch_run_row(thread_id: str, run_id: str) -> RunRow | None
Return a run row scoped to thread_id.
Source code in src/skeino/persistence/mongo_store.py
list_run_rows
async
¶
list_run_rows(
thread_id: str,
*,
limit: int,
offset: int,
status_value: RunStatus | None,
) -> list[RunRow]
List runs for a thread sorted newest-first.
Source code in src/skeino/persistence/mongo_store.py
SqliteMetadataStore
¶
SQLite-backed thread + run metadata store satisfying MetadataStoreProtocol.
Store the SQLite path/URI (a file path, :memory:, or sqlite://).
Source code in src/skeino/persistence/sqlite_store.py
setup
async
¶
Open the connection (lazily importing aiosqlite) and create tables.
Source code in src/skeino/persistence/sqlite_store.py
aclose
async
¶
fetch_thread_row
async
¶
fetch_thread_row(thread_id: str) -> ThreadRow | None
Return the stored row for thread_id (or None).
Source code in src/skeino/persistence/sqlite_store.py
create_thread
async
¶
create_thread(
thread_id: str,
*,
metadata: dict[str, JsonValue],
config: dict[str, JsonValue],
ttl: ThreadTtlConfig | None,
if_exists: ThreadIfExists,
) -> ThreadRow
Insert a thread row and return it.
Source code in src/skeino/persistence/sqlite_store.py
update_thread
async
¶
update_thread(
thread_id: str,
*,
status_value: ThreadStatus | None = None,
config: dict[str, JsonValue] | None = None,
metadata: dict[str, JsonValue] | None = None,
mark_state_updated: bool = False,
) -> None
Update mutable thread fields.
Source code in src/skeino/persistence/sqlite_store.py
search_thread_rows
async
¶
search_thread_rows(
request: ThreadSearchRequest,
) -> list[ThreadRow]
Return stored thread rows (filtered by ids/status, sorted, paginated).
Source code in src/skeino/persistence/sqlite_store.py
delete_thread
async
¶
Delete a thread and its run rows.
Source code in src/skeino/persistence/sqlite_store.py
create_run
async
¶
create_run(
run_id: str,
thread_id: str,
assistant_id: str,
metadata: dict[str, JsonValue],
kwargs: dict[str, JsonValue],
multitask_strategy: MultitaskStrategy,
) -> RunRow
Insert a run row and return it.
Source code in src/skeino/persistence/sqlite_store.py
update_run_status
async
¶
Update a run's status field.
Source code in src/skeino/persistence/sqlite_store.py
fetch_run_row
async
¶
fetch_run_row(thread_id: str, run_id: str) -> RunRow | None
Return a run row scoped to thread_id.
Source code in src/skeino/persistence/sqlite_store.py
list_run_rows
async
¶
list_run_rows(
thread_id: str,
*,
limit: int,
offset: int,
status_value: RunStatus | None,
) -> list[RunRow]
List runs for a thread sorted newest-first.
Source code in src/skeino/persistence/sqlite_store.py
open_checkpointer
async
¶
open_checkpointer(
uri: str | None = None,
*,
scheme: str | None = None,
setup_schema: bool = True,
options: dict[str, Any] | None = None,
) -> AsyncIterator[BaseCheckpointSaver]
Yield a checkpointer instance, releasing its resources on exit.
Resolution: an explicit scheme wins; otherwise it is derived from the
uri; falling back to memory when both are absent.
Source code in src/skeino/persistence/checkpointer.py
register_checkpointer
¶
Register a checkpointer builder for one or more URI schemes.
Source code in src/skeino/persistence/checkpointer.py
Streaming¶
streaming
¶
Streaming layer: SSE encoding, retry, graph dispatch.
Streamer
¶
Streamer(
graph: Any,
*,
agent_nodes: frozenset[str] = frozenset(),
status_field: str | None = None,
)
Dispatch graph streams across the supported LangGraph stream modes.
Capture the graph and the policy for incremental message streaming.
Source code in src/skeino/streaming/runner.py
stream
async
¶
stream(
runnable_input: Any,
config: dict[str, Any],
request: RunCreateRequest,
stream_modes: list[str],
) -> AsyncIterator[tuple[str, dict[str, JsonValue]]]
Yield (event_name, payload) tuples for one streaming run.
Source code in src/skeino/streaming/runner.py
stream_incremental_values
async
¶
stream_incremental_values(
graph: Any,
runnable_input: Any,
config: dict[str, Any],
request: RunCreateRequest,
*,
agent_nodes: frozenset[str] = frozenset(),
status_field: str | None = None,
) -> AsyncIterator[tuple[str, dict[str, JsonValue]]]
Yield values (and optional status) events as the graph streams.
Source code in src/skeino/streaming/incremental.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
is_retriable_stream_error
¶
Return True for transient errors worth retrying during graph streaming.