I am not getting transcripts
# ask-ai
a
I am not getting transcripts
t
Thanks for reaching out, Hanika. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re not getting transcripts. I can help troubleshoot, but I need a few details to pinpoint the cause. Could you tell me: • Are you expecting speech-to-text (user audio → transcription) or text responses generated by the agent (agent text output)? • Do you have an STT provider configured for the agent (for example Deepgram, Google Cloud, etc.)? If so, which provider? • Are you receiving the
lk.transcription
text stream topic on the frontend? (This is how frontend clients typically receive live transcriptions.) • Are you using
AgentSession
? If yes, is
text_output
enabled for that session? • Are you testing in the LiveKit Console/playground or in your own app? (The Console/playground does not display text-only agent responses unless you add a custom receiver.) • Do your server or client logs show any errors related to STT, VAD, or transcription delivery? If so, please paste relevant log lines or error messages. If you prefer, share the minimal relevant config (redact any secrets): STT provider config, AgentSession settings, and how your frontend subscribes to text streams. Once you share these, I’ll suggest the next steps to get transcripts appearing. Sources: Text and transcriptions | LiveKit Documentation | How to build an agent with speech-to-text input and text-only output | Live...
a
i am using livekit cloud
t
Thanks — that’s helpful. Since you’re using LiveKit Cloud, I can walk you through the most likely causes and collect a couple quick details to narrow it down. Could you confirm the following? • Are you expecting speech-to-text (live transcriptions of participant audio) or text responses produced by an AI agent? • Have you configured an STT provider for your project (for example Deepgram or Google Cloud)? If yes, which provider and have you added its API key/credentials to your LiveKit Cloud project? • On the client, are you subscribed to the
lk.transcription
text stream topic (or using the SDK equivalent) so your frontend can receive transcription events? • Are you using
AgentSession
for the agent flow? If yes, is
text_output
enabled on that session? • Are you testing in the LiveKit Console/playground or in your own app? (Note: the console/playground does not show text-only agent responses unless you add a custom receiver.) • Do you see any errors in server or client logs related to STT, VAD, or transcription delivery? If so, please paste the relevant log lines (redact secrets). If you prefer, paste a minimal, redacted copy of: • your STT provider config, • the AgentSession config (or agent settings), • and the client code snippet showing how you subscribe to text streams. Once you share those details I’ll tell you the most likely fix and step-by-step actions to get transcripts working.
a
i am using grok realtime
where do i get agentsession cofig
t
Thanks — that helps. You asked where to get the
AgentSession
config when using Grok realtime on LiveKit Cloud. I’ll keep this short and show exactly where to define it and what to change so you can receive transcripts. 1) Where you define
AgentSession
• You create
AgentSession
in your agent code (typically a Python file like
agent.py
) inside the RTC session handler (e.g., inside your
@server.rtc_session()
function). This is the place to pass in the LLM, STT plugin, and session options. 2) Why transcripts aren’t appearing with Grok realtime • Grok is a realtime model and does not emit user speech transcriptions by default. Realtime models often do not provide interim transcription results and user transcripts can be delayed or absent unless you explicitly add transcription support. 3) How to enable transcripts — two options • Option A — Add an STT plugin (recommended for live user transcripts) a. Add an STT provider when creating the session (example using Deepgram):
Copy code
from livekit.agents import AgentSession
     from livekit.plugins import xai, deepgram

     session = AgentSession(
         llm=xai.realtime.RealtimeModel(),  # Grok realtime
         stt=deepgram.STT(),                # enables user_input_transcribed events
     )
1. Listen for
user_input_transcribed
events:
Copy code
@session.on("user_input_transcribed")
     async def on_transcript(event):
         if event.is_final:
             print("User said:", event.transcript)
• Option B — If you need the agent’s spoken text (agent output) as transcripts a. Enable
text_output
in `AgentSession`:
Copy code
session = AgentSession(
         llm=xai.realtime.RealtimeModel(),
         text_output=True,
     )
1. Handle the agent output event to capture the text response. 4) Additional notes • If you want speech timing for agent speech, implement a
transcription_node
in your agent to stream timing/chunk info. • If you’re testing in the LiveKit Console/playground: text-only agent responses aren’t shown by default there — you’ll need a custom receiver in your client to display them. 5) Links you can use • AgentSession reference: https://docs.livekit.io/agents/logic/sessions/ • Grok realtime plugin guide: https://docs.livekit.io/agents/models/realtime/plugins/xai/ • Text and transcriptions: https://docs.livekit.io/agents/multimodality/text/ If you’d like, paste a redacted snippet of your current
agent.py
(the part where you construct
AgentSession
) and I’ll point out the exact lines to change to enable transcripts. Sources: Introducing the Grok Voice Agent API in partnership with xAI | xAI Grok Voice Agent API plugin | LiveKit Documentation | Realtime models overview | LiveKit Documentation | Repeater | LiveKit Documentation | LiveKit turn detector plugin | LiveKit Documentation
a
llm = await create_xai_realtime_llm(xai_module=xai, voice="ara") logger.warning("✅ LLM FACTORY returned llm=%s", type(llm)) session = AgentSession( llm=llm, ) def _is_meaningful_transcript(text: str) -> bool: t = (text or "").strip().lower() if not t: return False
t
Thanks — I can see your current snippet creates a Grok realtime LLM but does not enable any transcription options. I can help you make the exact changes you need; first, two quick clarifying questions so I give the right code: 1. Do you want transcripts of the participant's speech (speech-to-text) or the agent’s text responses (agent output)? 2. Do you already have an STT provider set up in your LiveKit Cloud project (for example Deepgram, AssemblyAI, Google Cloud)? If yes, which one? If you want a direct edit you can try right away, here are the two common edits depending on your answer. • If you want user speech-to-text (recommended for live transcripts) a. Add an STT plugin when creating the session. Example (Deepgram shown — replace with your provider):
Copy code
from livekit.plugins import deepgram

     session = AgentSession(
         llm=llm,
         stt=deepgram.STT(),  # enable user_input_transcribed events
     )
1. Listen for transcripts:
Copy code
@session.on("user_input_transcribed")
     async def on_transcript(event):
         if event.is_final:
             text = event.transcript
             if _is_meaningful_transcript(text):
                 <http://logger.info|logger.info>("User said: %s", text)
• If you want the agent’s text output (text of what Grok is saying) a. Enable
text_output
on the session:
Copy code
session = AgentSession(
         llm=llm,
         text_output=True,  # receive agent responses as text events
     )
1. Handle agent text events (example event name may vary by SDK):
Copy code
@session.on("agent_text_response")
     async def on_agent_text(resp):
         text = resp.text
         if _is_meaningful_transcript(text):
             <http://logger.info|logger.info>("Agent said (text): %s", text)
If you tell me which option you need and whether you have an STT provider configured, I’ll give the exact drop-in code for your snippet and the precise event names to listen for.
a
i want the complete conversation between agent and caller
t
Thanks — great goal. I’ll show exactly how to capture the complete conversation (both caller speech → transcripts and the agent’s text responses) when using Grok realtime on LiveKit Cloud. I’ll include the minimal changes to your snippet, how to collect events, and notes about credentials and storage. Before the code: two quick confirmations (if you already have these, skip them) • Which STT provider will you use (Deepgram, AssemblyAI, Google Cloud, etc.)? You’ll need its credentials added to your LiveKit Cloud project. • Where do you want to store the conversation (simple file, database, or external logging)? I’ll show a file example; I can adapt to DB if you prefer. What we’ll do • Add an STT plugin to capture participant (caller) speech as
user_input_transcribed
. • Enable
text_output
on the AgentSession to receive agent text responses. • Wire handlers that capture and append both sides into a unified transcript (with timestamps and role). Drop-in example (modify provider class to your STT plugin and add credentials to LiveKit Cloud): 1) Agent session setup (insert into your agent code where you create the session)
Copy code
from datetime import datetime
from livekit.agents import AgentSession
# Replace with the STT plugin you will use. Example uses deepgram plugin name.
from livekit.plugins import deepgram

llm = await create_xai_realtime_llm(xai_module=xai, voice="ara")
logger.warning("✅ LLM FACTORY returned llm=%s", type(llm))

session = AgentSession(
    llm=llm,
    stt=deepgram.STT(),    # enable user speech transcription events
    text_output=True,      # enable agent text output events
)
2) Helper to format and persist conversation lines
Copy code
def _format_line(role: str, text: str) -> str:
    ts = datetime.utcnow().isoformat() + "Z"
    return f"{ts} [{role}]: {text}\n"

# Simple file append storage (replace with DB call if needed)
TRANSCRIPT_FILE = "/tmp/conversation_transcript.txt"

def _append_to_transcript(role: str, text: str):
    line = _format_line(role, text)
    with open(TRANSCRIPT_FILE, "a", encoding="utf-8") as f:
        f.write(line)
    <http://logger.info|logger.info>("Transcript appended: %s", line.strip())
3) Handle user speech transcripts
Copy code
@session.on("user_input_transcribed")
async def on_user_transcribed(evt):
    # evt.transcript, evt.is_final, evt.start_time, evt.end_time (if provided)
    if not getattr(evt, "is_final", False):
        return
    text = getattr(evt, "transcript", "").strip()
    if not _is_meaningful_transcript(text):
        return
    _append_to_transcript("caller", text)
4) Handle agent text output
Copy code
@session.on("agent_text_response")  # actual event name may be "agent_text" or similar
async def on_agent_text(evt):
    # evt.text or evt.response_text depending on SDK; adjust as needed
    text = getattr(evt, "text", None) or getattr(evt, "response_text", "")
    text = (text or "").strip()
    if not text:
        return
    _append_to_transcript("agent", text)
Notes on event names and fields • The SDK/event names can vary slightly. Common events to listen for: ◦
user_input_transcribed
— carries
.transcript
and
.is_final
. ◦
agent_text_response
(or similar) — carries agent textual output in
.text
or
.response_text
. • If an event name above is not firing in your environment, paste one example log of incoming session events and I’ll map the exact names to use. Timestamps and speech timing • STT plugins often supply
start_time
and
end_time
for user phrases; include them in the transcript if you need precise timing. • Grok realtime may not provide interim user transcripts and agent transcript timing can be delayed; you’ll still capture the final textual content by using an STT plugin +
text_output=True
. Required setup steps (checklist) • Add STT provider credentials to your LiveKit Cloud project (project settings). • Ensure your agent server has network access and correct environment variables for the STT plugin. • Confirm the session is created with
stt=
and
text_output=True
. • Make sure the client subscribes to text stream events, if you want client-side display in addition to server-side storage. If you want, I can: • Provide an adjusted snippet if your STT provider is not Deepgram (tell me which one). • Change the storage example to a DB schema (Postgres/Mongo) or to upload to object storage. • Inspect logs or a sample event payload if the handlers above don’t fire. Which STT provider are you using, and do you want file or DB storage for the full transcript?
a
this was making it work before
t
Thanks — that screenshot and your note that “this was making it work before” is very helpful. I’ll walk you through the exact checks and minimal changes to restore a full conversation transcript (caller speech + agent text) when using Grok realtime on LiveKit Cloud. What I’m responding to • Your code creates a Grok realtime LLM but doesn’t enable transcription. • You shared a dashboard screenshot showing the “Agent observability” setting. • You said the previous configuration “was making it work before,” so something likely changed in either the agent session config, STT credentials, or the project observability setting. Quick summary of what to enable to capture the complete conversation • Enable an STT plugin on your AgentSession to get caller (user) speech transcripts. • Enable
text_output
on your AgentSession to capture agent text responses. • Ensure the LiveKit Cloud project-level “Agent observability” (which captures traces, transcripts, audio) is enabled if you want LiveKit to collect/forward transcripts centrally. • Confirm STT provider credentials are present in your LiveKit Cloud project settings. Immediate checklist — run through these items • Dashboard: Confirm “Agent observability” is Enabled in the project settings (your screenshot shows an “Agent observability” control — keep it Enabled). This allows capture of traces/transcripts at the project level. • STT provider: Verify you still have STT credentials configured in the LiveKit Cloud project (Deepgram, AssemblyAI, Google, etc.). If those creds expired or were removed, transcripts will stop. • AgentSession: Update your agent code to include both
stt=
and
text_output=True
when creating the session (see exact drop-in below). • Event handlers: Add handlers for
user_input_transcribed
(user speech) and the agent text events to persist both sides of the conversation. Drop-in edits for your snippet • Replace the session creation with this (adjust
deepgram.STT()
to your provider if different):
Copy code
from livekit.agents import AgentSession
from livekit.plugins import deepgram  # replace with your STT plugin

llm = await create_xai_realtime_llm(xai_module=xai, voice="ara")
logger.warning("✅ LLM FACTORY returned llm=%s", type(llm))

session = AgentSession(
    llm=llm,
    stt=deepgram.STT(),   # enables caller speech transcripts
    text_output=True,     # enables agent text responses
)
• Add handlers to capture and persist conversation lines:
Copy code
from datetime import datetime

def _format_line(role: str, text: str) -> str:
    ts = datetime.utcnow().isoformat() + "Z"
    return f"{ts} [{role}]: {text}\n"

TRANSCRIPT_FILE = "/tmp/conversation_transcript.txt"

def _append_to_transcript(role: str, text: str):
    line = _format_line(role, text)
    with open(TRANSCRIPT_FILE, "a", encoding="utf-8") as f:
        f.write(line)
    <http://logger.info|logger.info>("Transcript appended: %s", line.strip())

@session.on("user_input_transcribed")
async def on_user_transcribed(evt):
    if not getattr(evt, "is_final", False):
        return
    text = getattr(evt, "transcript", "").strip()
    if not _is_meaningful_transcript(text):
        return
    _append_to_transcript("caller", text)

@session.on("agent_text_response")  # if this event name doesn't match, I can map the exact server event name for you
async def on_agent_text(evt):
    text = getattr(evt, "text", None) or getattr(evt, "response_text", "")
    text = (text or "").strip()
    if not text:
        return
    _append_to_transcript("agent", text)
Notes and common pitfalls • Event names/fields can vary slightly by SDK version. If
agent_text_response
or field names don’t fire, paste a sample event payload and I’ll map it exactly. • Realtime models (Grok) may not emit interim user transcriptions; you’ll get final transcripts via the STT plugin. • If transcripts were working before and stopped: ◦ Check STT API key validity/permissions in the LiveKit Cloud project settings. ◦ Confirm “Agent observability” is still Enabled (your screenshot is the right place). ◦ Check agent server logs for STT or VAD errors; paste any error lines and I’ll interpret them. • Storage: I showed a simple file example. I can convert that to DB or object storage if you prefer. If you want, next steps I can take for you • Provide the exact event names for your SDK version if you paste one raw event payload (server log). • Give the specific deepgram/assemblyai config snippet if you tell me which provider you use. • Convert file storage to Postgres/Mongo or show how to add timestamps/start/end times from STT events. Which STT provider are you using, and can you confirm Agent observability is still Enabled in the project settings? If you prefer, paste one example log line from when the session starts and I’ll point to the exact event names to wire up.
a
i am using grok realtime voice .. so no STT is being used and it was working well
t
Thanks — that clarifies things. You’re using Grok realtime voice (no STT) and it previously produced the conversation you needed. I’ll summarize exactly what’s possible, what likely changed, and the minimal fixes so you again capture the complete conversation (agent text + caller speech if desired). What’s possible with Grok realtime • Grok realtime is a voice-capable realtime model but does not run a built-in STT pipeline for caller audio. That means: ◦ Agent-generated text responses are available if you enable
text_output
on the
AgentSession
. ◦ Caller (user) speech transcripts are NOT available unless you add a separate STT plugin (Deepgram, AssemblyAI, etc.). • If transcripts worked before without an STT plugin, you were likely receiving agent text output (via
text_output
) and possibly project-level observability was forwarding events — not a built-in caller STT. Most likely causes for transcripts stopping •
text_output
was removed or not set on the
AgentSession
. • Project-level Agent observability was toggled Off in the LiveKit Cloud dashboard. • Event handler names changed or your code stopped subscribing to the correct agent text event. • SDK version change altered event field names. Minimal drop-in to restore agent+caller capture • If you only want agent text (no STT), ensure
text_output=True
and capture the agent text event. • If you want both sides, add an STT plugin to the session (one-time change) and capture
user_input_transcribed
. Example (modify to match your environment): 1) Ensure project setting • Dashboard → Data and privacy → Agent observability = Enabled (your screenshot shows this control). 2) AgentSession creation (Grok realtime LLM + agent text)
Copy code
from livekit.agents import AgentSession
# Grok realtime LLM already created in your code as `llm`
llm = await create_xai_realtime_llm(xai_module=xai, voice="ara")

session = AgentSession(
    llm=llm,
    text_output=True,   # required to receive agent text responses
)
3) Capture agent text (write to file / DB)
Copy code
from datetime import datetime
TRANSCRIPT_FILE = "/tmp/conversation_transcript.txt"

def _append_to_transcript(role: str, text: str):
    ts = datetime.utcnow().isoformat() + "Z"
    with open(TRANSCRIPT_FILE, "a", encoding="utf-8") as f:
        f.write(f"{ts} [{role}]: {text}\n")

@session.on("agent_text")  # event name may be 'agent_text', 'agent_text_response', or similar
async def on_agent_text(evt):
    text = getattr(evt, "text", None) or getattr(evt, "response_text", "")
    if text and text.strip():
        _append_to_transcript("agent", text.strip())
4) (Optional) Add caller speech transcripts • If you want the caller’s spoken words too, add an STT plugin:
Copy code
from livekit.plugins import deepgram  # or your provider

session = AgentSession(
    llm=llm,
    stt=deepgram.STT(),
    text_output=True,
)
• Then capture `user_input_transcribed`:
Copy code
@session.on("user_input_transcribed")
async def on_user_transcribed(evt):
    if not getattr(evt, "is_final", False):
        return
    text = getattr(evt, "transcript", "").strip()
    if text:
        _append_to_transcript("caller", text)
If it was “working before” without adding STT • Double-check that
text_output=True
was present before and that Agent observability remained Enabled. • If logs show agent text events being emitted under a different name, paste one raw event payload and I’ll map the exact event/field names for your SDK version. What I need if this still doesn’t restore transcripts • A short paste of your current
AgentSession
creation (the exact lines where you create
session
) and any session event handler code you have now. • One example server log line showing an incoming agent event payload (redact secrets). That lets me tell you the exact event name/field to subscribe to. Would you like me to produce a full ready-to-run agent.py example that: • captures agent text, • optionally includes Deepgram STT, and • writes the full conversation to a Postgres or file storage? Tell me which storage you prefer and paste your current
AgentSession
lines (if different from above) and I’ll give the exact drop-in file.
a
but it is working in my other project without doing all this ?
t
Thanks — that makes sense, and I totally get why this is confusing. If one project produces transcripts without extra config while another doesn’t, it usually means something is enabled at the project level (or a SDK/version difference) in the working project that isn’t set in the one where it’s failing. To pinpoint the difference quickly, could you check and share the following from the project where transcripts are working (redact any secrets)? • Is Agent observability enabled in that project’s Dashboard → Data and privacy? (Your earlier screenshot shows that control — please confirm it’s Enabled in the working project.) • Is an STT provider configured at the project level (Deepgram, AssemblyAI, Google Cloud, etc.)? If yes, which provider? • The exact lines where you create the session in the working project (the
AgentSession(...)
code). You can redact keys; I just need the parameters used (for example whether
text_output=True
or
stt=
is present). • The LiveKit Agents SDK version used in both projects (e.g., the package version from your requirements or pip freeze). • Any differences in your agent startup or environment between the two projects (for example different environment variables, or different project settings like observability or recording). What I’ll do with that info • Compare the two configs and tell you exactly which setting or default is making transcripts appear automatically in the working project. • Give you the minimal change to apply to the failing project (often either enabling Agent observability in the dashboard, adding a project-level STT key, or adding
text_output=True
to your
AgentSession
). • If it’s an SDK version issue, I’ll point to the exact version and the change you can make (either upgrade/downgrade or set the explicit flag). If you’d rather not copy configs, you can simply tell me: • Is Agent observability Enabled in the working project? (yes/no) • Is there a project-level STT provider configured? (yes/no and which one) • Do you see
text_output=True
or
stt=
when creating
AgentSession
in the working project? (yes/no) Send whichever is easiest and I’ll map out the one-line change to make the current project behave the same.
a
• Is Agent observability Enabled in the working project? (yes/no) -- yes Is there a project-level STT provider configured? (yes/no and which one) -- no • Do you see
text_output=True
or
stt=
when creating
AgentSession
in the working project? (yes/no) --no
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!