plexus.cli.procedure.chat_recorder module
Chat Recording for Procedure Runs.
This module provides functionality to record AI conversations during procedure runs, including tool calls and responses, for later analysis and display in the UI.
- class plexus.cli.procedure.chat_recorder.LangChainChatRecorderHook(recorder: ProcedureChatRecorder)
Bases:
objectHook into LangChain agent execution to record tool calls and responses.
- __init__(recorder: ProcedureChatRecorder)
- async record_agent_step(step_info: Dict[str, Any])
Record a step in the agent execution.
- class plexus.cli.procedure.chat_recorder.ProcedureChatRecorder(client: PlexusDashboardClient, procedure_id: str, node_id: str | None = None)
Bases:
objectRecords chat messages during procedure runs.
- __init__(client: PlexusDashboardClient, procedure_id: str, node_id: str | None = None)
- async end_session(status: str = 'COMPLETED', name: str | None = None) bool
End the chat session with optional name update.
- async record_assistant_message(content: str) str
Record an assistant message.
- async record_message(role: str, content: str, message_type: str = 'MESSAGE', tool_name: str | None = None, tool_parameters: Dict[str, Any] | None = None, tool_response: Dict[str, Any] | None = None, parent_message_id: str | None = None, human_interaction: str | None = None, metadata: Dict[str, Any] | None = None) str
Record a chat message.
- record_message_sync(role: str, content: str, message_type: str = 'MESSAGE', tool_name: str | None = None, parent_message_id: str | None = None) str
Synchronous wrapper for recording messages from callbacks.
- async record_message_with_sequence(role: str, content: str, message_type: str = 'MESSAGE', tool_name: str | None = None, tool_parameters: Dict[str, Any] | None = None, tool_response: Dict[str, Any] | None = None, parent_message_id: str | None = None, sequence_number: int | None = None, human_interaction: str | None = None) str
Record a chat message with explicit sequence number.
- async record_system_message(content: str) str
Record a system message (like initial prompts).
- async record_tool_call(tool_name: str, parameters: Dict[str, Any], description: str | None = None) str
Record a tool call message.
- async record_tool_response(tool_name: str, response: Any, parent_message_id: str, description: str | None = None) str
Record a tool response message.
- async record_user_message(content: str) str
Record a user message.
- async start_session(context: Dict[str, Any] | None = None) str
Start a new chat session for the procedure run.
- async update_session_name(name: str) bool
Update the name of the current chat session.
- plexus.cli.procedure.chat_recorder.truncate_for_log(content: str, max_length: int = 200) str
Truncate content for logging purposes.