Runtime Flow
This document describes the current flow from resource preparation to interactive play.
1. Prepare Base Resources
Start by creating reusable configuration resources:
api: a connection definition that includesprovider,base_url,api_key, andmodelapi_group:api_idbindings for each agentpreset: generation parameters and prompt modules for each agent
Common methods:
api.create/api.list/api.update/api.deleteapi_group.create/api_group.list/api_group.update/api_group.deletepreset.create/preset.list/preset.update/preset.delete
If api_group_id or preset_id is omitted and at least one resource exists, the backend sorts ids and uses the first available value.
2. Create Schemas
Then create reusable schema resources for:
- character-private state
- player state
- world state seeds
Manage schemas with:
schema.createschema.listschema.get
Each schema contains:
schema_iddisplay_nametagsfields
3. Prepare Player Profiles
Player setup is now the standalone player_profile resource.
Fields:
player_profile_iddisplay_namedescription
One session activates at most one profile at a time, but the system can store multiple profiles for later switching.
4. Import or Create Characters
4.1 Import .chr
- the request body is raw
.chrbytes - no JSON-RPC wrapper
- the server parses the archive, stores the cover, and creates a
character
4.2 Create Directly
character.create- optional
POST /upload/character:{character_id}/cover
Character content currently stores:
idnamepersonalitystyleschema_idsystem_prompt
5. Create Story Resources
Once characters and schemas exist, create story_resources with:
story_resources.createdisplay_namestory_conceptcharacter_idsplayer_schema_id_seedworld_schema_id_seedlorebook_idsplanned_story
If display_name is omitted or blank, the backend falls back to story_concept.
6. Optional: Run Planner First
If you want an editable draft first:
story.generate_plan
Then store the edited plan back through:
story_resources.update
7. Generate the Story
Recommended flow:
story_draft.startstory_draft.continuestory_draft.finalize
Compatibility wrapper:
story.generate
The draft flow:
- reads
story_resources - generates
planned_storyif needed - has
Architectgenerate the first partial graph section, initial schemas, and the introduction - stores the partial graph and
common_variablesinstory_draft - appends one outline section per
story_draft.continue - validates and creates the final
storyinstory_draft.finalize
The final story stores:
story_idresource_idgraphworld_schema_idplayer_schema_idintroductioncommon_variables
8. Start a Session
Use:
story.start_session
Input may include:
story_iddisplay_nameplayer_profile_idapi_group_idpreset_id
9. Run Turns
The main runtime method is:
session.run_turn
It is initiated through POST /rpc, but the HTTP response is streamed as text/event-stream. Clients receive an ack first, followed by a sequence of message frames.