VideoSDK Agents
Agents Framework on top of VideoSDK's architecture.
Installation
pip install videosdk-agents
Visit https://docs.videosdk.live/ai_agents/introduction for Quickstart, Examples and Detailed Documentation.
Usage
import asyncio
from videosdk.agents import Agent, AgentSession, RealTimePipeline, function_tool, WorkerJob, RoomOptions, JobContext
from videosdk.plugins.openai import OpenAIRealtime, OpenAIRealtimeConfig
from openai.types.beta.realtime.session import InputAudioTranscription, TurnDetection
class MyVoiceAgent(Agent):
def __init__(self):
super().__init__(
instructions="You are a helpful voice assistant that can answer questions and help with tasks.",
)
async def on_enter(self) -> None:
await self.session.say("How can i assist you today?")
async def entrypoint(ctx: JobContext):
print("Starting connection test...")
print(f"Job context: {jobctx}")
model = OpenAIRealtime(
model="gpt-4o-realtime-preview",
config=OpenAIRealtimeConfig( modalities=["text", "audio"] )
)
pipeline = RealTimePipeline(model=model)
session = AgentSession(
agent=MyVoiceAgent(),
pipeline=pipeline,
context=jobctx
)
try:
await ctx.connect()
await session.start()
print("Connection established. Press Ctrl+C to exit.")
await asyncio.Event().wait()
except KeyboardInterrupt:
print("\nShutting down gracefully...")
finally:
await session.close()
await ctx.shutdown()
def make_context() -> JobContext:
room_options = RoomOptions(room_id="<meeting_id>", name="Sandbox Agent", playground=True)
return JobContext(
room_options=room_options
)
if __name__ == "__main__":
job = WorkerJob(job_func=entryPoint, jobctx=make_context)
job.start()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
videosdk_agents-1.0.26.tar.gz
(635.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file videosdk_agents-1.0.26.tar.gz.
File metadata
- Download URL: videosdk_agents-1.0.26.tar.gz
- Upload date:
- Size: 635.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2f1171bfb93d962269198c238c7a1e39797136b35cd64f5832b5e032fa0bf03
|
|
| MD5 |
7d4aa8a3727259ed9f603410b5d87d73
|
|
| BLAKE2b-256 |
b88debf18a85478bc84e517f900fdf7cb09e4dd514e562cc45853d984f0337fb
|
File details
Details for the file videosdk_agents-1.0.26-py3-none-any.whl.
File metadata
- Download URL: videosdk_agents-1.0.26-py3-none-any.whl
- Upload date:
- Size: 695.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e620e2ce779b9683452c77f6c6c478479e8c367227bf27f7e773bce157601bd9
|
|
| MD5 |
a0da52fa07f16a55f8a9fc0b5efbb2fe
|
|
| BLAKE2b-256 |
2ceb8abe4456b02ca8f21eaf914e90db7189bcd576c14e87985b70c50d2cb87f
|