Skip to main content
The agent pane is a chat with your agent inside your web app. The person using the app asks the agent something next to the ticket, order or report they are looking at, and the page can tell the agent what is on screen. Lua provides the pane: you add nothing to your pages. After this guide, you know where the pane opens, your page can open it, ask it something and send it page context with lua.pane, and an app made by an older template no longer bundles a pane of its own. About web apps explains the app model; Build and open your first web app gets you an app. Verified against lua-cli 3.55.0 and @lua-ai-global/app-client 0.0.5 (lua.pane).

Where the pane opens

In Lua Workspace, in the browser at workspace.heylua.ai and in the desktop app 0.75.0 or later, the person opens the pane with Chat, the rightmost item in the app’s top bar, after Pin. The pane opens over the right edge of the page, 380px wide, or as a bottom sheet below 768px wide. Chat, the pane’s close button, or Escape closes it. The pane always starts closed: every time the app opens, and on every page change inside the app. It opens only when the person selects Chat or the page calls lua.pane. When the pane isn’t available, for example for someone who can only view the app, or when the app has it turned off, Chat says why instead of opening. The admin console shows no pane for apps for now.
Lua adds the pane to every live app when it serves the app’s page, including apps made with lua-cli 3.53.0 or 3.54.0, whose pages bundle <AgentPaneLayout> from @lua-ai-global/app-chat. In Lua Workspace that bundled pane is hidden and the page keeps its full width, so nobody has to rebuild or push an app to get the new pane. To take the bundled pane out of the code too, run lua apps upgrade.A Lua desktop app older than 0.75.0 has no Chat button. There, an app that bundles <AgentPaneLayout> keeps its own pane docked on the right, and any other app shows the pane’s own button at the bottom right of the page.

How the pane works

  • Only the app’s own agent. The pane talks to the agent the web app belongs to, never another one. The page cannot pick a different agent or conversation.
  • Only for people who can read the agent. Anyone with full access to the app can use its pane. Someone who can only view the app cannot, and nobody else can.
  • One conversation per person per app. Each person has one ongoing conversation with the app’s agent, their own. Two people using the same app never see each other’s messages. The conversation also appears among the person’s chats in Lua Workspace, titled from its first message, and stays there if the app is deleted. There is no reset.
  • The agent knows where the person is. Every message carries the app’s name and the page’s path, and any context the page adds with lua.pane.setContext.
  • Billed like Workspace chat. Pane conversations are real usage, under the same plan and limits as chat in Lua Workspace.
  • On by default. Every web app has a pane unless its builders turn it off.
  • Not in a preview. A preview has no pane, because the agent it would reach is the live one.
The pane shows the agent’s replies as Markdown and draws the agent’s cards: lists and carousels (tapping a card sends its title), buttons (tapping one sends its label), links, images, payment cards and documents. Forms are not drawn in this version; the agent asks in text instead. Reasoning, tool calls and sources are not shown, and raw HTML shows as plain text. When the pane opens it loads the latest 50 messages, with Load earlier messages for the rest. When a reply stops for an approval, the pane says the step is waiting for approval in Lua Workspace and links there. Approve or deny it in Lua Workspace; the pane cannot approve.

New apps have nothing to add

From lua-cli 3.55.0, lua apps new bundles no pane: the page project depends on @lua-ai-global/app-client and not on @lua-ai-global/app-chat, and web/src/main.tsx renders the app and calls lua.start(), nothing else. The pane appears once the app is live. To drive it from the page, use lua.pane, which @lua-ai-global/app-client 0.0.5 and later have; the template already depends on a version that does.

Open or ask the pane from the page

lua.pane from @lua-ai-global/app-client is the page’s handle on the pane. Use it to open the pane from a button of your own, or to start a message for the person:
web/src/TicketActions.tsx
  • Calls wait for the pane. The page and the pane load separately, in either order. Calls made before the pane has loaded wait and reach it in order once it has; the latest 20 are kept.
  • Nothing happens without a pane. With the app’s pane turned off, for a person who can only view the app, under server rendering, or in Node, the calls do nothing. They also do nothing under lua apps dev, which serves no pane for these pages (Test it locally).
  • This page only. lua.pane reaches the pane on the same page. Nothing is posted anywhere else.
There is no way to read whether the pane is open: Lua Workspace decides that.

Tell the agent what is on screen

lua.pane.setContext sets what the agent gets with every message sent from the pane. Pass a function so the value is read when each message is sent, not when the page first rendered:
web/src/main.tsx
  • The function runs in the page every time a message is sent. Keep it a cheap read of state the page already has, with no fetches and no state changes. If it throws, the message goes without context.
  • Return only what the agent should see. The agent also gets the page’s path, so /tickets/42 already tells it something. Keep the context small and factual: ids, the current filter, the selected row. It may be at most 4096 bytes as JSON.
  • lua.pane.ask(text, { context }) sends its own context for that one message instead.
The agent treats page context as unverified information from the page, never as instructions. Do not rely on it to decide what the person may do: anything that changes data must still check the person in a tool or a route.

Refresh the page after a reply

The agent’s tools can change the same data your page shows. The pane does not tell the page when one of its replies ends, so there is no callback for it. Load fresh data when the page needs it, for example when the person comes back to a list. For messages the page sends itself with lua.chat.send, lua.chat.onTurnEnd(callback) is called after every reply and returns a function that unsubscribes:
web/src/App.tsx

Build your own chat

lua.chat from @lua-ai-global/app-client talks to the app’s agent directly. Use it for a chat of your own, or to send a message without the pane:
web/src/ask.ts
A failure rejects turn.text and turn.done, and throws from the loop, as a LuaApiError with status, code and, for 503, retryAfter in seconds:

Move an older app off the bundled pane

lua-cli 3.53.0 and 3.54.0 scaffold apps whose pages bundle the pane: web/package.json depends on @lua-ai-global/app-chat, web/src/main.tsx wraps the app in <AgentPaneLayout>, and web/src/index.css imports the pane’s styles. These apps keep working, and Lua Workspace already hides their bundled pane. Move them to the platform’s pane anyway: when the app is opened with the Chat button, a useAgentPane().ask() call still reaches the hidden bundled pane, so the person never sees what it asked. Run lua apps upgrade in the root of the agent project (lua-cli 3.55.0 or later):
In every script under web/src, the upgrade:
  • Replaces <AgentPaneLayout> with what it wraps. A context prop that is the layout’s only prop and reads only values defined at the top level of the file becomes lua.pane.setContext(...).
  • Replaces useAgentPane() with lua.pane from @lua-ai-global/app-client, and drops the imports this leaves unused. When a file now uses lua.pane, it raises @lua-ai-global/app-client in web/package.json to at least 0.0.5.
  • Once no script imports @lua-ai-global/app-chat any more, removes it from web/package.json and its styles @import from web/src/index.css.
An app made by the lua-cli 3.53.0 or 3.54.0 template comes out the same as a new one. A file the upgrade cannot rewrite is left as it is, and the command prints the steps to do by hand. That covers: While such a file still imports @lua-ai-global/app-chat, the upgrade keeps the dependency and its styles. Run the command again after your edits; it says when the app is up to date. Then push and deploy the app as usual (Release a version and roll back). <AgentPaneLayout>, <AgentPane> and useAgentPane from @lua-ai-global/app-chat are deprecated. They still work for apps that use them.

Test it locally

lua apps dev <name> serves no pane for pages that bundle none: Lua adds the pane once the app is deployed, and lua.pane calls do nothing locally. lua.chat works, as you, without signing in:
  • Sandbox, by default. lua.chat talks to your agent with the project’s local skills, processors and persona, as lua chat -e sandbox does. They are pushed to the sandbox on the first message; when that push fails, the message fails and the next one tries again.
  • Production with --chat-env production. lua.chat talks to the agent that is live, as lua chat -e production does.
  • A conversation of its own. Local chat uses a conversation kept apart from your conversation in the live app, so testing never mixes into it.
  • Restart after changing a skill. Your local skills are pushed once per run. Stop lua apps dev with Ctrl+C and start it again to chat with the change. Edits to the page and to routes reload as usual.
Local chat follows the same rules as the live pane: one reply at a time, the same limits, and agentPane: false turns it off. For pages that still bundle <AgentPaneLayout>, lua apps dev serves that pane and points to lua apps upgrade <name>. You see the platform’s pane once the app is deployed and open in Lua Workspace.

Turn it off

Set agentPane: false in defineWebApp:
src/apps/ops-dashboard/app.ts
The setting travels with each pushed version, so the change takes effect once that version is live, and rolling back to an earlier version brings back its setting. With the pane off, Lua adds no pane to the app, Chat says the chat is off, lua.pane calls do nothing, lua.chat.available() is false, and chat calls fail with AGENT_PANE_OFF. Remove the setting, or set it to true, to turn the pane back on. lua apps upgrade leaves the setting as it is.

Show the agent’s images

The pane is drawn in your app’s page, and a web app’s pages load images only from the hosts the app allows. Add the hosts your agent’s images come from, such as a product photo CDN, to pages.csp.imgSrc, or the pane’s image and card blocks show broken images:
src/apps/ops-dashboard/app.ts

Limits

If it isn’t working

Next steps

Write routes and pages

The full defineWebApp shape, the page client, and releases.

lua apps reference

lua apps upgrade, lua apps dev --chat-env and the other commands.

About web apps

Where apps open and who can open them.

Chat with your agent

lua chat in sandbox and production.