elegant-coat-98622
10/05/2025, 1:31 PMlivekit.agents to run a 20-min voice interview with STT → LLM → TTS. I override llm_node but otherwise rely on the default behavior. I want to confirm my understanding of context handling and billing implications:
1. Does `AgentSession`/`ChatContext` resend the entire accumulated chat history on every LLM turn by default? i.e., user speaks → agent replies → next user turn sends (previous user + previous agent + current user) plus any system/tool messages again.
2. Is there any built-in sliding window or automatic summarization in the Agents SDK, or do we need to manually prune/summarize chat_ctx.messages before calling the LLM?
3. Any server-side caching that reduces tokens billed for repeated prefixes across turns? (I assume not—each call is stateless from the LLM provider’s perspective—but checking if the Agents framework or Realtime path does anything here.)tall-airline-16756
10/05/2025, 1:31 PMtall-airline-16756
10/05/2025, 1:32 PMtruncate() method, which helps limit how many messages get sent to the LLM. However, automatic summarization isn’t built in—you’d need to add that yourself if it’s something you want.
3. Server-side caching: To help reduce billing for repeated content, the SDK and Realtime path use server-side caching. This clever prompt caching reuses tokens from earlier turns that overlap with new prompts, so you’re not billed repeatedly for the same prefixes.
Please feel free to reach out if you’d like me to clarify anything further or if there’s anything else I can help you with!
Sources: tools/server/public_simplechat/readme.md | Workflows | LiveKit Docs | agents/src/llm/chat_context.ts | complex-agents/personal_shopper/personal_shopper.py | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...