how to get the conversation that happend between a...
# ask-ai
h
how to get the conversation that happend between agent and particiapent after ending the agent?
t
Thanks for reaching out, Pavan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you want to grab the conversation between an agent and a participant after the session wraps up, here are some handy ways to do it: • Check out `session.history`: This holds the entire chat history, including all messages and function calls. You can easily save it as JSON for later. • Try `add_shutdown_callback`: This lets you register a callback that automatically saves the conversation transcript when the session ends—super convenient! • Listen for
conversation_item_added
events:
These events fire whenever a message is finalized and added to the chat history, so you can keep things updated in real-time. • Handle incomplete agent turns: To make sure you don’t miss the last agent response, enable
RoomInputOptions.close_on_disconnect
or flush the session manually. • Use `session.chat_ctx`: This contains the full context sent to the LLM, which is great if you want to save or transfer context between sessions. Just a heads up—LiveKit doesn’t save chat history automatically, so you’ll want to store it somewhere like a database, file system, or cloud storage. If you’d like, I’m happy to share more details or examples to help you get started! Sources: Sending text | LiveKit Docs | client/app/actions.ts | Session recording and transcripts | LiveKit Docs | Workflows | LiveKit Docs | tests/test_agent_session.py
h
i am using the code from https://github.com/livekit-examples/agent-starter-embed once after clicking on end, i want the conversation to be displayed on the screen
t
Hey there! Just wanted to let you know that the agent-starter-embed example already has a neat feature that shows the conversation history even after you end a session. Here’s the scoop: • The frontend uses the
useChatAndTranscription
hook to keep track of chat messages, and you’ll see them pop up in real time thanks to the
ChatMessageView
and
ChatEntry
components. • When you end the session, the chat messages stick around because the
messages
state isn’t cleared after
room.disconnect()
. • So, if you want the history to stay visible after hitting "End," you’re all set—no extra tweaks needed since the UI keeps the chat history by default. If you’d like to customize how the history looks or save it for later, you can grab the full conversation history programmatically using
session.history
on the backend and show it on the frontend however you like. Just give me a shout if you want a hand with that! Sources: components/session-view.tsx | Session recording and transcripts | LiveKit Docs | examples/voice_agents/session_close_callback.py
h
yes , I like to customize how the history looks or save it for later.show it on the frontend
t
Hey there! If you want to customize and show conversation history on the frontend using the
agent-starter-embed
example, you can tweak the existing components and even add persistence to save those histories. Here’s a friendly breakdown: • UI Customization: You can use the
useChatAndTranscription
hook to grab the
messages
array. Then, feel free to update the
ChatEntry
or
SessionView
components to style messages your way—maybe add timestamps, avatars, or even different looks for agent vs. user messages. Animations for smooth transitions? Totally doable! • Persistence: Want to save and reload conversations? Here’s how: ◦ Save messages to a database after each session. ◦ When a user comes back, fetch and rebuild the
messages
array. ◦ You can also hydrate the agent’s context (
chat_ctx
) with past conversation data to keep things seamless. • Example: Check out the
agents-chatbot
example—it shows how to fetch and display previous chats from a backend, which you can easily adapt for your needs. Feel free to reach out if you want some specific code snippets or help setting up a backend for saving conversations—I’m here to help! Sources: Workflows | LiveKit Docs | components/session-view.tsx | complex-agents/role-playing/role_playing_frontend/components/session-view.t... | client/components/chat-list.tsx
h
i am trying to embed the floating chat bubble in my front end web app using https://github.com/livekit-examples/agent-starter-embed but for some reason the chat bubble is not appearing. The developer trace looks fine without any errors. Below is my sample test.html page <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>LiveKit Agent Embed</title> </head> <body> <h1>My Page with LiveKit Agent</h1> <script src="http://localhost:3001/embed-popup.js"></script> </body> </html> I’ve been trying from past two days without any luck. Do you have any suggestions on how I can check for the chat bubble on the frontend? Just to clarify, the iframe itself is working fine.
t
Hey there! If the floating chat bubble isn’t showing up in your frontend app using the
agent-starter-embed
example, no worries—let’s walk through some easy steps to figure it out: 1. Build the Script: First, double-check that you’ve run
pnpm build-embed-popup-script
to create the
embed-popup.js
file. This is super important because without it, the floating button won’t show up. 2. Include the Script Correctly: Make sure your HTML page has the script tag pointing to the right URL, like
<script src="http://localhost:3000/embed-popup.js"></script>
. 3. Check Network Loading: Open your browser’s developer tools (hit F12) and see if the script loads without any errors. Keep an eye out for CORS problems or missing files in the Network tab. 4. Serve the App: Confirm that your
agent-starter-embed
app is running locally with
pnpm dev
and that you’re accessing the correct port. 5. Validate the Embedding Context: Remember, the floating button only shows when the script is included in an external HTML page—not if you’re directly visiting the app’s
/popup
route. 6. Check Browser Console: Peek at the console for any JavaScript errors or conflicts that might be stopping the button from appearing. 7. Verify Configuration: Lastly, make sure your
.env.local
file is set up properly with your LiveKit server URL and API keys. If you hit any snags or want me to help with anything specific, just let me know—I’m here to help! Sources: Web Embed Example | livekit/livekit_composite | DeepWiki | Community & Support | livekit/livekit_composite | DeepWiki
h
i have validated all the 7 points and all are fine
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!