LiveKit Agents integration
This package is in private preview. Names are final; details may change before release.
A LiveKit Agents plugin with two parts. The firewall checks each user turn and each agent reply. The recorder copies the session audio as it happens, then SecurePass redacts the full recording when the session ends.
Tested with LiveKit Agents v1.8.10. Python 3.10 or later.
Install
pip install livekit-plugins-autessa livekit-plugins-anthropic
export AUTESSA_API_KEY="<keyId>:<secret>"
During the private preview, install from GitHub, Autessa packages first:
pip install "autessa-core @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-core"
pip install "autessa-firewall @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-firewall"
pip install "autessa-redact @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-redact"
pip install "livekit-plugins-autessa @ git+https://github.com/Autessa-Inc/livekit-plugins-autessa"
Minimal example
from livekit.agents import AgentServer, AgentSession, JobContext, cli
from livekit.plugins import anthropic
from livekit.plugins.autessa import AutessaFirewall, AutessaFirewallAgent, AutessaRecorder
server = AgentServer()
@server.rtc_session()
async def entrypoint(ctx: JobContext) -> None:
# Both read AUTESSA_API_KEY.
firewall = AutessaFirewall(session_id=ctx.room.name)
recorder = AutessaRecorder(
external_id=ctx.room.name,
types=["CARD_NUMBER", "CARD_CVV"],
on_result=lambda r: print(r.status, r.redacted_audio_url),
)
session = AgentSession(
llm=anthropic.LLM(model="claude-opus-5-5"),
stt=my_stt,
tts=my_tts,
)
# Use AutessaFirewallAgent in place of Agent.
agent = AutessaFirewallAgent(
instructions="You help callers check order status.",
firewall=firewall,
)
await session.start(agent=agent, room=ctx.room)
recorder.attach(session) # record both sides from now on
ctx.add_shutdown_callback(recorder.finish) # redact the full session when it ends
if __name__ == "__main__":
cli.run_app(server)
my_stt and my_tts are your usual speech plugins.
How it works
- User turns: in
on_user_turn_completed, what the user said is checked asUSER_INPUT. A blocked message is replaced in the chat history, the agent saysblocked_message, and the LLM does not answer. - Replies: in
llm_node, the whole reply is checked asFINAL_RESPONSEbefore it is spoken. A blocked reply is replaced withblocked_message. Setcheck_output=Falseto skip holding replies. - Tools (Preview): in
on_enter, the agent's tool definitions are checked asTOOL_DEFINITIONS. If they are blocked, the tools are removed and an error is logged. - Challenges: when the policy asks for proof of identity, the agent reads the challenge prompt. The user's answer is checked and never kept in the chat history. If it passes, the original request is answered.
- Approvals: a request that needs a person's approval gets
approval_messageinstead. - Duress: the conversation carries on normally, and
on_duress(result)is called so you can alert your team. - What is not checked: replies you start with
session.generate_reply(...)skip the user-input check, and individual tool calls and tool results are not checked. - Your own
Agent: callfirewall.check_user_turn(self, turn_ctx, new_message)inon_user_turn_completed, wrap your LLM stream withfirewall.guard_llm_output(...)inllm_node, and callfirewall.check_tools(self.tools)inon_enter.
Redaction
- Nothing changes during the session. Audio is only copied, and redaction never runs live.
- Two channels: the user is channel 0 and the agent is channel 1, placed at the time each was actually heard. Agent audio cut off by an interruption is not recorded.
- Chunked upload (Preview): audio is uploaded every
chunk_seconds, so long sessions aren't held in memory. - At the end:
finish()finalizes the recording, and SecurePass redacts the full audio. It returns aRedactionResultwithstatus,redacted_audio_url,transcript_url,spans,transcript, anderror.
Options
AutessaFirewall:
| Option | What it does |
|---|---|
session_id | Your id for the session, for example the room name. |
subject_id | Your stable id for the user. |
policy_name | Use a named firewall policy. |
blocked_message, approval_message | What the agent says instead. |
check_output | Check each reply before it is spoken. Default true. |
tool_server | Where the agent's tools come from. |
fail_open | If a check can't be done (the firewall can't be reached, errors, or takes longer than timeout), let messages through. Default: treat them as blocked. |
timeout | Seconds to wait for each check. Default 3, so a slow check never leaves the caller in silence for long. None waits as long as the client does. |
on_result, on_duress | Callbacks: on_result(phase, result) and on_duress(result). |
AutessaRecorder:
| Option | What it does |
|---|---|
external_id | Your id for the session. |
types | What to redact, for example ["CARD_NUMBER", "SSN"]. |
language | The language of the session. |
sample_rate | The rate the recording is stored at. Default 16000. |
chunk_seconds | How often audio is uploaded. Default 10. |
wait, fetch_transcript | Wait for redaction to finish; include the redacted transcript. |
on_result | Callback with the redaction result. |
webhook_url | We POST the finished redaction here. |
Example
livekit-clinic-assistant: a clinic voice assistant with the firewall on each turn and reply, and health data redacted from the full session recording.