Created
November 24, 2025 20:56
-
-
Save amosgyamfi/a308f7171cc348eb32beaff88fa7c2b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| from dotenv import load_dotenv | |
| from vision_agents.core import User, Agent, cli | |
| from vision_agents.core.agents import AgentLauncher | |
| from vision_agents.plugins import decart, getstream, gemini, elevenlabs, deepgram | |
| logger = logging.getLogger(__name__) | |
| load_dotenv() | |
| async def create_agent(**kwargs) -> Agent: | |
| processor = decart.RestylingProcessor( | |
| initial_prompt="Change my video to studio Ghibli", model="mirage_v2" | |
| ) | |
| llm = gemini.LLM(model="gemini-3-pro-preview") | |
| agent = Agent( | |
| edge=getstream.Edge(), | |
| agent_user=User(name="Story teller", id="agent"), | |
| instructions="You are a live video effects generator and restyling AI agent: [EXCITED], [NERVOUS], [FRUSTRATED], [TIRED] Reactions: [GASP], [SIGH], [LAUGHS], [GULPS] Volume & energy: [WHISPERING], [SHOUTING], [QUIETLY], [LOUDLY] Pacing & rhythm: [PAUSES], [STAMMERS], [RUSHED]", | |
| llm=llm, | |
| tts=elevenlabs.TTS(voice_id="N2lVS1w4EtoT3dr4eOWO"), | |
| stt=deepgram.STT(), | |
| processors=[processor], | |
| ) | |
| @llm.register_function( | |
| description="This function changes the prompt of the Decart processor which in turn changes the style of the video and user's background" | |
| ) | |
| async def change_prompt(prompt: str) -> str: | |
| await processor.update_prompt(prompt) | |
| return f"Prompt changed to {prompt}" | |
| return agent | |
| async def join_call(agent: Agent, call_type: str, call_id: str, **kwargs) -> None: | |
| """Join the call and start the agent.""" | |
| # Ensure the agent user is created | |
| await agent.create_user() | |
| # Create a call | |
| call = await agent.create_call(call_type, call_id) | |
| logger.info("🤖 Starting Agent...") | |
| # Have the agent join the call/room | |
| with await agent.join(call): | |
| logger.info("Joining call") | |
| logger.info("LLM ready") | |
| await agent.finish() # Run till the call ends | |
| if __name__ == "__main__": | |
| cli(AgentLauncher(create_agent=create_agent, join_call=join_call)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment