""" Entry point for the Pipecat VoiceCoach agent. Reads config from environment variables. """ import asyncio import logging import os import structlog from livekit import api as livekit_api from pipeline import run_voice_coach_pipeline logging.basicConfig(level=logging.INFO) logger = structlog.get_logger() async def main(): anthropic_key = os.environ["ANTHROPIC_API_KEY"] livekit_api_key = os.environ["LIVEKIT_API_KEY"] livekit_api_secret = os.environ["LIVEKIT_API_SECRET"] livekit_url = os.getenv("LIVEKIT_URL", "ws://livekit-server:7880") # Generate LiveKit access token for this agent token = livekit_api.AccessToken(livekit_api_key, livekit_api_secret) token.with_grants(livekit_api.VideoGrants(room_join=True, room="voicecoach")) token.identity = "voicecoach-agent" livekit_token = token.to_jwt() session_context = { "baseline_context": "", "session_history": "", "current_mode": "coaching mode", } logger.info("Starting VoiceCoach pipeline", livekit_url=livekit_url) await run_voice_coach_pipeline( livekit_url=livekit_url, livekit_token=livekit_token, anthropic_key=anthropic_key, session_context=session_context, ) if __name__ == "__main__": asyncio.run(main())