Skip to main content

Module agent_engine

Module agent_engine 

Source

Structs§

AgentRequestContext
DefaultAgentEngine

Enums§

AgentEvent
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§

AgentEngine

Functions§

archive_conversation
Archive the full conversation to a markdown file before compaction. Saved to <data_dir>/groups/<channel>/<chat_id>/conversations/<timestamp>.md.
build_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. Returns true when 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.