Cyclium. Conversations. Dispatch
(Cyclium v0.1.5)
Copy Markdown
Creates and enqueues interactive episodes for conversation turns.
This is the library-level helper that eliminates boilerplate in consuming apps. It resolves the actor's interactive expectation, budget, and log strategy from persistent_term (set by the Actor DSL at startup) — no actor-specific knowledge needed.
Usage in consuming apps
# Direct call:
Cyclium.Conversations.Dispatch.send_message(conversation_id, "Hello", principal: user)
# Or wrap in a thin app-level module if you need customization:
defmodule MyApp.ConversationDispatch do
def send_message(conversation_id, message, opts \\ []) do
Cyclium.Conversations.Dispatch.send_message(conversation_id, message, opts)
end
end
Summary
Functions
Resolve the interactive expectation for an actor from persistent_term.
Send a user message in a conversation. Creates an interactive episode and enqueues it.
Functions
Resolve the interactive expectation for an actor from persistent_term.
Scans persistent_term for an expectation registered with the Interactive strategy template. Also resolves budget and log_strategy for that expectation.
Returns {:ok, expectation_id, budget, log_strategy} or {:error, :no_interactive_expectation}.
Send a user message in a conversation. Creates an interactive episode and enqueues it.
Resolves the actor's interactive expectation automatically from the conversation's
actor_id — no hardcoded expectation IDs needed.
Options
:principal— map with user info (e.g.%{"type" => "user", "id" => "user_123"}):budget— override budget (default: resolved from actor's expectation):log_strategy— override log strategy (default: resolved from actor's expectation)
Returns {:ok, episode} or {:error, reason}.