It's recommended to separate the document ingestion function into another application, such as a Next.js app, rather than keeping it within your LiveKit agent. This approach aligns with LiveKit's architectural patterns and offers several benefits:
•
Performance Optimization: LiveKit agents are optimized for real-time processing, while document ingestion can be resource-intensive and may interfere with the agent's responsiveness.
•
Scalability: Separating ingestion allows you to scale document processing independently without affecting agent performance.
•
Security: A Next.js app can securely handle file uploads, document storage, and token management.
•
Development Flexibility: This separation allows frontend and agent developers to work independently, streamlining workflows.
For communication, you can use RPC calls between the Next.js app and the agent. This setup ensures each component focuses on its core strengths while maintaining flexibility and scalability.
Sources:
complex-agents/drive-thru/frontend/README.md |
client-sdk-js | livekit/livekit_composite | DeepWiki |
agents/src/index.ts |
server-sdk-js | livekit/livekit_composite | DeepWiki