Starter App
Find a working example on how to use the hosted pipeline in our LemonSlice Examples GitHub Repo.Getting Started
Follow these steps to create your first LemonSlice agent session and integrate it into your application.1. Get your API key
Retrieve your API Key from the LemonSlice dashboard. All API requests must include this header:2. Create a room
Use thePOST /liveai/rooms endpoint to create a Daily room configured with a LemonSlice agent. The agent will automatically join the room once its startup is complete.
Example request
3. Join the room from your frontend
Use Daily’s JavaScript SDK to join the room with the URL and token returned by the API.Example (JavaScript)
4. Listen for LemonSlice events
LemonSlice uses Daily’sapp-message channel to push events about the agent, image updates, and errors.
Example event handler
You’re ready to build
With a room created, the agent connected, and event hooks wired up, you’re ready to:- Build interactive video AI apps
- Customize agent behavior
- Trigger image changes and respond to events
Receiving Events
Hook into the Daily event handler to get LemonSlice-specific events.| Event Type | Description |
|---|---|
bot_ready | Fired when the LemonSlice agent has successfully joined the Daily room and is ready to send and receive audio and video. |
idle_timeout | Emitted when the agent stops due to inactivity. The idle timeout threshold is defined by the agent’s configuration. |
user_transcription | Emitted when the user’s speech has been finalized. Includes the field transcription. This event also captures messages sent by the user via text. |
agent_transcription | Emitted when the agent’s response has been finalized. Includes the field transcription. |
image_change_requested | A new agent look has been requested, typically after an /imagine request is made. |
image_created | A new agent look has been created and is available for use. |
image_change_complete | The agent’s look has finished updating and the new look is now active. |
image_change_error | The agent failed to update its look. Includes an error field with additional details. |
daily_error | A Daily-related error occurred. Includes error and fatal fields. |
video_generation_error | A failure occurred while generating a video segment or rendering agent output. |
Full event handler
Control Events
Send events through Daily to control the LemonSlice agent.| Control Event | Description |
|---|---|
chat-msg | Send a message to the agent for it to respond to. Also supports triggering avatar image changes via /imagine (see Avatar image changes with /imagine). |
force-end | Immediately stop the realtime agent. The agent will leave the room and billing will stop. |
Sending Events
Avatar image changes with /imagine
The chat-msg control event also supports avatar image updates using a special /imagine prefix.When a message begins with
/imagine, LemonSlice interprets the remainder of the message as an image prompt and updates the agent’s avatar accordingly.
Example
How it works
- Messages starting with
/imaginedo not trigger a spoken response - Instead, the agent’s avatar image is regenerated based on the prompt
- The avatar retains its core identity and proportions, while updating the visual context
- Once the image update completes, the agent continues normal interaction
Agent setup requirement:
Allow users to modify appearancemust be enabled in the agent configuration. This setting is enabled by default for all newly created agents.
