Learn how to embed AI agents in your web applications
@play-ai/agent-web-sdk
package:
Create an agent
Import the necessary dependencies
Define your web embed ID
YOUR_WEB_EMBED_ID
with the actual ID provided by play.ai, which can be found in the Agent editor.Find your web embed ID on the last page of the Agent editor under 'Deploy Web'
Define custom events (optional)
Implement the custom event handler (optional)
Initialize the web embed
useEffect
hook initializes the web embed when the component mounts. See all the parameters that can be passed to openEmbed()
here.Render the component
The greeting and prompt for the Change Text demo agent