stupid question, how can i delete an existing clou...
# ask-ai
r
stupid question, how can i delete an existing cloud agent? dont see a button anywhere lol
t
Thanks for reaching out, Henryk. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
If you want to delete a cloud agent in LiveKit, you can do it easily either through the LiveKit CLI or the SDK. Here’s how: Using the LiveKit CLI:
Copy code
lk agent delete --id <agent_id>
or
Copy code
lk agent destroy --id <agent_id>
Don’t worry, these commands will ask you to confirm before actually deleting the agent. Using the SDK:
Copy code
client := lksdk.NewAgentClient(url, apiKey, apiSecret)
resp, err := client.DeleteAgent(ctx, &livekit.DeleteAgentRequest{
    AgentId: "your-agent-id",
})
If you have any questions or need a hand with this, just let me know—I’m here to help! Sources: livekit/livekit_cloud_agent.pb.go | LiveKit CLI | livekit/livekit_composite | DeepWiki | Agent deployment CLI reference | LiveKit Docs | agent_client.go
r
a different question, isit possible to extract the transcript from the livekit agent and send it to a webhook? currently not having luck with it, guess i want to check if livekit provides this kind of option at all?
t
LiveKit doesn’t have built-in support for sending transcripts directly to a webhook, but no worries—you can definitely set this up yourself! Could you tell me a bit more about your setup? • Are you working with Python, Node.js, or another language for your agent? • Do you want to capture interim transcripts, final transcripts, or both? • Is this mainly for compliance logging, analysis, or something else? Once I have a better idea, I’d be happy to walk you through how to make it happen. Sources: agents/CHANGELOG.md | AI voice agents | LiveKit Docs | Transcriptions | LiveKit Docs | Text and transcriptions | LiveKit Docs | Transcriptions | LiveKit Docs
r
got something like this: class CallTracker: """Track call metrics, costs, and transcript for webhook reporting""" def __init__(self): self.start_time = time.time() self.transcript_events: List[Dict[str, Any]] = [] self.llm_tokens = {"input": 0, "output": 0} self.stt_usage = {"duration_seconds": 0, "requests": 0} self.tts_usage = {"characters": 0, "requests": 0} self.call_duration = 0 self.room_name = "" self.call_id = "" def add_transcript_event(self, _speaker_: str, _text_: str, _timestamp_: float = None): """Add a transcript event""" if timestamp is None: timestamp = time.time() self.transcript_events.append({ "timestamp": timestamp, "speaker": speaker, "text": text, "relative_time": timestamp - self.start_time }) def add_llm_usage(self, _input_tokens_: int = 0, _output_tokens_: int = 0): """Track LLM token usage""" self.llm_tokens["input"] += input_tokens self.llm_tokens["output"] += output_tokens def add_stt_usage(self, _duration_: float = 0): """Track STT usage""" self.stt_usage["duration_seconds"] += duration self.stt_usage["requests"] += 1 def add_tts_usage(self, _characters_: int = 0): """Track TTS usage""" self.tts_usage["characters"] += characters self.tts_usage["requests"] += 1 def finalize_call(self): """Finalize call tracking""" self.call_duration = time.time() - self.start_time def estimate_costs(self) -> Dict[str, float]: """Estimate costs based on usage""" costs = {} # OpenAI GPT-4o-mini pricing (approximate) costs["llm_input"] = (self.llm_tokens["input"] / 1000000) * 0.15 # $0.15 per 1M input tokens costs["llm_output"] = (self.llm_tokens["output"] / 1000000) * 0.60 # $0.60 per 1M output tokens costs["llm_total"] = costs["llm_input"] + costs["llm_output"] # Deepgram pricing (approximate) costs["deepgram"] = (self.stt_usage["duration_seconds"] / 60) * 0.0043 # $0.0043 per minute # Cartesia pricing (approximate) costs["cartesia"] = (self.tts_usage["characters"] / 1000000) * 5.0 # $5 per 1M characters # Total estimated cost costs["total_estimated"] = costs["llm_total"] + costs["deepgram"] + costs["cartesia"] return costs def to_webhook_payload(self) -> Dict[str, Any]: """Convert tracking data to webhook payload""" costs = self.estimate_costs() return { "event_type": "call_completed", "timestamp": datetime.now().isoformat(), "call_info": { "call_id": self.call_id, "room_name": self.room_name, "duration_seconds": self.call_duration, "start_time": datetime.fromtimestamp(self.start_time).isoformat() }, "transcript": self.transcript_events, "usage_stats": { "llm_tokens": self.llm_tokens, "stt_usage": self.stt_usage, "tts_usage": self.tts_usage }, "cost_estimates": costs } for so yeah for logging mostly and analysis
t
Thanks so much for sharing your setup! Your
CallTracker
class looks nicely organized for tracking and getting data ready for webhook reporting. To bring LiveKit's transcription data into the mix, you can catch transcription events and add them to your
transcript_events
list. Here’s a simple way to go about it: 1. Catch Transcription Events: Tune into LiveKit’s transcription stream (like the
lk.transcription
topic) to get real-time transcription updates. If you’re using Python, the
STTSegmentsForwarder
class is great for handling events such as
FINAL_TRANSCRIPT
. 2. Update Your
add_transcript_event
Method:
When you receive a transcription event, just call
add_transcript_event
with the speaker, text, and timestamp from that event. 3. Send to Webhook: After the call wraps up, use your
to_webhook_payload
method to get the payload ready, then send it off to your webhook endpoint using an HTTP client like
requests
. If you’d like a hand with the exact code for grabbing transcription events or sending the webhook, just give me a shout—I’m happy to help!
r
aweomse, can you explain to me what ingress and egress are?
t
In LiveKit, Ingress and Egress are just fancy terms for how media flows into and out of a session: • Ingress: Think of this as bringing in external media streams (like RTMP or WHIP) into a LiveKit room. It’s like a friendly bridge that lets outside sources join your WebRTC session. People often use it for streaming from OBS Studio, broadcasting pre-recorded videos, or connecting older video systems. • Egress: This is all about sending media out—whether you want to record the session, create cool composite recordings (like full-room views), or stream out to RTMP endpoints. It supports lots of output formats and destinations, including cloud storage or CDNs. Both Ingress and Egress show up as special participant types in LiveKit and come with their own handy APIs to manage them. If you want to dive deeper into either one, just let me know—I’m here to help! Sources: Sources/LiveKit/Protos/livekit_models.pb.swift | livekit-protocol/src/livekit.rs | Deploy to a VM | LiveKit Docs | Ingress & Media Input | livekit/livekit_composite | DeepWiki | LiveKit Server Components | livekit/livekit_composite | DeepWiki
r
so can egress record my calls and send the audio to somewhere?
t
Absolutely! LiveKit Egress can definitely record your calls and send the audio wherever you need it. Here are some of the main options you can choose from: • Room Composite Egress: This lets you record all participants in a room and export just the audio by setting the
audio_only
parameter to true. You can then save that audio to cloud storage services like AWS S3, Google Cloud Storage, or Azure Blob Storage. • Track Egress: If you want to send individual audio tracks straight to a destination without any transcoding, this is perfect. It’s great for streaming audio to things like captioning systems via WebSocket. • RTMP Streaming: You can also stream audio live to platforms like YouTube Live, Twitch, or Facebook using RTMP(S). If you want, I’d be happy to help you get any of these set up—just let me know! Sources: Recording and composition | LiveKit Docs | protobufs/livekit_egress.proto | Recording agent sessions | LiveKit Docs | Egress Overview | LiveKit Docs