Put a Hercules Agent inside an app you build on Hercules, so your users can talk to it on your pages. Use it for a support chat, a shopping assistant, or a button that runs the Agent on what the user typed.
- Hercules builds the chat and the backend code behind it. Your app's backend runs the Agent with your app's own key, so no key reaches the browser
- Your app keeps every chat in its own database
- The people signed in to your app can use it, and each one sees only their own chats
- Limits cap how often each user can run it and how many credits it spends a day
- Your users reach your app's own tools, and only the integrations you turn on for them
How do I add an Agent to my app?
Ask Hercules in the App Builder. Describe what the Agent should do:
Add a support chat to my app. Create a Hercules Agent that answers questions about our plans and pricing.Hercules then:
Proposes a plan
It lists the Agent's name, job, tools, page actions, and limits, and asks for your yes before it creates anything.
Creates the Agent
It creates the Agent in your Organization and writes its instructions.
Tests it
It sends the Agent two or three real user messages, and one message it must refuse, then fixes the instructions until the answers are right.
Adds the chat to your app
It builds the chat on your page and the backend code that runs the Agent and saves the chat. The chat works only for a signed-in user, so Hercules tries it in your preview when you are signed in there, and tells you what is left for you to try.
Gives you the link
It gives you the Agent's page in the Agents console, where you can review and change it.
Can I use an Agent I already built?
Yes. Any Agent in your Organization can run in your apps once you let it:
Open App access
Go to Agent → open the Agent → Manage → Agent settings → App access.
Turn it on
Switch on Let apps run this agent. Hercules sets Daily spend limit to 500 credits, which you can change right below.
Choose its integrations
Under Integrations in app runs, switch on each integration your users' chats may use. They all start off. See What can the people using my app reach?
Add it to an app
Click Add to an app, pick the app, and choose how to Use it as:
- Chat: a chat in the app where users talk to the Agent and watch it reply live
- Action: a button or form that runs the Agent on the user's input and shows the result
- Background: runs on a schedule, with no one watching, and saves what it finds in the app
Open in builder
Add any Requirements, then click Open in builder. Hercules opens the app with the request already sent.
Once Let apps run this agent is on, you can also ask Hercules in any app in your Organization to use the Agent by name. Only you can turn the switch on, so Hercules can't use an Agent until you do:
Use the Sales Assistant agent in a chat on the pricing page.Agents that Hercules creates from the App Builder are already allowed to run in your apps.
Who can use the Agent?
The people signed in to your app. Agents in apps run for signed-in users for now, so a visitor who is not signed in has to sign in before they can chat.
- Your app checks each user's sign-in before every run
- Each user sees only their own chats
- Your app needs Hercules Auth 2.0, so the Agent knows which user it is helping. An Agent does not run in an app without it
What can the people using my app reach?
Less than you can. The people using your app are outside your Organization, so when your app runs the Agent for one of them, the Agent works with fewer of its parts:
| Part of the Agent | In a run for one of your users |
|---|---|
| Your app's own tools | Available. Each call tells your app which user it is for |
| Integrations | Off until you switch each one on under App access → Integrations in app runs |
| Web | Available |
| File workspace | Each chat has its own files. The Agent can read the files its runs share, but not change them |
| Subagents | Available, with these same limits |
| Memory | Not used. The Agent neither reads nor saves memory |
| Auto-improve | Not available |
| Dev box | If your Organization has it: an Agent with the Dev box can't run for your users at all |
An integration that is off is not there in the run: the Agent does not have its tools, and nothing in the chat says so. If your app's Agent can't use a service it uses everywhere else, check its switch under Integrations in app runs.
Web stays on because it reads only public pages. Keep in mind that the Agent can put what it knows in a run into a web address it opens: its instructions, what your app's tools returned for that user, and anything from an integration you switched on. Keep secrets out of the instructions.
None of this changes the runs you start yourself. A chat in the console, a trigger, a channel, and a run your app starts with no user (a background job) all use the whole Agent as before.
How do I limit what the Agent spends?
Set these under App access. They save as soon as you change them.
| Limit | What it caps | Default |
|---|---|---|
| Runs per user | How many runs one user can start per hour. Up to 1,000 | 20 |
| Daily spend limit | How many credits the Agent can spend on runs your apps start, over a rolling 24 hours. Up to 100,000 | 500 |
Daily spend limit is required while apps can run the Agent. Runs per user caps each user, but every new account gets its own share, so only the daily limit caps the total. The limit counts what the Agent spent in the last 24 hours on threads your apps opened: their users' chats and their own jobs. Runs you start in the console or from a trigger are not counted. Spend counts for its 24 hours whether or not its thread still exists: deleting a thread does not lower the count. It is checked when a run starts. A run that is already going is not stopped when the limit is reached, so the day's total can pass the limit by what the runs in flight spend. Hercules sets it to 500 credits when you turn App access on, and when it creates an Agent from the App Builder. Watch Credits per run on Analytics and raise or lower it to fit.
When a user reaches a limit, the chat shows a short message instead of a reply. When your Organization runs out of credits, it shows that the assistant is not available right now. Top up on the AI Credits page.
These limits are separate from the run limits, which cap a single run wherever it starts.
Can the Agent do things on the page?
Yes. Page actions let the Agent act on your app's page, for example to open a page or fill in a form. The Agent decides when to call one, and your page runs it in the user's browser.
Page actions are one-way. The Agent tells the page what to do and carries on, without waiting for the page or seeing what happened there.
- If the user has your app open in more than one tab, only one tab runs each action
- An action runs within 2 minutes of the Agent sending it. If the user's page is closed for longer than that, the action is dropped, and the chat can tell the user it came too late
- Hercules checks what the Agent sends against the action's definition first. A call that does not fit is not sent to the page
- A page action opens a page or changes what the page shows. It never submits a form, buys, deletes, or changes a setting for the user. For those, give the Agent an app tool
Tell Hercules which actions you want when you ask for the Agent:
Let the agent open a product's page when the user asks about it, and fill in the contact form for them.Hercules adds them when it creates the Agent, and you can ask it to change them later. Page actions only run on your page, for a signed-in user, so Hercules tries them in your preview when you are signed in there, and otherwise tells you which ones to try.
A change to the Agent or to your app's backend takes effect right away, and a change to your pages takes effect when you publish. So when you add or rename a page action in an app that is already published, Hercules asks you to publish the new page first, and finishes the change once it is live. That way no open page gets an action it cannot run.
Can the Agent use my app's data?
Yes, through app tools: actions your app's backend offers the Agent, like looking up an order or booking a slot. Tell Hercules what the Agent should be able to do:
Let the agent look up the signed-in user's orders and cancel an order that hasn't shipped.Hercules writes the tools in your app's backend and connects them to the Agent. Each call tells your app which signed-in user it is for, checked by your app's Hercules Auth, so a tool works only with that user's data.
Where are the chats saved?
In your app's own database. Hercules sends each message, and the end of each run, to your app as the Agent works, so your app has the whole chat even when no one has the page open. Your app can also act when a run ends, for example to save what the Agent found.
What do users see of the Agent's tools?
That the Agent is working, and then its reply. By default the chat does not name the Agent's built-in tools and integrations, or show what any tool returned. Your app's backend still gets the full record. To show those details in the chat, ask Hercules in the App Builder.
Additional FAQ
What can Hercules change about the Agent from the App Builder?
For Agents created from that app, Hercules can set the instructions, prebuilt tools, page actions, Runs per user, and Daily spend limit. Changes to the instructions take effect right away.
Set these yourself on the Agent's pages:
- Connections to other services and their sign-in: Build → Integrations
- The model: Build → Instructions
- Files and skills: Build → Knowledge
- What starts it: Manage → Triggers
- Where it talks to people: Manage → Channels
Can Hercules edit an Agent it didn't create?
No. Hercules can change only Agents created from that app. It can still use your other Agents once you let them run in apps, but you change them yourself in the Agents console. See Instructions.
Who pays for the Agent's runs?
Your Organization. Every run from your app uses AI credits, the same credits as the rest of Hercules. See Costs and limits.
Can users send files or images to the Agent?
No. Agents in apps read text only, up to a size limit. If a message is too long, the chat asks the user to send a shorter one.
How does the chat connect to the Agent?
Your app's backend starts each run with your app's own key, and tells the Agent which signed-in user the run is for. Hercules sends the run's messages back into your app's database. The page shows the reply as the Agent writes it, with a pass that can read only that one run. Hercules builds all of this for you, and no key reaches the browser. To change how the chat works, ask Hercules in the App Builder.
Does my app need Hercules Auth 2.0?
Yes. Hercules signs what it sends to your app with your app's own Hercules Auth, and the Agent knows who a user is only when your app's own Hercules Auth signed them in. Without it, Hercules could not save replies to your app or use your app's tools, so it does not start a run for the app at all. To upgrade, click Users & Access → Auth Portal in your app sidebar, then Upgrade now. See Upgrade to Hercules Auth 2.0.
Why can't I turn on App access for my Agent?
It has the Dev box toolkit. A Dev box keeps its files, secrets, and sign-ins from one run to the next, so it is not shared with people outside your Organization. Remove the Dev box toolkit on Build → Integrations and publish, or build a second Agent without it for your app.
An Agent that had both before this rule keeps App access for the runs your app starts with no user. A run for one of your users is refused until you remove the Dev box.
My Agent has App access and no Daily spend limit
Agents that had App access before the limit was required keep running without one. Set a limit under App access when you are ready. Once it is set, it can be changed but not removed while apps can run the Agent.
I can't see App access
Using Agents in apps is switched on one Organization at a time. If App access is missing from Agent settings, contact hello@hercules.app.