https://retellai.com/?utm_source=discord&utm_medium=seo logo
Can I use a custom llm with multiple workspaces
# ❓・ai-evy-support
u
@AI Evy Can I use a custom llm with multiple workspaces?
a
Thanks for tagging me @-Ace. I'll look through relevant sources and get back to you shortly.
### Answer Yes, you can use a custom LLM with multiple workspaces. When you set up a custom LLM integration, you configure it at the agent level by providing your
llm_websocket_url
[(1) ]() [(2) ]() . Each workspace can have its own agents, and each agent can point to the same or different custom LLM WebSocket endpoints [(2) ]() . The custom LLM works through the LLM WebSocket and doesn't require any special setting to be enabled on the account [(3) ]() . You simply need to: 1. Deploy your WebSocket backend (Node.js or Python) [(1) ]() [(4) ]() 2. Configure each agent in your workspaces with your custom LLM WebSocket URL [(2) ]() 3. Point to your endpoint:
{your-server-websocket-endpoint}/{call_id}
The workspace feature allows you to create different organizations for clients or invite teammates [(5) ]() , and each workspace can independently configure agents with custom LLM integrations.
​ To learn more, see the sources I considered: [[1] Custom LLM Overview](https://docs.retellai.com/integrate-llm/overview) [[2] LLM WebSocket](https://docs.retellai.com/api-references/llm-websocket) [[3] Custom LLMs](https://discord.com/channels/1186424376300679209/1396099334432489524) [[4] Integrate LLM](https://docs.retellai.com/integrate-llm/integrate-llm) [[5] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
u
Can you tell me when the webhooks would be used with custom llm?
@AI Evy Can you tell me when I would use this part? @app.post("/webhook") async def handle_webhook (request: Request): try: post_data = await request.json() valid_signature = retell.verify( json.dumps(post_data, separators=(",", ":"), ensure_ascii=False), api_key=str(os.environ["RETELL_API_KEY"]), signature=str(request.headers.get("X-Retell-Signature")), ) if not valid_signature: print( "Received Unauthorized", post_data["event"], post_data["call"]["call_id"], ) return JSONResponse(status_code=401, content={"message": "Unauthorized"}) if post_data["event"] == "call_started": print("Call started event", post_data["call"]["call_id"]) elif post_data["event"] == "call_ended": print("Call ended event", post_data["call"]["call_id"]) elif post_data["event"] == "call_analyzed": print("Call analyzed event", post_data["call"]["call_id"]) else: print("Unknown event", post_data["event"]) return JSONResponse(status_code=200, content={"received": True}) except Exception as err: print(f"Error in webhook: {err}") return JSONResponse( status_code=500, content={"message": "Internal Server Error"} )
a
Thanks for the follow-up, @-Ace. I'll get back to you soon.
### Answer You would use this webhook handler to receive real-time notifications about call events from Retell AI [(1) ]() . The webhook endpoint receives POST requests containing event data and the call object . When to use webhooks with custom LLM: Webhooks work alongside your custom LLM WebSocket to track call lifecycle events . While your custom LLM handles the conversation logic, webhooks notify you when: - **call_started**: A new call begins - **call_ended**: A call completes, transfers, or encounters an error - **call_analyzed**: Call analysis is complete (includes sentiment, summary, custom data extraction) Common use cases: 1. **Real-time Analytics**: Track call statistics, monitor volumes and patterns, trigger alerts for specific outcomes 2. **System Integration**: Update CRM records when calls complete, trigger workflow automations based on call analysis 3. **Monitoring**: Get notified of failed or transferred calls, track duration and completion status How the code works: The webhook handler verifies the request signature using your API key and the
x-retell-signature
header . This ensures the webhook comes from Retell . After verification, it processes different event types and returns a 200 status code to acknowledge receipt . The webhook has a 10-second timeout and will retry up to 3 times if no success status (2xx) is received . Events are triggered in order but are non-blocking . You register webhooks either at the account level (dashboard webhooks tab) or agent level (via
webhook_url
field when creating agents) .
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.