Embedding Agents as Widgets
Xagent can expose an agent through an embeddable widget flow for website or product integration.How widgets work
The widget flow is guest-oriented. A client:- Authenticates a guest against a specific agent
- Receives a guest chat token
- Uploads files if needed
- Creates a widget chat task
- Continues the session over the public chat runtime
Agent-level widget controls
Agents now expose widget-related settings:widget_enabledallowed_domains
Domain allowlist
The widget authentication flow validates the request origin against the agent’s allowed domains. Use this to restrict where the widget can be embedded:- Exact domains
- Subdomains
*for unrestricted access, only if you deliberately want that behavior
Recommended setup
For a production widget agent:- Use a focused prompt
- Keep tools narrow and predictable
- Add safe suggested prompts
- Restrict allowed domains
- Test guest file uploads and session continuity
Widget vs share link
Use a widget when:- The agent is embedded into your product or site
- You need origin checks
- The conversation is part of a product experience
- You want a public standalone entry point
- The interaction is link-driven rather than embedded