videosdk-agents


Namevideosdk-agents JSON
Version 0.0.29 PyPI version JSON
download
home_pageNone
SummaryVideo SDK Agents
upload_time2025-08-28 12:41:58
maintainerNone
docs_urlNone
authorvideosdk
requires_python>=3.11
licenseNone
keywords agents ai audio realtime video videosdk webrtc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            VideoSDK Agents

Agents Framework on top of VideoSDK's architecture.

## Installation

```bash
pip install videosdk-agents
```

Visit https://docs.videosdk.live/ai_agents/introduction for Quickstart, Examples and Detailed Documentation.

## Usage

```py
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()
```



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "videosdk-agents",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "agents, ai, audio, realtime, video, videosdk, webrtc",
    "author": "videosdk",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c6/b7/8e67f5e80466d19b1925e4f34753280f32bf1c99bf05b7fd6cdf6c0a105c/videosdk_agents-0.0.29.tar.gz",
    "platform": null,
    "description": "VideoSDK Agents\n\nAgents Framework on top of VideoSDK's architecture.\n\n## Installation\n\n```bash\npip install videosdk-agents\n```\n\nVisit https://docs.videosdk.live/ai_agents/introduction for Quickstart, Examples and Detailed Documentation.\n\n## Usage\n\n```py\nimport asyncio\nfrom videosdk.agents import Agent, AgentSession, RealTimePipeline, function_tool, WorkerJob, RoomOptions, JobContext\nfrom videosdk.plugins.openai import OpenAIRealtime, OpenAIRealtimeConfig\nfrom openai.types.beta.realtime.session import InputAudioTranscription, TurnDetection\n\n\nclass MyVoiceAgent(Agent):\n    def __init__(self):\n        super().__init__(\n            instructions=\"You are a helpful voice assistant that can answer questions and help with tasks.\",\n        )\n\n    async def on_enter(self) -> None:\n        await self.session.say(\"How can i assist you today?\")\n\nasync def entrypoint(ctx: JobContext):\n    print(\"Starting connection test...\")\n    print(f\"Job context: {jobctx}\")\n    \n    model = OpenAIRealtime(\n        model=\"gpt-4o-realtime-preview\",\n        config=OpenAIRealtimeConfig( modalities=[\"text\", \"audio\"] )\n    )\n    pipeline = RealTimePipeline(model=model)\n    session = AgentSession(\n        agent=MyVoiceAgent(), \n        pipeline=pipeline,\n        context=jobctx\n    )\n\n    try:\n        await ctx.connect()\n        await session.start()\n        print(\"Connection established. Press Ctrl+C to exit.\")\n        await asyncio.Event().wait()\n    except KeyboardInterrupt:\n        print(\"\\nShutting down gracefully...\")\n    finally:\n        await session.close()\n        await ctx.shutdown()\n\n\ndef make_context() -> JobContext:\n    room_options = RoomOptions(room_id=\"<meeting_id>\", name=\"Sandbox Agent\", playground=True)\n    \n    return JobContext(\n        room_options=room_options\n        )\n\n\nif __name__ == \"__main__\":\n    job = WorkerJob(job_func=entryPoint, jobctx=make_context)\n    job.start()\n```\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Video SDK Agents",
    "version": "0.0.29",
    "project_urls": null,
    "split_keywords": [
        "agents",
        " ai",
        " audio",
        " realtime",
        " video",
        " videosdk",
        " webrtc"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e7c6e1ab99e6cdc480f968447a07d85134461b4c5ead3c6ff2e910dfad3bf360",
                "md5": "5c512f8be4d07d35debf910b585c39af",
                "sha256": "7ff1cf91da67bbe8e1ceb9a74453995ec0d08e7934d661e6356d1e614d508391"
            },
            "downloads": -1,
            "filename": "videosdk_agents-0.0.29-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c512f8be4d07d35debf910b585c39af",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 131358,
            "upload_time": "2025-08-28T12:41:56",
            "upload_time_iso_8601": "2025-08-28T12:41:56.896061Z",
            "url": "https://files.pythonhosted.org/packages/e7/c6/e1ab99e6cdc480f968447a07d85134461b4c5ead3c6ff2e910dfad3bf360/videosdk_agents-0.0.29-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c6b78e67f5e80466d19b1925e4f34753280f32bf1c99bf05b7fd6cdf6c0a105c",
                "md5": "fd5779b8f4a4712677ae4f50a66f8910",
                "sha256": "43ac4b8b9ce71c8ad8676234da8f6210f850204b07b0fafe89e0041ee9def5f5"
            },
            "downloads": -1,
            "filename": "videosdk_agents-0.0.29.tar.gz",
            "has_sig": false,
            "md5_digest": "fd5779b8f4a4712677ae4f50a66f8910",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 104454,
            "upload_time": "2025-08-28T12:41:58",
            "upload_time_iso_8601": "2025-08-28T12:41:58.673229Z",
            "url": "https://files.pythonhosted.org/packages/c6/b7/8e67f5e80466d19b1925e4f34753280f32bf1c99bf05b7fd6cdf6c0a105c/videosdk_agents-0.0.29.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-28 12:41:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "videosdk-agents"
}
        
Elapsed time: 0.57558s