Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
-p livekit.plugins.bithuman
-p livekit.plugins.cartesia
-p livekit.plugins.clova
-p livekit.plugins.dataspike
-p livekit.plugins.deepgram
-p livekit.plugins.elevenlabs
-p livekit.plugins.fal
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ uv pip install pip && uv run mypy --install-types --non-interactive \
-p livekit.plugins.bithuman \
-p livekit.plugins.cartesia \
-p livekit.plugins.clova \
-p livekit.plugins.dataspike \
-p livekit.plugins.deepgram \
-p livekit.plugins.elevenlabs \
-p livekit.plugins.fal \
Expand Down
26 changes: 26 additions & 0 deletions examples/deepfake-detection/dataspike/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# LiveKit Dataspike Deepfake Detection Example

This example demonstrates how to use the [Dataspike](https://dataspike.io/) deepfake detection plugin with a LiveKit Agent.

## Usage

* Update the environment:

```bash
# Dataspike Config
export DATASPIKE_API_KEY="..."

# OpenAI config (or other models, tts, stt)
export OPENAI_API_KEY="..."

# LiveKit config
export LIVEKIT_API_KEY="..."
export LIVEKIT_API_SECRET="..."
export LIVEKIT_URL="..."
```

* Start the agent worker:

```bash
python examples/avatar_agents/dataspike/agent_worker.py dev
```
61 changes: 61 additions & 0 deletions examples/deepfake-detection/dataspike/agent_worker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import logging

from dotenv import load_dotenv

from livekit.agents import (
Agent,
AgentSession,
JobContext,
JobRequest,
WorkerOptions,
WorkerType,
cli,
)
from livekit.plugins import dataspike, openai

logger = logging.getLogger("dataspike-deepfake-example")
logger.setLevel(logging.DEBUG)

load_dotenv()


async def entrypoint(ctx: JobContext):
session = AgentSession(
llm=openai.realtime.RealtimeModel(voice="alloy"),
resume_false_interruption=False,
)

# Configure the Dataspike detector.
# - api_key: optional; if omitted, uses DATASPIKE_API_KEY from environment
# - notification_cb: optional; callback for handling notifications
# (defaults to publishing results in the room data channel)
# - other config: see plugin docs for available parameters
detector = dataspike.DataspikeDetector(
# api_key="YOUR_API_KEY",
# notification_cb=on_notification,
)

# Start the Dataspike detector and attach it to the current session and room.
await detector.start(session, room=ctx.room)

# Launch the main agent, which will automatically join the same room.
await session.start(
agent=Agent(instructions="Talk to me!"),
room=ctx.room,
)


async def on_request(req: JobRequest):
logger.info(f"[worker] job request for room={req.room.name} id={req.id}")
# you can set the agent's participant name/identity here:
await req.accept(name="dataspike-agent")


if __name__ == "__main__":
cli.run_app(
WorkerOptions(
entrypoint_fnc=entrypoint,
request_fnc=on_request,
worker_type=WorkerType.ROOM,
)
)
37 changes: 37 additions & 0 deletions livekit-plugins/livekit-plugins-dataspike/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Dataspike Deepfake Detection Plugin for LiveKit Agents

This plugin integrates [Dataspike](https://dataspike.io/) with LiveKit Agents to provide **real-time deepfake detection**.
It enables detection of synthetic or manipulated media during live or recorded video streams.

## Installation

```bash
pip install livekit-plugins-dataspike
```

## Prerequisites

You’ll need a **Dataspike API key**. Set it as an environment variable before running your agent:

```bash
export DATASPIKE_API_KEY="your_api_key_here"
```

## Usage Example

```python
from livekit.plugins import dataspike
from livekit.agents import AgentSession, Agent

async def entrypoint(ctx):
await ctx.connect()
session = AgentSession(...)
detector = dataspike.DataspikeDetector()
await detector.start(session, room=ctx.room)
await session.start(agent=Agent(instructions="Talk to me!"), room=ctx.room)
```

## Links

- [Dataspike API](https://docs.dataspike.io/api)
- [LiveKit Agents SDK](https://github.com/livekit/agents)
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Dataspike deepfake detection plugin for LiveKit Agents."

This module provides a realtime deepfake detector that attaches to a LiveKit room,
samples frames from subscribed remote video tracks, and streams them to the
Dataspike WebSocket API for analysis. Results can be published back into the room
or handled via a custom callback.

Typical usage:
>>> detector = DataspikeDetector()
>>> await detector.start(agent_session, room)

Public API:
- `InputTrack`: Internal helper representing a sampled video track.
- `DataspikeDetector`: The main detector that manages sampling and the WS pipeline.
"""

from .detector import DataspikeDetector
from .log import logger
from .version import __version__

__all__ = [
"DataspikeDetector",
"InputTrack",
"logger",
"__version__",
]

from livekit.agents import Plugin


class DataspikePlugin(Plugin):
def __init__(self) -> None:
super().__init__(__name__, __version__, __package__, logger)


Plugin.register_plugin(DataspikePlugin())

# Cleanup docs of unexported modules
_module = dir()
NOT_IN_ALL = [m for m in _module if m not in __all__]

__pdoc__ = {}

for n in NOT_IN_ALL:
__pdoc__[n] = False
Loading