Repository navigation
[feat] Embed an agent on any website as a chat iframe - #7662
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2b9e835e-1e3a-40ae-9d0a-2c836b0804c9
📒 Files selected for processing: 8
openspec/README.mdopenspec/changes/add-agent-embed/HANDOFF.mdopenspec/changes/add-agent-embed/design.mdopenspec/changes/add-agent-embed/proposal.mdopenspec/changes/add-agent-embed/qa.mdopenspec/changes/add-agent-embed/specs/channel-turn-context/spec.mdopenspec/changes/add-agent-embed/specs/embed-channel/spec.mdopenspec/changes/add-agent-embed/tasks.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d87ab716-d887-48c6-a3c1-1cb6b83cdf86
📒 Files selected for processing: 5
openspec/changes/add-agent-embed/design.mdopenspec/changes/add-agent-embed/proposal.mdopenspec/changes/add-agent-embed/qa.mdopenspec/changes/add-agent-embed/specs/embed-channel/spec.mdopenspec/changes/add-agent-embed/tasks.md
🚧 Files skipped from review as they are similar to previous changes: 1
- openspec/changes/add-agent-embed/proposal.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Define the first-message session handoff before implementing the embed… · HANDOFF.md:48-72
openspec/changes/add-agent-embed/HANDOFF.md:48-72
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDefine the first-message session handoff before implementing the embed transport.
The
newcommand only closes the current thread. The next message creates or resolves the new thread in the asynchronous worker after ingress returns202. The widget therefore may not know the session ID before the worker emits live frames.HANDOFF.mdrecords that a late subscription drops those frames and shows the reply only after the turn ends.Task 1.3 must not be conditional on the existing-session test. Add an explicit first-message solution, such as returning or precreating the session before the worker starts, buffering/replaying frames, or implementing live-follow with equivalent replay behavior.
Suggested fix
--- a/openspec/changes/add-agent-embed/tasks.md +++ b/openspec/changes/add-agent-embed/tasks.md @@ -- [ ] 1.3 If 1.1 fails, add a live-follow mode to the embed transport (subscribe to the session's live events after the ingress accepts) and note the change in `design.md` before continuing +- [ ] 1.3 Resolve and test the first-message session handoff before continuing. The embed must return or precreate the session before the worker starts, buffer or replay live frames until subscription, or implement an equivalent live-follow contract. @@ - [ ] 5.2 Embed transport for `@agenta/chat`: send through the ingress, read through the read routes +- [ ] 5.2a First-message streaming: subscribe to the new session before live frames can be emitted, or use the handoff mechanism selected in 1.3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
373bc6b3-50d5-48e4-8d59-1f01e6268bb7
📒 Files selected for processing: 2
openspec/changes/add-agent-embed/HANDOFF.mdopenspec/changes/add-agent-embed/tasks.md
🚧 Files skipped from review as they are similar to previous changes: 2
- openspec/changes/add-agent-embed/tasks.md
- openspec/changes/add-agent-embed/HANDOFF.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
Railway Preview Environment
PR closed or converted to draft. Environment absence verified; retained storage requires separate provider accounting. Post |
There was a problem hiding this comment.
Actionable comments posted: 3
🔇 Additional comments: 36
api/entrypoints/channel_adapters.py: 1
64-64: LGTM!api/entrypoints/routers.py: 1
686-688: LGTM!api/oss/src/apis/fastapi/channels/models.py: 1
126-134: LGTM!api/oss/src/utils/env.py: 1
942-987: LGTM!api/oss/tests/pytest/unit/channels/test_channels_ingress_public_endpoints.py: 1
62-65: LGTM!api/oss/tests/pytest/unit/channels/embed/test_embed_ingress.py: 1
1-270: LGTM!api/oss/tests/pytest/unit/test_channel_adapters_entrypoint.py: 1
24-27: LGTM!openspec/changes/add-agent-embed/design.md: 1
76-76: LGTM!Also applies to: 166-166
openspec/changes/add-agent-embed/specs/embed-channel/spec.md: 1
33-33: LGTM!openspec/changes/add-agent-embed/tasks.md: 1
17-24: LGTM!api/oss/src/core/channels/service.py: 1
1008-1013: LGTM!Also applies to: 2230-2269, 2539-2540, 2549-2558
api/oss/src/core/channels/adapters/interface.py: 1
42-52: LGTM!Also applies to: 142-159
api/oss/src/core/channels/adapters/agenta/adapter.py: 1
98-102: LGTM!api/oss/src/core/channels/adapters/bridge/adapter.py: 1
112-112: LGTM!Also applies to: 164-168
api/oss/src/core/channels/adapters/slack/adapter.py: 1
219-219: LGTM!Also applies to: 323-327
api/oss/src/core/channels/adapters/telegram/adapter.py: 1
236-240: LGTM!api/oss/src/core/channels/adapters/whatsapp/adapter.py: 1
237-241: LGTM!api/oss/src/core/channels/adapters/mock/adapter.py: 1
88-92: LGTM!api/oss/src/core/channels/adapters/embed/__init__.py: 1
1-3: LGTM!api/oss/src/core/channels/adapters/embed/adapter.py: 1
1-344: LGTM!api/oss/src/core/channels/adapters/embed/capabilities.py: 1
1-59: LGTM!api/oss/tests/pytest/unit/channels/embed/test_embed_adapter.py: 1
1-285: LGTM!api/oss/tests/pytest/unit/channels/embed/test_embed_contract_suite.py: 1
1-46: LGTM!api/oss/tests/pytest/integration/channels/test_channels_connection_write_path_integration.py: 1
60-60: LGTM!api/oss/tests/pytest/integration/channels/test_channels_ingress_seam.py: 1
88-92: LGTM!api/oss/tests/pytest/integration/channels/test_channels_outbox_worker_integration.py: 1
90-94: LGTM!api/oss/tests/pytest/unit/channels/contract/fakes.py: 1
117-121: LGTM!api/oss/tests/pytest/unit/channels/test_channel_adapter_interface.py: 1
28-28: LGTM!api/oss/tests/pytest/unit/channels/test_channels_connection_write_path.py: 1
73-73: LGTM!api/oss/tests/pytest/unit/channels/test_channels_hydration_never_leaks_to_a_response.py: 1
63-63: LGTM!Also applies to: 83-83
api/oss/tests/pytest/unit/channels/test_channels_ingress.py: 1
82-86: LGTM!api/oss/tests/pytest/unit/channels/test_channels_install_connection.py: 1
59-59: LGTM!api/oss/tests/pytest/unit/channels/test_channels_reconnect_after_disconnect.py: 1
59-59: LGTM!api/oss/tests/pytest/unit/channels/test_channels_setup_declaration.py: 1
152-152: LGTM!api/oss/tests/pytest/unit/channels/test_channels_slack_hosted_lifecycle.py: 1
38-38: LGTM!api/oss/src/middlewares/auth.py-143-148: 1
143-148: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Scope the public prefix to the two real routes.
The
/channels/embed/entry makes every current and future path under that prefix public. The comment also mentions "read routes" that do not exist yet. If someone later adds a route under this prefix and forgets to check the visitor key, that route is unauthenticated with no warning. List the two route shapes explicitly instead, for example/channels/embed/events/plus an anchoredconfigmatch. The retrieved learning says to prefer strict anchored matching over loose prefixes for public-path allowlists.Source: Learnings
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7533e4de-9fae-4861-85e1-2c4a9873f1f9
📒 Files selected for processing: 39
api/entrypoints/channel_adapters.pyapi/entrypoints/routers.pyapi/oss/src/apis/fastapi/channels/ingress.pyapi/oss/src/apis/fastapi/channels/models.pyapi/oss/src/core/channels/adapters/agenta/adapter.pyapi/oss/src/core/channels/adapters/bridge/adapter.pyapi/oss/src/core/channels/adapters/embed/__init__.pyapi/oss/src/core/channels/adapters/embed/adapter.pyapi/oss/src/core/channels/adapters/embed/capabilities.pyapi/oss/src/core/channels/adapters/interface.pyapi/oss/src/core/channels/adapters/mock/adapter.pyapi/oss/src/core/channels/adapters/slack/adapter.pyapi/oss/src/core/channels/adapters/telegram/adapter.pyapi/oss/src/core/channels/adapters/whatsapp/adapter.pyapi/oss/src/core/channels/service.pyapi/oss/src/middlewares/auth.pyapi/oss/src/utils/env.pyapi/oss/tests/pytest/integration/channels/test_channels_connection_write_path_integration.pyapi/oss/tests/pytest/integration/channels/test_channels_ingress_seam.pyapi/oss/tests/pytest/integration/channels/test_channels_outbox_worker_integration.pyapi/oss/tests/pytest/unit/channels/contract/fakes.pyapi/oss/tests/pytest/unit/channels/embed/__init__.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_adapter.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_contract_suite.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_ingress.pyapi/oss/tests/pytest/unit/channels/test_channel_adapter_interface.pyapi/oss/tests/pytest/unit/channels/test_channels_connection_write_path.pyapi/oss/tests/pytest/unit/channels/test_channels_hydration_never_leaks_to_a_response.pyapi/oss/tests/pytest/unit/channels/test_channels_ingress.pyapi/oss/tests/pytest/unit/channels/test_channels_ingress_public_endpoints.pyapi/oss/tests/pytest/unit/channels/test_channels_install_connection.pyapi/oss/tests/pytest/unit/channels/test_channels_reconnect_after_disconnect.pyapi/oss/tests/pytest/unit/channels/test_channels_setup_declaration.pyapi/oss/tests/pytest/unit/channels/test_channels_slack_hosted_lifecycle.pyapi/oss/tests/pytest/unit/test_channel_adapters_entrypoint.pyopenspec/changes/add-agent-embed/HANDOFF.mdopenspec/changes/add-agent-embed/design.mdopenspec/changes/add-agent-embed/specs/embed-channel/spec.mdopenspec/changes/add-agent-embed/tasks.md
🚧 Files skipped from review as they are similar to previous changes: 1
- openspec/changes/add-agent-embed/HANDOFF.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
Website previewPreview URL: https://pr-7662-agenta-website-preview.mahmoud-637.workers.dev Built from |
📘 Docs preview
Pages changed in this pull request This comment updates in place on every push. |
|
🤖 The AI agent says: Recorded live QA of the agent embed. Six videos cover the owner setup and all 15 scenarios in The videos could not be attached here. The browser that uploads media to GitHub was not reachable from this run. The six MP4 files (2.8 MB in total) are in the QA run folder on the dev box, under
Observations, not failures: the first reply of a new conversation starts about 6 s after the send (cold sandbox start for channel turns, a known follow-up). During fast sends the widget shows one pending message at a time. Conversation list rows show only the start time. |
|
🤖 The AI agent says: @coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 7
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
77f530db-fcbd-413f-bb23-b7344a0fa9cb
📒 Files selected for processing: 80
api/entrypoints/routers.pyapi/oss/src/apis/fastapi/channels/ingress.pyapi/oss/src/apis/fastapi/channels/models.pyapi/oss/src/apis/fastapi/sessions/live_events.pyapi/oss/src/core/channels/adapters/embed/adapter.pyapi/oss/src/core/channels/commands.pyapi/oss/src/core/channels/service.pyapi/oss/src/tasks/asyncio/channels/inbox.pyapi/oss/src/tasks/asyncio/channels/outbox.pyapi/oss/src/utils/env.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_adapter.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_read_routes.pyapi/oss/tests/pytest/unit/channels/test_channels_commands.pyapi/oss/tests/pytest/unit/channels/test_channels_inbox_dispatcher.pyapi/oss/tests/pytest/unit/channels/test_channels_outbox_worker.pyapi/oss/tests/pytest/unit/channels/test_channels_service_routing.pyapi/oss/tests/pytest/unit/channels/test_channels_turn_context.pyapi/oss/tests/pytest/unit/sessions/test_live_relay.pydocs/docs/guides/13-embed-an-agent.mdxdocs/docs/self-host/channels/02-embed-widget.mdxdocs/docs/self-host/reference/01-configuration.mdxhosting/docker-compose/oss/nginx/nginx.confhosting/kubernetes/helm/templates/web-mobile-deployment.yamlhosting/kubernetes/helm/tests/test_web_mobile.pyopenspec/changes/add-agent-embed/HANDOFF.mdopenspec/changes/add-agent-embed/design.mdopenspec/changes/add-agent-embed/specs/embed-channel/spec.mdopenspec/changes/add-agent-embed/tasks.mdweb/mobile/src/features/agents/useAgentPublishPanel.tsxweb/mobile/src/features/app/AppProviders.tsxweb/mobile/src/features/app/BareProviders.tsxweb/mobile/src/features/embed/EmbedAvatar.tsxweb/mobile/src/features/embed/EmbedChat.tsxweb/mobile/src/features/embed/EmbedChatScreen.tsxweb/mobile/src/features/embed/EmbedComposer.tsxweb/mobile/src/features/embed/EmbedConversationList.tsxweb/mobile/src/features/embed/EmbedFile.tsxweb/mobile/src/features/embed/EmbedGreeting.tsxweb/mobile/src/features/embed/EmbedHeader.tsxweb/mobile/src/features/embed/EmbedTranscript.tsxweb/mobile/src/features/embed/EmbedTurn.tsxweb/mobile/src/features/embed/embedClient.tsweb/mobile/src/features/embed/embedConfig.tsweb/mobile/src/features/embed/embedConversationModel.tsweb/mobile/src/features/embed/embedFiles.tsweb/mobile/src/features/embed/embedRoute.tsweb/mobile/src/features/embed/hostMessages.tsweb/mobile/src/features/embed/sseReader.tsweb/mobile/src/features/embed/states/EmbedKeyRefused.tsxweb/mobile/src/features/embed/states/EmbedLoading.tsxweb/mobile/src/features/embed/states/EmbedNotice.tsxweb/mobile/src/features/embed/states/EmbedUnavailable.tsxweb/mobile/src/features/embed/useEmbedConversation.tsweb/mobile/src/features/embed/useEmbedTheme.tsweb/mobile/src/features/embed/useEmbedVisitor.tsweb/mobile/src/features/embed/visitorKey.tsweb/mobile/src/pages/_app.tsxweb/mobile/src/pages/embed/[embedId].tsxweb/mobile/tests/unit/embedClient.test.tsweb/mobile/tests/unit/embedComposer.render.test.tsxweb/mobile/tests/unit/embedConfig.test.tsweb/mobile/tests/unit/embedConversationModel.test.tsweb/mobile/tests/unit/embedHostMessages.test.tsweb/mobile/tests/unit/embedRoute.test.tsweb/mobile/tests/unit/embedSseReader.test.tsweb/mobile/tests/unit/embedVisitorKey.test.tsweb/packages/agenta-chat/src/transport/sessionLiveEvents.tsweb/packages/agenta-chat/tests/unit/transport/sessionLiveEvents.test.tsweb/packages/agenta-settings-ui/src/channels/ChannelsHubView.tsxweb/packages/agenta-settings-ui/src/channels/actions.tsweb/packages/agenta-settings-ui/src/channels/index.tsweb/packages/agenta-settings-ui/src/channels/useChannelPanel.tsxweb/packages/agenta-settings-ui/src/index.tsweb/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsxweb/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.tsxweb/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsxweb/packages/agenta-settings-ui/src/publish/embedApi.tsweb/packages/agenta-settings-ui/src/publish/index.tsweb/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsxweb/turbo.json
🚧 Files skipped from review as they are similar to previous changes: 2
- openspec/changes/add-agent-embed/tasks.md
- openspec/changes/add-agent-embed/HANDOFF.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
|
🤖 The AI agent says: @coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1b8e8f64-e542-4bad-88d4-185b0ba48d7e
📒 Files selected for processing: 14
api/oss/src/apis/fastapi/channels/ingress.pyapi/oss/src/core/channels/commands.pyapi/oss/src/core/channels/service.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_ingress.pyapi/oss/tests/pytest/unit/channels/test_channels_turn_context.pyopenspec/changes/add-agent-embed/design.mdopenspec/changes/add-agent-embed/specs/channel-turn-context/spec.mdopenspec/changes/add-agent-embed/specs/embed-channel/spec.mdweb/mobile/src/features/embed/EmbedComposer.tsxweb/mobile/src/features/embed/embedConfig.tsweb/mobile/tests/unit/embedComposer.render.test.tsxweb/mobile/tests/unit/embedConfig.test.tsweb/packages/agenta-settings-ui/src/publish/embedApi.tsweb/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsx
🚧 Files skipped from review as they are similar to previous changes: 4
- api/oss/src/core/channels/commands.py
- api/oss/tests/pytest/unit/channels/test_channels_turn_context.py
- api/oss/src/core/channels/service.py
- openspec/changes/add-agent-embed/design.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
|
🤖 The AI agent says: @coderabbitai review |
|
🧠 Learnings used
✅ Action performedReview finished.
|
|
🤖 The AI agent says: @coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
11eee188-8574-43e1-b058-b2f277e48feb
📒 Files selected for processing: 43
api/oss/src/apis/fastapi/channels/ingress.pyapi/oss/src/apis/fastapi/channels/models.pyapi/oss/src/core/channels/adapters/embed/adapter.pyapi/oss/src/core/channels/adapters/embed/capabilities.pyapi/oss/src/core/channels/dtos.pyapi/oss/src/core/channels/interfaces.pyapi/oss/src/core/channels/service.pyapi/oss/src/core/workflows/service.pyapi/oss/src/core/workflows/types.pyapi/oss/src/dbs/postgres/channels/dao.pyapi/oss/src/tasks/asyncio/channels/inbox.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_adapter.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_ingress.pyapi/oss/tests/pytest/unit/channels/embed/test_embed_read_routes.pyapi/oss/tests/pytest/unit/channels/test_channels_outbox_worker.pyapi/oss/tests/pytest/unit/channels/test_channels_reaction_queries.pyapi/oss/tests/pytest/unit/channels/test_channels_turn_context.pyapi/oss/tests/pytest/unit/workflows/test_invoke_detached.pydocs/docs/guides/13-embed-an-agent.mdxdocs/docs/self-host/channels/02-embed-widget.mdxopenspec/changes/add-agent-embed/HANDOFF.mdopenspec/changes/add-agent-embed/design.mdopenspec/changes/add-agent-embed/qa.mdopenspec/changes/add-agent-embed/specs/embed-channel/spec.mdopenspec/changes/add-agent-embed/tasks.mdweb/mobile/src/features/embed/EmbedTurn.tsxweb/mobile/src/features/embed/embedClient.tsweb/mobile/src/features/embed/embedConfig.tsweb/mobile/src/features/embed/embedConversationModel.tsweb/mobile/src/features/embed/hostMessages.tsweb/mobile/src/features/embed/useEmbedConversation.tsweb/mobile/tests/unit/embedClient.test.tsweb/mobile/tests/unit/embedConfig.test.tsweb/mobile/tests/unit/embedConversation.render.test.tsxweb/mobile/tests/unit/embedConversationModel.test.tsweb/mobile/tests/unit/embedHostMessages.test.tsweb/packages/agenta-settings-ui/src/channels/CodeBlock.tsxweb/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsxweb/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.tsxweb/packages/agenta-settings-ui/src/publish/EmbedDomainsField.tsxweb/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsxweb/packages/agenta-settings-ui/src/publish/embedApi.tsweb/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsx
🚧 Files skipped from review as they are similar to previous changes: 3
- web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsx
- openspec/changes/add-agent-embed/HANDOFF.md
- openspec/changes/add-agent-embed/tasks.md
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
|
🤖 The AI agent says: @coderabbitai review |
|
🧠 Learnings used
✅ Action performedReview finished.
|
|
🤖 The AI agent says: @coderabbitai review |
|
🧠 Learnings used
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository YAML (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2c60d6ce-4c9a-40ba-b6bf-f0686151765a
📒 Files selected for processing: 16
docs/docs/guides/13-embed-an-agent.mdxweb/mobile/src/features/embed/EmbedAvatar.tsxweb/mobile/src/features/embed/EmbedChat.tsxweb/mobile/src/features/embed/EmbedComposer.tsxweb/mobile/src/features/embed/EmbedConversationList.tsxweb/mobile/src/features/embed/EmbedGreeting.tsxweb/mobile/src/features/embed/EmbedHeader.tsxweb/mobile/tests/unit/embedComposer.render.test.tsxweb/mobile/tests/unit/embedConversationList.render.test.tsxweb/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsxweb/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.tsxweb/packages/agenta-settings-ui/src/publish/EmbedDomainsField.tsxweb/packages/agenta-settings-ui/src/publish/EmbedSection.tsxweb/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsxweb/packages/agenta-settings-ui/src/publish/embedApi.tsweb/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsx
🚧 Files skipped from review as they are similar to previous changes: 3
- web/mobile/src/features/embed/EmbedHeader.tsx
- web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsx
- web/mobile/src/features/embed/EmbedComposer.tsx
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
|
🤖 The AI agent says: @coderabbitai review |
|
✅ Action performedReview finished.
|
…bdomains An embed with no allowed origins may be framed on any site: the config route returns ["*"] for it. Entries may start with one *. label. A list whose entries are all unusable, or a value of another type, stays restricted to no site.
…ny parent when unrestricted The widget sends frame-ancestors * and hears agenta:init and agenta:context from its parent on any origin when the embed lists no origins, and matches *.host entries like CSP. The create flow and the settings show the toggle, derived from the stored origin list.
A turn whose start fails writes nothing to the session, so the embed widget could not tell the visitor anything. The read route now returns unstarted_turns: refused triggers and failed ones that provably never ran (never_sent, or the new start_rejected for a start the workflow service itself answered with a failure, such as a model with no usable credential). A gateway 502 or 504 may have run and is not counted.
…en the agent cannot reply The pending send ended once the records held the message, while the running state only comes from live events after the read cursor, and the first message swapped the transcript for the loader. The widget now keeps its sends pending until the records hold them and a reply follows, re-reads while no turn runs, and shows "The agent could not reply. Try again." for a turn that never started, instead of the run's own error text.
Copies a plain prompt for an AI coding assistant that carries the exact snippet and says where to put it, what not to change, how to pass a visitor key, and how to check the result.
Publish > Embed has no create form any more. Create embed makes an embed named after the agent, open to any website, and opens its settings. The settings are collapsible sections (Add to your website, Specific domains, Appearance, Preview) with the current value on closed titles, Save changes in the footer and Archive as a red text button. Domain errors show under the list. The widget opens with the avatar, the name and stacked starter chips, shows tooltips on the header buttons and the file limits while files are attached, and puts New chat at the top of the conversation list, which hides the composer.
bce2ba4 to
0491139
Compare
|
@coderabbitai review |
|
@coderabbitai resume |
|
|
Context
Owners could publish an agent to Slack, Telegram, WhatsApp, the API, and the Agenta chat. They could not put it on their own website. With this PR an owner opens the agent's Publish > Embed, copies a snippet, and pastes it into a page. By default any website can show the chat; the owner can limit it to specific domains. Visitors then chat with the agent in an iframe on that page, with no Agenta login: replies stream, files go up and come back, approvals are answered in the widget, and history survives reloads and, when the website passes its own key, follows the visitor across devices.
v1 targets internal tools: a dashboard or small app with a chat panel whose agent calls that app's backend with the agent's own credentials. The spec is in
openspec/changes/add-agent-embed/(proposal, design with the options considered, specs, tasks, QA scenarios).This PR targets
release/v0.122.9and ships with v0.122.9.What ships
The embed is one more channel, not a parallel path. An embed is a channel connection, a visitor is a private space, and a conversation is a thread mapped to one session. The inbox, outbox, commands and session machinery are the ones Slack and Telegram already use.
embedadapter (api/oss/src/core/channels/adapters/embed/). One way in:POST /channels/embed/events/{embed_id}/for messages, files (base64, 5 MB each, at most 10) and approval answers. Four visitor read routes on the same router: the conversation list, one conversation with its records and open approval, its live event stream, and attachment download. A publicGET /channels/embed/{embed_id}/configreturns the name, allowed origins and appearance./m/embed/{embed_id}(web/mobile/src/pages/embed/andweb/mobile/src/features/embed/). It renders with the@agenta/chatmodel and components, so the widget and the owner's chat show a session the same way. The host page talks to it with a smallpostMessageprotocol (agenta:initfor a visitor key,agenta:contextfor host context,agenta:readyback). The typing dots stay on from the send until the reply starts. If a reply cannot start (for example, the agent's model has no credential), the visitor sees "The agent could not reply. Try again." and never the run's own error text. The conversation read route reports these turns asunstarted_turns, because a turn that never ran writes nothing to the session.docs/docs/guides/13-embed-an-agent.mdx), a self-host page (docs/docs/self-host/channels/02-embed-widget.mdx), and thechannels.embedsettings in the configuration reference.X-Frame-Optionsfor/m/embed/. Helm passesagenta.apiInternalUrlto the web-mobile pod, which the widget page uses to read the embed config server side.Channel-wide changes
These touch every channel, not only the embed.
processed.context.compose_inputrenders it as a labeled part after the sender attribution, marked as provided by the host and not verified. Only the embed fills it today.compose_inputadds the attribution or context part, the turn's user message also getsdisplay_contentwith only the person's text. The model still sees everything. Before, a Slack message showed in the chat asFrom Ana (slack id U1...): hello; now the bubble showshello(the exact "From" line varies by channel). Group turns with several senders keep the "From ..." lines, because they tell the speakers apart....id U1):hellorun together.usenow switches. Theusecommand closes the current thread row and opens a new current row on the chosen session, keeping its open approval. The outbox posts to a session's newest row. Before,useonly acknowledged.sessionsnow counts sessions, not thread rows.parse_eventtakes an optionalrequest, andbuild_setup_documentan optionallocator. Existing adapters accept and ignore them.Allowed domains are optional
Under Specific domains, the Only allow embedding the agent on specific domains toggle is off by default.
allowed_origins: ["*"], the widget page sendsframe-ancestors *, and the widget accepts messages from its parent page on any origin.https://*.example.comallows every subdomain ofexample.com, but notexample.comitself. The toggle state comes from the stored list; there is no separate flag.With the toggle off, anyone who copies the snippet can put the agent on their own website, and every message there uses the owner's model credits. The per-embed and per-key rate limits slow this down but do not cap the total spend, and they allow requests when Redis is not reachable. There is no spend cap in v1. To stop it, the owner turns the toggle on or archives the embed. The guide shows this as a warning next to the toggle, and the self-host page tells operators to keep the rate limits set.
Security model
frame-ancestorswith it, so browsers refuse to show it on any other website. Without a list it sendsframe-ancestors *. Every visitor route needs theX-Agenta-Visitor-Keyheader, so a browser call from another website needs a CORS preflight, which the API refuses. Both checks are in the browser. A script outside a browser can still call the routes; the visitor key and the rate limits cover that case.A-Z a-z 0-9 - _, or fewer than 12 distinct characters). A thread in another visitor's space answers 404, like an unknown one.New settings
All optional. Defaults in parentheses.
AGENTA_CHANNELS_EMBED_REQUESTS_PER_MINUTE_PER_EMBEDAGENTA_CHANNELS_EMBED_REQUESTS_PER_MINUTE_PER_KEYAGENTA_CHANNELS_EMBED_READ_REQUESTS_PER_MINUTE_PER_EMBEDAGENTA_CHANNELS_EMBED_READ_REQUESTS_PER_MINUTE_PER_KEYAGENTA_CHANNELS_EMBED_MAX_LIVE_STREAMS_PER_EMBEDAGENTA_CHANNELS_EMBED_MAX_MESSAGE_CHARSAGENTA_CHANNELS_EMBED_MAX_FILE_BYTESThe web-mobile server reads
AGENTA_API_INTERNAL_URL(falls back toAGENTA_API_URL) to fetch the embed config. Helm sets it fromagenta.apiInternalUrl.v1 limits
bindingsis a reserved name and is refused.Tests
@agenta/mobile565,@agenta/chat1344,@agenta/settings-ui207. Helm tests and the docs build pass.qa.mdand the owner setup pass. One bug was found and fixed during QA (an archived embed showed the browser's blocked frame instead of the notice). Results: [feat] Embed an agent on any website as a chat iframe #7662 (comment). The videos are kept with the QA run; they could not be attached to GitHub from this run.Follow-ups (not in this PR)
https://*.vercel.apporigin with credentials. For the embed this means a page there passes the preflight; it can still do no more than a script. Narrowing the rule is a separate security fix.What to QA
https://*.<your domain>to the list. A subdomain page shows the chat; the bare domain does not.