I'm using a simple LiveKit agent for text-to-text ...
# ask-ai
p
I'm using a simple LiveKit agent for text-to-text only (python). I have a production URL containing my company information and FAQs, and I want the agent to retrieve information only from that URL source. How can I do this?
t
Thanks for reaching out, Yassine. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you configure your LiveKit agent to pull information just from your production URL using the Model Context Protocol (MCP) integration. Here's a simple way to set it up in Python: 1. Use the
mcp_servers
parameter in the
AgentSession
or
Agent
constructor to specify your URL as an
MCPServerHTTP
instance. 2. Make sure to include only your production URL in the
mcp_servers
list so the agent won't fall back to other sources. Here’s a quick example for you:
Copy code
from livekit.agents import AgentSession, mcp

session = AgentSession(
    vad=silero.VAD.load(),
    stt="assemblyai/universal-streaming",
    llm="openai/gpt-4.1-mini",
    tts="cartesia/sonic-2:6f84f4b8-58a2-430c-8c79-688dad597532",
    turn_detection=MultilingualModel(),
    mcp_servers=[mcp.MCPServerHTTP(url="<YOUR_PRODUCTION_URL>")],
)
Just replace
<YOUR_PRODUCTION_URL>
with your actual production URL, and your agent will fetch data exclusively from there. If you ever want to switch URLs on the fly, you can create a new agent instance with the new URL and update your session using
session.update_agent(new_agent)
. Also, don’t forget to install the necessary
mcp
dependencies and set up environment variables like
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
to keep everything running smoothly. If you have any questions or need a hand with this, just let me know—I’m here to help! Sources: Tool definition and use | LiveKit Docs | README.md
p
i did this but the agent not return the info like the production url has it need to return the same info exactly
t
Thanks so much for reaching out! Could you help me understand a bit more about what you mean when you say "the agent does not return the info like the production URL has"? For instance: • Are you hoping the agent returns the exact text content from the URL? • Is the challenge related to formatting, missing information, or maybe some incorrect data? • Do you have any specific examples showing what you expect versus what the agent is currently providing? Getting a clearer picture will really help me support you better. Looking forward to your reply!
p
Yes, I want the agent to return the same information when I ask it a question. For example, in my production URL, I have FAQs that contain the answers users might ask. I want the agent to have the same information to return, without missing anything.
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!