This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.
We’re trying to simultaneously log both the inputs and outputs to the STT, LLM, and TTS nodes.
We were able to view the output chunks from the LLM, but haven’t found a way to log inputs to the LLM node as well.
Override the llm_node in your agent to log both inputs and outputs:
async def llm_node(self, chat_ctx, tools, model_settings):
# Log the input chat context
logger.info(f"LLM Input: {chat_ctx.to_dict()}")
# Call the default implementation and stream outputs
async for chunk in Agent.default.llm_node(self, chat_ctx, tools, model_settings):
# Log each output chunk
logger.info(f"LLM Output chunk: {chunk}")
yield chunk
For STT and TTS:
- Subscribe to
user_input_transcribed to log user transcriptions as they arrive
- Use
conversation_item_added to capture committed user/agent messages
- Override
transcription_node for text forwarding with timestamps
See the nodes documentation: