Hi :wave: I have some ssues with agent and interru...
# agents
b
Hi πŸ‘‹ I have some ssues with agent and interruptions Been testing with a very basic agent for some hours now but its always interrupted and cut off before finishing the sentence its saying. Feel at this point im going nuts, tried so many settings/parameters, but it always cuts of at the end of the sentence. Anyone experience this ? Thanks for any help/pointers πŸ™Œ
πŸ”– 1
Copy code
import os
from pathlib import Path

from dotenv import load_dotenv
from livekit.agents import (
    JobContext,
    WorkerOptions,
    cli,
)
from livekit.agents.voice import Agent, AgentSession
from livekit.plugins import elevenlabs, openai, speechmatics

load_dotenv(dotenv_path=Path(__file__).parent.parent / ".env")


class Anna(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="""
                You are a helpful agent.
                You speak Norwegian.
                You are here to take any messages from the user.
                Do not make up any information.
                Do not ask any questions, just take messages,
                Do not say much.
            """,
            stt=speechmatics.STT(
                api_key=os.getenv("SPEECHMATICS_API_KEY",""), language="no"
            ),
            # Tried multiple values for this, but none worked
            turn_detection="vad",
            # Tried multiple values for this, but none worked
            allow_interruptions=False,
            use_tts_aligned_transcript=True,
            llm=openai.LLM(model="gpt-4o"),
            tts=elevenlabs.TTS(
                voice_id=os.getenv("ELEVENLABS_VOICE_ID",""),
                language="no",
                model="eleven_turbo_v2_5",
                api_key=os.getenv("ELEVENLABS_API_KEY",""),
            ),
        )


async def entrypoint(ctx: JobContext):
    await ctx.connect()


    session: AgentSession = AgentSession(
        # Tried multiple values for this, but none worked
        allow_interruptions=False,

        # Tried multiple values for this, but none worked
        min_interruption_duration=1
    )
    # Cleaner realtime captions to clients (don't wait to sync back to audio)

    agent = Anna()

    await session.start(agent=agent, room=ctx.room)



if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
After some testing, the culprit here seems to be the eleven labs api crashing silently, why its crashing im not sure. after downgrading to 1.2.6 i could see some errors. Switching tts provider solved it for now, but would be nice to get elevenlabs to work more info here: https://livekit-users.slack.com/archives/C088ZNU7QQ5/p1757263544057219?thread_ts=1757258685.523169&cid=C088ZNU7QQ5
a
Yeah, had the same issue this morning - moved ours over to Cartesia and it's working now Did you manage to get 11labs working again or are you still using a different provider too?
b
unfortunately, did not find a solution
a
So, this afternoon actually got ours to work - turned out it was just a simple mismatch in the parameters Not sure if that's of any help to you, but that's what worked for me πŸ˜…
b
What was the solution, for you? πŸ™‚ Would you mind pasting the setup/parameters that worked on your side? πŸ‘€
d
@agreeable-plumber-27227 could you place here the config that you have for 11labs? That would help us all πŸ™‚ I get audio interruptions as well (like, during the greeting), and I have no clue what’s going on