Skip to content

[feat] Embed an agent on any website as a chat iframe - #7662

Merged
mmabrouk merged 37 commits into
release/v0.122.9from
docs/agent-embed-spec
Oct 19, 2026
Merged

mmabrouk merged 37 commits into
release/v0.122.9from
docs/agent-embed-spec

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

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.9 and 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.

  • API. A new embed adapter (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 public GET /channels/embed/{embed_id}/config returns the name, allowed origins and appearance.
  • Widget. /m/embed/{embed_id} (web/mobile/src/pages/embed/ and web/mobile/src/features/embed/). It renders with the @agenta/chat model and components, so the widget and the owner's chat show a session the same way. The host page talks to it with a small postMessage protocol (agenta:init for a visitor key, agenta:context for host context, agenta:ready back). 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 as unstarted_turns, because a turn that never ran writes nothing to the session.
  • Owner screens. Publish lists Embed next to API. The panel creates an embed (name, optional domain list, greeting, starters, accent color), shows the snippet and a live preview, and archives. Next to the snippet's Copy, Copy prompt copies a ready prompt for an AI coding assistant: it holds 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. Embed conversations show in the agent's Sessions list like other channel conversations, titled with the embed's name.
  • Docs. A guide (docs/docs/guides/13-embed-an-agent.mdx), a self-host page (docs/docs/self-host/channels/02-embed-widget.mdx), and the channels.embed settings in the configuration reference.
  • Hosting. nginx no longer sends X-Frame-Options for /m/embed/. Helm passes agenta.apiInternalUrl to 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.

  • Host context. Channel events can carry processed.context. compose_input renders it as a labeled part after the sender attribution, marked as provided by the host and not verified. Only the embed fills it today.
  • The chat shows the person's own words. When compose_input adds the attribution or context part, the turn's user message also gets display_content with only the person's text. The model still sees everything. Before, a Slack message showed in the chat as From Ana (slack id U1...): hello; now the bubble shows hello (the exact "From" line varies by channel). Group turns with several senders keep the "From ..." lines, because they tell the speakers apart.
  • Attribution separator. The attribution and context parts now end with a blank line. The runner joins text parts with no separator, so before this the model saw ...id U1):hello run together.
  • use now switches. The use command 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, use only acknowledged. sessions now counts sessions, not thread rows.
  • parse_event takes an optional request, and build_setup_document an optional locator. 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.

  • Off. Any website can show the chat. The embed stores no list, the config returns allowed_origins: ["*"], the widget page sends frame-ancestors *, and the widget accepts messages from its parent page on any origin.
  • On. The owner enters one domain per line. An entry such as https://*.example.com allows every subdomain of example.com, but not example.com itself. 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

  • Where the widget can run. When the embed has a domain list, the widget page sends frame-ancestors with it, so browsers refuse to show it on any other website. Without a list it sends frame-ancestors *. Every visitor route needs the X-Agenta-Visitor-Key header, 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.
  • Who sees a conversation. A visitor is whoever holds the visitor key. Only its SHA-256 hash is stored. The widget makes a random key per browser by default. The host may pass its own key per user for cross-device history; it must be random. The server refuses keys it can recognize as weak (under 32 characters, characters outside 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.
  • What the agent can do. Every tool call uses the agent's own credentials. Host context only informs the model and is not verified.
  • Abuse limits. Rate limits per embed and per visitor key on the ingress and, separately and larger, on the read routes. Caps on message length, file size and file count. Each API process caps the open live streams per embed. An owner can archive an embed; its widget then shows "This chat is not available."

New settings

All optional. Defaults in parentheses.

Variable Default
AGENTA_CHANNELS_EMBED_REQUESTS_PER_MINUTE_PER_EMBED 600
AGENTA_CHANNELS_EMBED_REQUESTS_PER_MINUTE_PER_KEY 30
AGENTA_CHANNELS_EMBED_READ_REQUESTS_PER_MINUTE_PER_EMBED 6000
AGENTA_CHANNELS_EMBED_READ_REQUESTS_PER_MINUTE_PER_KEY 240
AGENTA_CHANNELS_EMBED_MAX_LIVE_STREAMS_PER_EMBED 200
AGENTA_CHANNELS_EMBED_MAX_MESSAGE_CHARS 10000
AGENTA_CHANNELS_EMBED_MAX_FILE_BYTES 5242880 (5 MB)

The web-mobile server reads AGENTA_API_INTERNAL_URL (falls back to AGENTA_API_URL) to fetch the embed config. Helm sets it from agenta.apiInternalUrl.

v1 limits

  • Visitors see tool activity. The widget shows the session's full records, as the Agenta chat does: tool calls with their arguments and results. Choose the embedded agent's tools with this in mind.
  • The first reply of a new conversation may appear whole. The widget learns the new thread by polling the list after the first message. If the reply started before it subscribed, it shows when the turn ends. Later messages stream.
  • A reopen can race an approval card. If a visitor reopens a conversation in the moment between a run pausing for approval and the outbox writing the card, that approval cannot be answered from the widget.
  • Anonymous history lives in browser storage. Clearing it (or Safari's seven-day rule) loses the list. A host key avoids this.
  • No bindings, HTTP tools or per-user tool scoping. bindings is a reserved name and is refused.
  • Conversation list rows show only the start time.

Tests

  • API unit tests: 8170 pass. Full API suite against a dev stack: 9283 pass; the 116 failures are gateway env-file tests that fail the same way on the base branch.
  • Web unit tests: @agenta/mobile 565, @agenta/chat 1344, @agenta/settings-ui 207. Helm tests and the docs build pass.
  • Recorded live QA on a dev stack: every scenario in qa.md and 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.
  • Live checks for the later changes on the dev stack: optional domains (21 of 21 pass: the chat on two unlisted hosts with the toggle off, the toggle saved on and off, a subdomain entry that admits a subdomain and blocks the bare domain, existing restricted embeds unchanged) and the widget fixes (14 of 14 pass: no gap in the typing dots for a first message and a follow-up, the error for a stopped service and for a model with no credential, and Copy prompt's clipboard text).

Follow-ups (not in this PR)

  • Channel turns start cold. The runner does not keep the sandbox warm after a turn the channel worker started, so the next turn on that session rebuilds it (about 3 s more than a direct chat send). This affects every channel. The fix is in the runner's park decision for detached invokes.
  • The API's CORS rule admits every https://*.vercel.app origin 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.
  • The reopen-during-approval race above. Keeping the open choice per session instead of per thread row would remove it.
  • /m shows a wrong "add your model provider key" banner in some setups (seen during the spike, unrelated to this change).
  • Conversation titles in the widget list. A first-message preview would help visitors find an old conversation.

What to QA

  • On an agent, open Publish > Embed, create an embed with the specific-domains toggle on and your test website's origin, add a greeting. The snippet and a preview show.
  • Paste the snippet into a page on that origin. The widget shows the greeting; send a message and the reply streams.
  • Reload the page. The conversation is still there. Click New chat, send, then open the list. Both conversations show.
  • Open the same page in a private window. No old conversations show.
  • Load the snippet from an origin that is not on the list. The browser refuses the frame.
  • Create a second embed with the toggle off. Its snippet loads on a page on any origin.
  • Add https://*.<your domain> to the list. A subdomain page shows the chat; the bare domain does not.
  • Send a message and watch the widget. The typing dots show without a break until the reply starts.
  • Point the agent at a model with no credential and send. The widget says "The agent could not reply. Try again."
  • Click Copy prompt. The clipboard holds a prompt with the exact snippet.
  • Ask the agent to run a tool that needs approval. An approval card shows in the widget; Approve continues the run.
  • In the agent's Sessions list, the visitor conversation shows with the embed's name.
  • Archive the embed and reload the page. The widget says "This chat is not available."
  • Regression: send a Slack or Telegram message to a published agent. The owner's chat shows only the message text, and the agent still knows who sent it.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b29b1c9e-787f-4c8e-be66-bc4961164748
📥 Commits

Reviewing files that changed from the base of the PR and between 2feac8b and f50a49d.

📒 Files selected for processing: 2
  • web/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsx
  • web/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added embeddable agent chat with publishing and appearance settings, optional domain restrictions, and visitor-specific conversation history.
    • The widget supports streaming replies, conversation switching, approvals, and file uploads and downloads. Website hosts can provide a visitor identity, display name, and context.
    • Chat preserves visitors’ original words in the transcript when sender details or host context are added to the agent’s input.
  • Bug Fixes
    • Unreadable file attachments remain visible in chat, and conversation switching now provides feedback when it cannot be completed.
  • Documentation
    • Added embed setup and self-hosting guides, along with proposal, design, and QA materials.

This pull request adds an embeddable agent chat through a new channel adapter, visitor-scoped API routes, a mobile web widget, and publishing controls. It also adds host context and display-content handling, channel session switching, and hosting and documentation updates.

Changes: Agent embed and channel context

Layer / File(s) Summary
Channel context and display content
api/oss/src/core/channels/*, api/oss/src/tasks/asyncio/channels/inbox.py, api/oss/tests/pytest/unit/channels/*, openspec/changes/add-agent-embed/specs/channel-turn-context/spec.md
Processed events can include credential-redacted context. Model input includes attribution and context. Single-sender turns can expose the person’s words through display_content; media failure notes are appended when available. Workflow-start rejections receive a distinct status, and unstarted turns can be counted.
Embed adapter and visitor identity
api/oss/src/core/channels/adapters/*, api/oss/tests/pytest/unit/channels/embed/*, api/oss/tests/pytest/integration/channels/*
Adds EmbedAdapter, visitor-key validation and hashing, origin sanitization, event parsing, media handling, and setup-document generation. Adapter interfaces accept request context and setup locators.
Visitor ingress and scoped reads
api/oss/src/apis/fastapi/channels/*, api/entrypoints/*, api/oss/src/middlewares/auth.py, api/oss/src/utils/env.py, api/oss/tests/pytest/unit/channels/embed/*
Registers embed routes for events, configuration, conversations, streams, and files. Routes validate keys and payload limits, apply throttles, and scope reads to visitor conversations.
Embedded widget and conversation client
web/mobile/src/features/embed/*, web/mobile/src/pages/embed/*, web/mobile/src/pages/_app.tsx, web/packages/agenta-chat/src/transport/sessionLiveEvents.ts, web/mobile/tests/unit/*, web/packages/agenta-chat/tests/unit/transport/sessionLiveEvents.test.ts
Adds the iframe widget, host messaging, visitor-key handling, conversation history, streaming, approvals, file uploads and downloads, and embed-specific page providers.
Publishing controls
web/packages/agenta-settings-ui/src/channels/*, web/packages/agenta-settings-ui/src/publish/*, web/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsx, web/mobile/src/features/agents/useAgentPublishPanel.tsx
Adds an Embed route and controls to create, list, configure, preview, and archive embeds.
Specifications, documentation, and deployment
openspec/*, docs/docs/guides/13-embed-an-agent.mdx, docs/docs/self-host/*, hosting/*, web/turbo.json
Adds embed specifications, QA scenarios, user and operator guides, proxy routing, internal API URL configuration, and development environment pass-through.
Session switching and live relay
api/oss/src/core/channels/commands.py, api/oss/src/tasks/asyncio/channels/*, api/oss/src/apis/fastapi/sessions/live_events.py, api/oss/tests/pytest/unit/channels/*, api/oss/tests/pytest/unit/sessions/test_live_relay.py, web/packages/agenta-chat/src/transport/sessionLiveEvents.ts
Implements !use session switching, counts unique sessions, selects the newest thread row for outbox delivery, and handles live-event dispatch and unsubscribe cancellation.

Sequence Diagram(s)

sequenceDiagram
  participant HostPage
  participant EmbedWidget
  participant EmbedRoutes
  participant ChannelIngress
  participant AgentSession
  HostPage->>EmbedWidget: Send initialization and context
  EmbedWidget->>EmbedRoutes: Send visitor-key-authenticated request
  EmbedRoutes->>ChannelIngress: Validate and ingest event
  ChannelIngress->>AgentSession: Process visitor turn
  AgentSession-->>EmbedRoutes: Stream session events
  EmbedRoutes-->>EmbedWidget: Return scoped events and records
Loading

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: 🟡 Moderate · up to f50a4

Resolve or explicitly accept the public config route’s database-load risk and the failed thread-switch recovery gap before merging. The domain-error correction is present.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.59% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 290 functions across 100 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the primary change: adding an embeddable agent chat iframe for websites.
Description check Passed The description is directly related to the changeset and provides detailed context about the embed channel, widget, API routes, owner controls, security model, hosting, tests, and known limitations.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

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
📥 Commits

Reviewing files that changed from the base of the PR and between 0f61379 and b72c144.

📒 Files selected for processing: 8
  • openspec/README.md
  • openspec/changes/add-agent-embed/HANDOFF.md
  • openspec/changes/add-agent-embed/design.md
  • openspec/changes/add-agent-embed/proposal.md
  • openspec/changes/add-agent-embed/qa.md
  • openspec/changes/add-agent-embed/specs/channel-turn-context/spec.md
  • openspec/changes/add-agent-embed/specs/embed-channel/spec.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.

@coderabbitai coderabbitai Bot left a comment

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.

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
📥 Commits

Reviewing files that changed from the base of the PR and between b72c144 and e3ef272.

📒 Files selected for processing: 5
  • openspec/changes/add-agent-embed/design.md
  • openspec/changes/add-agent-embed/proposal.md
  • openspec/changes/add-agent-embed/qa.md
  • openspec/changes/add-agent-embed/specs/embed-channel/spec.md
  • openspec/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.

@coderabbitai coderabbitai Bot left a comment

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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 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 win

Define the first-message session handoff before implementing the embed transport.

The new command only closes the current thread. The next message creates or resolves the new thread in the asynchronous worker after ingress returns 202. The widget therefore may not know the session ID before the worker emits live frames. HANDOFF.md records 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
📥 Commits

Reviewing files that changed from the base of the PR and between e3ef272 and e7f2878.

📒 Files selected for processing: 2
  • openspec/changes/add-agent-embed/HANDOFF.md
  • openspec/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.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Item Value
Status stopped
Commit 0491139cd23aeef49439d060419e06c0ea59c353
Manual expiry (UTC) Not granted
CI deadline (UTC) Not granted
Workflow https://github.com/Agenta-AI/agenta/actions/runs/39230193256

PR closed or converted to draft. Environment absence verified; retained storage requires separate provider accounting.

Post /preview as a new comment to request a one-hour preview. Repeating it while active does not extend the hour.
Preview data is disposable. Expiry is enforced by the next successful cleanup sweep, not an exact timer.
Environment deletion stops its compute. Provider-retained storage and permanent services may still be billed.

@coderabbitai coderabbitai Bot left a comment

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.

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 anchored config match. 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
📥 Commits

Reviewing files that changed from the base of the PR and between d409d59 and 6cef7ef.

📒 Files selected for processing: 39
  • api/entrypoints/channel_adapters.py
  • api/entrypoints/routers.py
  • api/oss/src/apis/fastapi/channels/ingress.py
  • api/oss/src/apis/fastapi/channels/models.py
  • api/oss/src/core/channels/adapters/agenta/adapter.py
  • api/oss/src/core/channels/adapters/bridge/adapter.py
  • api/oss/src/core/channels/adapters/embed/__init__.py
  • api/oss/src/core/channels/adapters/embed/adapter.py
  • api/oss/src/core/channels/adapters/embed/capabilities.py
  • api/oss/src/core/channels/adapters/interface.py
  • api/oss/src/core/channels/adapters/mock/adapter.py
  • api/oss/src/core/channels/adapters/slack/adapter.py
  • api/oss/src/core/channels/adapters/telegram/adapter.py
  • api/oss/src/core/channels/adapters/whatsapp/adapter.py
  • api/oss/src/core/channels/service.py
  • api/oss/src/middlewares/auth.py
  • api/oss/src/utils/env.py
  • api/oss/tests/pytest/integration/channels/test_channels_connection_write_path_integration.py
  • api/oss/tests/pytest/integration/channels/test_channels_ingress_seam.py
  • api/oss/tests/pytest/integration/channels/test_channels_outbox_worker_integration.py
  • api/oss/tests/pytest/unit/channels/contract/fakes.py
  • api/oss/tests/pytest/unit/channels/embed/__init__.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_adapter.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_contract_suite.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_ingress.py
  • api/oss/tests/pytest/unit/channels/test_channel_adapter_interface.py
  • api/oss/tests/pytest/unit/channels/test_channels_connection_write_path.py
  • api/oss/tests/pytest/unit/channels/test_channels_hydration_never_leaks_to_a_response.py
  • api/oss/tests/pytest/unit/channels/test_channels_ingress.py
  • api/oss/tests/pytest/unit/channels/test_channels_ingress_public_endpoints.py
  • api/oss/tests/pytest/unit/channels/test_channels_install_connection.py
  • api/oss/tests/pytest/unit/channels/test_channels_reconnect_after_disconnect.py
  • api/oss/tests/pytest/unit/channels/test_channels_setup_declaration.py
  • api/oss/tests/pytest/unit/channels/test_channels_slack_hosted_lifecycle.py
  • api/oss/tests/pytest/unit/test_channel_adapters_entrypoint.py
  • openspec/changes/add-agent-embed/HANDOFF.md
  • openspec/changes/add-agent-embed/design.md
  • openspec/changes/add-agent-embed/specs/embed-channel/spec.md
  • openspec/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.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Website preview

Preview URL: https://pr-7662-agenta-website-preview.mahmoud-637.workers.dev

Built from 0491139cd23aeef49439d060419e06c0ea59c353. This comment updates in place on every push.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

📘 Docs preview

Status ✅ Ready
Preview https://pr-7662-agenta-docs-preview.mahmoud-637.workers.dev/docs/
Inspect Actions run
Commit 0491139cd23aeef49439d060419e06c0ea59c353

Pages changed in this pull request

This comment updates in place on every push.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Recorded live QA of the agent embed. Six videos cover the owner setup and all 15 scenarios in qa.md: an owner creates an embed, a visitor chats on an allowed website (streaming, a file, an approval, a message during a running turn), history across reloads, chats and devices, host context, a blocked website and a short visitor key, and the owner view, rate limit and archive. All 15 scenarios pass. One bug was found and fixed during the run (an archived embed showed the browser's blocked frame, not the "not available" notice; fix in d2f7e97c7b).

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 evidence/qa/.

Video Length What it shows
01-owner-setup.mp4 26 s The owner opens Publish > Embed, creates "Acme help widget" with one allowed origin, sets a greeting, two starters and an accent color, copies the snippet and sees the preview.
02-visitor-chat.mp4 82 s On the allowed website, the widget loads, a reply streams, an attached file reaches the agent, an approval card is approved and the run continues, and a second message sent during a running turn is answered in order.
03-history.mp4 90 s A reload keeps the conversation, New chat keeps the old one in the list, a fresh browser sees nothing, and two devices with the same visitor key see the same history.
04-host-context.mp4 23 s The host page sends {"page": "/invoices"} and the agent answers "You are on the /invoices page." The user bubble shows only the visitor's text.
05-blocked-origin-weak-key.mp4 20 s On a website that is not allowed, the browser refuses the frame and the CORS preflight fails. A short visitor key gets "This chat could not start" and no composer.
06-owner-view-and-limits.mp4 54 s The owner reads the visitor conversations in the agent's Sessions list, the fourth quick message gets "Too many messages. Try again in 18 seconds.", and after an archive the widget shows "This chat is not available."
# Scenario Result
0 Owner creates the embed Pass
1 Widget loads on an allowed site Pass
2 Widget is blocked on another site Pass
3 First message streams a reply Pass
4 Reload keeps the conversation Pass
5 New chat keeps the old one Pass
6 Another browser does not see my conversations Pass
7 Same history on two devices Pass
8 Short key is refused Pass (the widget refuses the key at load, so there is no composer to send from)
9 The agent sees host context Pass
10 Approval in the widget Pass
11 File upload reaches the agent Pass
12 Message during a running turn Pass
13 Owner reads embed conversations Pass
14 Rate limit Pass (run with a per-key limit of 3 so 4 messages reach it)
15 Archived embed Pass after the fix in d2f7e97c7b

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.

@mmabrouk mmabrouk changed the title [docs] Agent embed v1 specification [feat] Embed an agent on any website as a chat iframe Oct 17, 2026
@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will review the changes in this PR.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

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
📥 Commits

Reviewing files that changed from the base of the PR and between 6cef7ef and 25df4ba.

📒 Files selected for processing: 80
  • api/entrypoints/routers.py
  • api/oss/src/apis/fastapi/channels/ingress.py
  • api/oss/src/apis/fastapi/channels/models.py
  • api/oss/src/apis/fastapi/sessions/live_events.py
  • api/oss/src/core/channels/adapters/embed/adapter.py
  • api/oss/src/core/channels/commands.py
  • api/oss/src/core/channels/service.py
  • api/oss/src/tasks/asyncio/channels/inbox.py
  • api/oss/src/tasks/asyncio/channels/outbox.py
  • api/oss/src/utils/env.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_adapter.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_read_routes.py
  • api/oss/tests/pytest/unit/channels/test_channels_commands.py
  • api/oss/tests/pytest/unit/channels/test_channels_inbox_dispatcher.py
  • api/oss/tests/pytest/unit/channels/test_channels_outbox_worker.py
  • api/oss/tests/pytest/unit/channels/test_channels_service_routing.py
  • api/oss/tests/pytest/unit/channels/test_channels_turn_context.py
  • api/oss/tests/pytest/unit/sessions/test_live_relay.py
  • docs/docs/guides/13-embed-an-agent.mdx
  • docs/docs/self-host/channels/02-embed-widget.mdx
  • docs/docs/self-host/reference/01-configuration.mdx
  • hosting/docker-compose/oss/nginx/nginx.conf
  • hosting/kubernetes/helm/templates/web-mobile-deployment.yaml
  • hosting/kubernetes/helm/tests/test_web_mobile.py
  • openspec/changes/add-agent-embed/HANDOFF.md
  • openspec/changes/add-agent-embed/design.md
  • openspec/changes/add-agent-embed/specs/embed-channel/spec.md
  • openspec/changes/add-agent-embed/tasks.md
  • web/mobile/src/features/agents/useAgentPublishPanel.tsx
  • web/mobile/src/features/app/AppProviders.tsx
  • web/mobile/src/features/app/BareProviders.tsx
  • web/mobile/src/features/embed/EmbedAvatar.tsx
  • web/mobile/src/features/embed/EmbedChat.tsx
  • web/mobile/src/features/embed/EmbedChatScreen.tsx
  • web/mobile/src/features/embed/EmbedComposer.tsx
  • web/mobile/src/features/embed/EmbedConversationList.tsx
  • web/mobile/src/features/embed/EmbedFile.tsx
  • web/mobile/src/features/embed/EmbedGreeting.tsx
  • web/mobile/src/features/embed/EmbedHeader.tsx
  • web/mobile/src/features/embed/EmbedTranscript.tsx
  • web/mobile/src/features/embed/EmbedTurn.tsx
  • web/mobile/src/features/embed/embedClient.ts
  • web/mobile/src/features/embed/embedConfig.ts
  • web/mobile/src/features/embed/embedConversationModel.ts
  • web/mobile/src/features/embed/embedFiles.ts
  • web/mobile/src/features/embed/embedRoute.ts
  • web/mobile/src/features/embed/hostMessages.ts
  • web/mobile/src/features/embed/sseReader.ts
  • web/mobile/src/features/embed/states/EmbedKeyRefused.tsx
  • web/mobile/src/features/embed/states/EmbedLoading.tsx
  • web/mobile/src/features/embed/states/EmbedNotice.tsx
  • web/mobile/src/features/embed/states/EmbedUnavailable.tsx
  • web/mobile/src/features/embed/useEmbedConversation.ts
  • web/mobile/src/features/embed/useEmbedTheme.ts
  • web/mobile/src/features/embed/useEmbedVisitor.ts
  • web/mobile/src/features/embed/visitorKey.ts
  • web/mobile/src/pages/_app.tsx
  • web/mobile/src/pages/embed/[embedId].tsx
  • web/mobile/tests/unit/embedClient.test.ts
  • web/mobile/tests/unit/embedComposer.render.test.tsx
  • web/mobile/tests/unit/embedConfig.test.ts
  • web/mobile/tests/unit/embedConversationModel.test.ts
  • web/mobile/tests/unit/embedHostMessages.test.ts
  • web/mobile/tests/unit/embedRoute.test.ts
  • web/mobile/tests/unit/embedSseReader.test.ts
  • web/mobile/tests/unit/embedVisitorKey.test.ts
  • web/packages/agenta-chat/src/transport/sessionLiveEvents.ts
  • web/packages/agenta-chat/tests/unit/transport/sessionLiveEvents.test.ts
  • web/packages/agenta-settings-ui/src/channels/ChannelsHubView.tsx
  • web/packages/agenta-settings-ui/src/channels/actions.ts
  • web/packages/agenta-settings-ui/src/channels/index.ts
  • web/packages/agenta-settings-ui/src/channels/useChannelPanel.tsx
  • web/packages/agenta-settings-ui/src/index.ts
  • web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsx
  • web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.tsx
  • web/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsx
  • web/packages/agenta-settings-ui/src/publish/embedApi.ts
  • web/packages/agenta-settings-ui/src/publish/index.ts
  • web/packages/agenta-settings-ui/tests/unit/agentEmbedPanel.test.tsx
  • web/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.

Comment thread api/oss/src/core/channels/commands.py Resolved
Comment thread api/oss/src/core/channels/service.py Resolved
@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will trigger a review of the changes in this PR.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

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
📥 Commits

Reviewing files that changed from the base of the PR and between 25df4ba and 1e038c4.

📒 Files selected for processing: 14
  • api/oss/src/apis/fastapi/channels/ingress.py
  • api/oss/src/core/channels/commands.py
  • api/oss/src/core/channels/service.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_ingress.py
  • api/oss/tests/pytest/unit/channels/test_channels_turn_context.py
  • openspec/changes/add-agent-embed/design.md
  • openspec/changes/add-agent-embed/specs/channel-turn-context/spec.md
  • openspec/changes/add-agent-embed/specs/embed-channel/spec.md
  • web/mobile/src/features/embed/EmbedComposer.tsx
  • web/mobile/src/features/embed/embedConfig.ts
  • web/mobile/tests/unit/embedComposer.render.test.tsx
  • web/mobile/tests/unit/embedConfig.test.ts
  • web/packages/agenta-settings-ui/src/publish/embedApi.ts
  • web/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.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will trigger a review of the changes in this PR.


🧠 Learnings used
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/core/channels/service.py:2560-2561
Timestamp: 2026-10-17T08:45:54.840Z
Learning: For Agenta's embed-channel v1, host context comes from the owner's own page. The design explicitly accepts unverified host context as a risk. In api/oss/src/core/channels/service.py, _context_part labels this context as unverified data and warns against following instructions in it. Additional prompt-injection machinery is not a v1 requirement under this design; tool execution continues to use the agent's own credentials.
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/core/channels/adapters/embed/adapter.py:325-350
Timestamp: 2026-10-17T08:45:50.399Z
Learning: In Agenta's embed channel, raw base64 uploads in api/oss/src/core/channels/adapters/embed/adapter.py remain in persisted inbox events after session attachments are created. This is an accepted v1 storage trade-off documented in openspec/changes/add-agent-embed/design.md under “Uploads stay in the inbox row.” Inbox reads require project channel-view access. Do not treat duplicate storage alone as an authorization bypass or require durable pre-ingress staging for v1; durable staging with a lifecycle is follow-up work.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will trigger a review of the changes in this PR.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

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
📥 Commits

Reviewing files that changed from the base of the PR and between db96acb and c007fe1.

📒 Files selected for processing: 43
  • api/oss/src/apis/fastapi/channels/ingress.py
  • api/oss/src/apis/fastapi/channels/models.py
  • api/oss/src/core/channels/adapters/embed/adapter.py
  • api/oss/src/core/channels/adapters/embed/capabilities.py
  • api/oss/src/core/channels/dtos.py
  • api/oss/src/core/channels/interfaces.py
  • api/oss/src/core/channels/service.py
  • api/oss/src/core/workflows/service.py
  • api/oss/src/core/workflows/types.py
  • api/oss/src/dbs/postgres/channels/dao.py
  • api/oss/src/tasks/asyncio/channels/inbox.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_adapter.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_ingress.py
  • api/oss/tests/pytest/unit/channels/embed/test_embed_read_routes.py
  • api/oss/tests/pytest/unit/channels/test_channels_outbox_worker.py
  • api/oss/tests/pytest/unit/channels/test_channels_reaction_queries.py
  • api/oss/tests/pytest/unit/channels/test_channels_turn_context.py
  • api/oss/tests/pytest/unit/workflows/test_invoke_detached.py
  • docs/docs/guides/13-embed-an-agent.mdx
  • docs/docs/self-host/channels/02-embed-widget.mdx
  • openspec/changes/add-agent-embed/HANDOFF.md
  • openspec/changes/add-agent-embed/design.md
  • openspec/changes/add-agent-embed/qa.md
  • openspec/changes/add-agent-embed/specs/embed-channel/spec.md
  • openspec/changes/add-agent-embed/tasks.md
  • web/mobile/src/features/embed/EmbedTurn.tsx
  • web/mobile/src/features/embed/embedClient.ts
  • web/mobile/src/features/embed/embedConfig.ts
  • web/mobile/src/features/embed/embedConversationModel.ts
  • web/mobile/src/features/embed/hostMessages.ts
  • web/mobile/src/features/embed/useEmbedConversation.ts
  • web/mobile/tests/unit/embedClient.test.ts
  • web/mobile/tests/unit/embedConfig.test.ts
  • web/mobile/tests/unit/embedConversation.render.test.tsx
  • web/mobile/tests/unit/embedConversationModel.test.ts
  • web/mobile/tests/unit/embedHostMessages.test.ts
  • web/packages/agenta-settings-ui/src/channels/CodeBlock.tsx
  • web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsx
  • web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.tsx
  • web/packages/agenta-settings-ui/src/publish/EmbedDomainsField.tsx
  • web/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsx
  • web/packages/agenta-settings-ui/src/publish/embedApi.ts
  • web/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.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will trigger a review of the changes in this PR.


🧠 Learnings used
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/core/channels/service.py:2560-2561
Timestamp: 2026-10-17T08:45:54.840Z
Learning: For Agenta's embed-channel v1, host context comes from the owner's own page. The design explicitly accepts unverified host context as a risk. In api/oss/src/core/channels/service.py, _context_part labels this context as unverified data and warns against following instructions in it. Additional prompt-injection machinery is not a v1 requirement under this design; tool execution continues to use the agent's own credentials.
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/core/channels/adapters/embed/adapter.py:325-350
Timestamp: 2026-10-17T08:45:50.399Z
Learning: In Agenta's embed channel, raw base64 uploads in api/oss/src/core/channels/adapters/embed/adapter.py remain in persisted inbox events after session attachments are created. This is an accepted v1 storage trade-off documented in openspec/changes/add-agent-embed/design.md under “Uploads stay in the inbox row.” Inbox reads require project channel-view access. Do not treat duplicate storage alone as an authorization bypass or require durable pre-ingress staging for v1; durable staging with a lifecycle is follow-up work.
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/apis/fastapi/channels/ingress.py:313-319
Timestamp: 2026-10-17T08:45:46.779Z
Learning: In Agenta's embed architecture, web/mobile/src/pages/embed/[embedId].tsx fetches GET /channels/embed/{embed_id}/config server-side for each widget page load. A source-IP throttle in ChannelsIngressRouter.fetch_embed_config would group unrelated visitors and embeds behind the web-mobile server. Source-based limits belong at the edge rather than in this API handler.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will trigger a review of the changes in this PR.


🧠 Learnings used
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/core/channels/service.py:2560-2561
Timestamp: 2026-10-17T08:45:54.840Z
Learning: For Agenta's embed-channel v1, host context comes from the owner's own page. The design explicitly accepts unverified host context as a risk. In api/oss/src/core/channels/service.py, _context_part labels this context as unverified data and warns against following instructions in it. Additional prompt-injection machinery is not a v1 requirement under this design; tool execution continues to use the agent's own credentials.
Learnt from: mmabrouk
Repo: Agenta-AI/agenta PR: 7662
File: api/oss/src/core/channels/adapters/embed/adapter.py:325-350
Timestamp: 2026-10-17T08:45:50.399Z
Learning: In Agenta's embed channel, raw base64 uploads in api/oss/src/core/channels/adapters/embed/adapter.py remain in persisted inbox events after session attachments are created. This is an accepted v1 storage trade-off documented in openspec/changes/add-agent-embed/design.md under “Uploads stay in the inbox row.” Inbox reads require project channel-view access. Do not treat duplicate storage alone as an authorization bypass or require durable pre-ingress staging for v1; durable staging with a lifecycle is follow-up work.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

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
📥 Commits

Reviewing files that changed from the base of the PR and between 9d99df7 and 2feac8b.

📒 Files selected for processing: 16
  • docs/docs/guides/13-embed-an-agent.mdx
  • web/mobile/src/features/embed/EmbedAvatar.tsx
  • web/mobile/src/features/embed/EmbedChat.tsx
  • web/mobile/src/features/embed/EmbedComposer.tsx
  • web/mobile/src/features/embed/EmbedConversationList.tsx
  • web/mobile/src/features/embed/EmbedGreeting.tsx
  • web/mobile/src/features/embed/EmbedHeader.tsx
  • web/mobile/tests/unit/embedComposer.render.test.tsx
  • web/mobile/tests/unit/embedConversationList.render.test.tsx
  • web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.stories.tsx
  • web/packages/agenta-settings-ui/src/publish/AgentEmbedPanel.tsx
  • web/packages/agenta-settings-ui/src/publish/EmbedDomainsField.tsx
  • web/packages/agenta-settings-ui/src/publish/EmbedSection.tsx
  • web/packages/agenta-settings-ui/src/publish/EmbedSettingsForm.tsx
  • web/packages/agenta-settings-ui/src/publish/embedApi.ts
  • web/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.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I will trigger a review of the changes in this PR.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mmabrouk mmabrouk added lgtm This PR has been approved by a maintainer merge queue In the release merge queue; an agent is landing it labels Oct 19, 2026
Agenta Product Agent added 18 commits October 19, 2026 11:24
…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.
@mmabrouk
mmabrouk force-pushed the docs/agent-embed-spec branch from bce2ba4 to 0491139 Compare October 19, 2026 09:27
@mmabrouk
mmabrouk changed the base branch from release/v0.122.8 to release/v0.122.9 October 19, 2026 09:27
@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai resume

@mmabrouk
mmabrouk merged commit acd92e6 into release/v0.122.9 Oct 19, 2026
82 of 86 checks passed
@mmabrouk mmabrouk removed the merge queue In the release merge queue; an agent is landing it label Oct 19, 2026
@mmabrouk mmabrouk mentioned this pull request Oct 19, 2026
12 of 20 tasks
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Pull request is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant