Skip to main content

What is a Session?

A session is a single conversation between a user and an agent. When a user clicks “Start” or loads your agent, a session begins. The session includes:
  • Real-time video/audio - WebRTC connection via Daily.co
  • Conversation state - The ongoing dialogue between user and agent
  • Tool executions - Any tools the agent calls during the conversation
Sessions end when the user disconnects, closes the tab, or the connection times out.
Single-Use vs Permanent agents: Single-Use agents can only have one session—the agent expires after it ends. Permanent agents can have unlimited sessions using the same agent ID.

Deployment Options

There are three ways to deploy your agents:

Option 1: Hosted Page

The fastest way to deploy—just share a URL.
https://meet.iwy.ai/YOUR_AGENT_ID
When someone visits this URL with a valid agent ID, a session starts automatically. No code required. Use cases:
  • Share a link via email, SMS, or QR code
  • Embed in calendar invites
  • Quick demos and testing
Example:
https://meet.iwy.ai/550e8400-e29b-41d4-a716-446655440000
Works with both Single-Use and Permanent agent IDs.

Option 2: Embeddable Widgets

Drop-in web components that you embed directly in your website. The widgets handle all session management automatically—users just click to start. Repository: github.com/iwy-ai/live-widgets npm: @iwy/live-widgets

Quick Start

Add the script tag and component to your HTML:
<!-- The widget component -->
<live-avatar agentid="YOUR_AGENT_ID"></live-avatar>

<!-- Load the widget script -->
<script src="https://unpkg.com/@iwy/live-widgets@latest/dist/live-avatar.min.js"></script>
That’s it. When a user clicks the widget, a session starts automatically.

Via npm

npm install @iwy/live-widgets
import '@iwy/live-widgets';

function App() {
  return <live-avatar agentid="YOUR_AGENT_ID"></live-avatar>;
}

Widget Options

AttributeRequiredDescription
agentidYesYour agent’s UUID (Single-Use or Permanent)
Use cases:
  • Customer support widget on your website
  • Sales agent embedded in product pages
  • Interactive demos in documentation
The widget calls the /start-agent-session endpoint automatically when clicked. You don’t need to make any API calls yourself.

Option 3: Custom Integration

For full control over the UI and experience, use the /start-agent-session endpoint directly with the Daily.co SDK.

How It Works

  1. Call the API to get connection credentials
  2. Use Daily.co SDK to join the room with your own UI
  3. Handle events for custom behavior

Step 1: Get Session Credentials

curl -X POST https://api.iwy.ai/v1/start-agent-session \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "YOUR_AGENT_ID"
  }'
Response:
{
  "roomUrl": "https://iwy.daily.co/room-abc123",
  "dailyToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "webLink": "https://app.iwy.ai/call/room-abc123"
}
FieldDescription
roomUrlDaily.co room URL for SDK connection
dailyTokenAuthentication token for the room
webLinkBrowser-accessible link (no SDK required)

Step 2: Connect with Daily.co SDK

TypeScript/JavaScript:
import DailyIframe from '@daily-co/daily-js';

// Create the call frame
const callFrame = DailyIframe.createFrame({
  iframeStyle: {
    width: '100%',
    height: '100%',
  },
});

// Join the session
await callFrame.join({
  url: roomUrl,      // from API response
  token: dailyToken, // from API response
});

// Handle events
callFrame.on('left-meeting', () => {
  console.log('Session ended');
});
React:
import { DailyProvider, DailyVideo } from '@daily-co/daily-react';

function VideoSession({ roomUrl, token }) {
  return (
    <DailyProvider url={roomUrl} token={token}>
      <DailyVideo />
    </DailyProvider>
  );
}

Daily.co SDK Resources

Use cases:
  • Custom video UI matching your brand
  • Mobile apps (iOS, Android, React Native)
  • Advanced features (recording, transcription, custom controls)
  • Integration with existing video infrastructure

Comparison

FeatureHosted PageWidgetsCustom Integration
Setup timeNone5 minutesHours
Custom UINoLimitedFull control
Code requiredNoMinimalYes
Mobile appsBrowser onlyBrowser onlyNative SDKs
Brandingiwy brandedCustomizableFully custom
Best forQuick sharingWebsite embedCustom apps

Session Management Pipeline

What happens under the hood when a user starts a session? iwy session management pipeline -- light mode

Sequence diagram showing iwy’s session management pipeline: agent provisioning, model orchestration, real-time WebRTC streaming, and analytics data flow. © iwy.ai 2025

Pipeline Steps

  1. Session Request - User clicks widget, visits URL, or your app calls the API
  2. Agent Provisioning - iwy loads the agent configuration
  3. Room Creation - Daily.co room is provisioned for WebRTC
  4. Model Orchestration - LLM, STT, TTS, and video models are initialized
  5. WebRTC Connection - Real-time audio/video stream established
  6. Conversation Loop - Speech → Text → LLM → Text → Speech → Video
  7. Analytics - Session data captured for insights
  8. Session End - Resources released, data persisted

Quick Reference

DeploymentWhen to UseGetting Started
meet.iwy.ai/{id}Share a link, quick demosJust share the URL
<live-avatar> widgetEmbed on websiteAdd script + component
/start-agent-session APICustom UI, mobile appsCall API + use Daily.co SDK

Support

Need help? Contact us