Structs§
- Agent
Request Context - Default
Agent Engine - Turn
Context - Per-turn context that legitimately changes on every request.
Enums§
- Agent
Event - An observable event emitted by the shared agent runtime.
Constants§
- TOKEN_
BUDGET_ REFUSAL_ PREFIX - Prefix of the canned reply returned when the token budget refuses a turn. Proactive loops (heartbeat / idle check-in / interjection / scheduler) match on this to stay silent instead of delivering the refusal to chat.
Traits§
Functions§
- archive_
conversation - Archive the full conversation to a markdown file before compaction.
Saved to
<data_dir>/groups/<channel>/<chat_id>/conversations/<timestamp>.md. - attach_
turn_ context - Attach the per-turn context to the latest plain user message, at request time only.
- build_
system_ prompt - build_
turn_ context - Build the
<turn_context>block injected after the system prompt. - effective_
runtime_ data_ dir - history_
to_ claude_ messages - maybe_
rerun_ for_ pending - Check if pending messages were queued during the last turn and spawn a new agent run to process them.
- message_
to_ text - Extract text content from a Message for summarization/display.
- process_
with_ agent - process_
with_ agent_ with_ events - process_
with_ agent_ with_ events_ guarded - process_
with_ agent_ with_ experience_ id - Run the shared loop with a caller-owned durable experience id. This lets supervisors close the record even if they time out and drop the future.
- resume_
interrupted_ turn - Continue an interactive turn from a durable, provider-neutral checkpoint.
- send_
turn_ event - Send an event into the live turn for
(channel, chat_id)if one is running with an event consumer attached. Returnstruewhen delivered. - should_
suppress_ user_ error - strip_
images_ for_ session - Replace Image content blocks with text placeholders to avoid storing base64 data in sessions.
- strip_
thinking - Exposed for testing.
Strip
<think>...</think>and<thought>...</thought>blocks from model output. Handles multiline content and multiple blocks.