Skip to content

Add AgentCore WebRTC example with KVS managed TURN#195

Merged
kompfner merged 1 commit into
pipecat-ai:mainfrom
wirjo:feat/agentcore-webrtc-kvs
Mar 24, 2026
Merged

Add AgentCore WebRTC example with KVS managed TURN#195
kompfner merged 1 commit into
pipecat-ai:mainfrom
wirjo:feat/agentcore-webrtc-kvs

Conversation

@wirjo
Copy link
Copy Markdown
Contributor

@wirjo wirjo commented Mar 10, 2026

Summary

  • Adds a new deployment example (aws-agentcore-webrtc-kvs) that uses Amazon Kinesis Video Streams for TURN credential provisioning instead of non-AWS TURN providers
  • Eliminates external dependencies for NAT traversal by fetching temporary, auto-rotating TURN credentials via the KVS GetIceServerConfig API
  • Both the agent and server dynamically call KVS at connection time — no static TURN URLs or credentials to manage

Key changes

  • agent/pipecat-agent.py and server/server.py: Added get_kvs_ice_servers() that calls DescribeSignalingChannelGetSignalingChannelEndpointGetIceServerConfig
  • scripts/setup-iam-role.sh: Added KVSTurnCredentials IAM policy for KVS access
  • Replaced ICE_SERVER_URLS/ICE_SERVER_USERNAME/ICE_SERVER_CREDENTIAL env vars with a single KVS_CHANNEL_NAME
  • VPC resource tags use -kvs- suffix to avoid conflicts with the existing aws-agentcore-webrtc example

Test plan

  • Deploy with ./scripts/configure.sh and ./scripts/launch.sh
  • Verify KVS signaling channel is auto-created on first connection
  • Confirm WebRTC connection establishes with KVS TURN relay (check chrome://webrtc-internals for relay candidate type)
  • Test in both VPC and PUBLIC modes

🤖 Generated with Claude Code

@kompfner
Copy link
Copy Markdown
Contributor

Nice! It looks like the code in this PR is mostly just a copy-paste of the base WebRTC example, with the KVS changes applied on top.

If so: note that a few changes to the WebRTC example (only small things) landed after the changes in this PR, so we might want to "rebase" this PR to pick those up.

]
},
{
"Sid": "KVSTurnCredentials",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should also mention in the README (and/or env.example, after the changes from #196 have been applied) that these permissions are also required for the AWS account the server is running under.

Adds a new deployment example (aws-agentcore-webrtc-kvs) that uses
Amazon Kinesis Video Streams for TURN credential provisioning instead
of non-AWS TURN providers. This eliminates external dependencies for
NAT traversal by fetching temporary, auto-rotating TURN credentials
via the KVS GetIceServerConfig API.

Changes synced with latest base WebRTC example updates from pipecat-ai#196.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wirjo wirjo force-pushed the feat/agentcore-webrtc-kvs branch from 4d58cc3 to fd140e7 Compare March 24, 2026 19:06
@wirjo
Copy link
Copy Markdown
Contributor Author

wirjo commented Mar 24, 2026

Addressed both points:

  1. Rebased onto latest main to pick up all changes from AWS AgentCore examples cleanup #196 — the KVS files now match the updated base (Settings-based API for TTS/LLM, agent gets AWS creds from IAM role, simplified server CORS, AWS_SESSION_TOKEN support, production-readiness note, etc.)

  2. Added server-side KVS permissions note — the server/env.example now documents that the server's AWS account also needs KVS permissions, and the README includes a callout in the server env vars section pointing back to the same KVS IAM policy.

Also removed "Pipecat Cloud" references from comments per separate request.

@kompfner
Copy link
Copy Markdown
Contributor

Looks great! 👏

@kompfner kompfner merged commit 130efef into pipecat-ai:main Mar 24, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants