victorious-midnight-79553
10/13/2025, 12:25 PMtall-airline-16756
10/13/2025, 12:25 PMtall-airline-16756
10/13/2025, 12:26 PMvictorious-midnight-79553
10/13/2025, 12:28 PMtall-airline-16756
10/13/2025, 12:29 PMos module in Python. Here’s a little code snippet to help you get started:
import os
from livekit.agents.llm import function_tool
class MyAgent:
@function_tool()
async def access_external_service(self, query: str):
# Access environment variables
api_key = os.getenv("EXTERNAL_SERVICE_API_KEY")
base_url = os.getenv("EXTERNAL_SERVICE_URL", "https://default-url.com")
if not api_key:
return "API key not configured"
# Use the environment variables in your tool logic
response = await make_api_call(query, headers={"Authorization": f"Bearer {api_key}"})
return response
Just a quick tip: be sure to set those environment variables on your system or use a .env file if you’re working locally. If you hit any bumps or want me to walk you through it, I’m here to help!
Sources: packages/sip--um-actually/src/setup-livekit.ts | Secrets management | LiveKit Docs | External data and RAG | LiveKit Docs | Agent Deployment & Docker Configuration | livekit/livekit_composite | DeepW... | basics/tool_calling.pyvictorious-midnight-79553
10/17/2025, 10:51 AM