Run an agent from app pages
Run an agent from a page in your app, or use page events to start it, while people work.
Put an agent on an app page so a person runs it from there and reads its answer before acting. AI Builder sets the page when it creates the agent, and each agent's card shows it as Runs from a page name. A developer can also connect page events with JavaScript.
Before you begin
You need App Admin or Edit permission in development to build and publish the agent. People using the published agent need App Admin, Edit, or View permission on the app. The agent's tools must have working connections.
A run from a page starts as the signed-in person. Tool actions use the accounts saved on their connections. For example, a person with View access can start an agent whose connected account can update a record. Check tool access before the agent runs from a widely used page.
Set up and test the agent
- Open your app in AI Builder. Describe the agent, the page where a person should run it, the inputs they provide, and the output fields they should see.
- Open Blueprint > Custom Agents. On the agent's card, check Reads (inputs, * for required), Returns ("one answer" or "up to 10 answers") and Runs from against that request.
- Expand Instructions & example run and click Run the example to run the Draft with the sample values. A test runs real tools, so use data you can safely change. To test your own inputs, use the Agent API's test route.
- Click Generate. AI Builder creates and publishes the agent together with the app ("Created on Generate"). To change an agent later, see Change an app after it's generated.
- Open the page named under Runs from as an app user. In the agent panel, fill in the inputs and click Run. Read the answer when the background run finishes.

Each run accepts one PDF, PNG, JPG, or JPEG file if the agent has an Attachment input, up to 5 MB; PDFs can have up to 10 pages.
Click Try again to start another run with the last inputs. Each run starts fresh. Before you run again, check any tool actions from the previous run.
Start from another page event
A developer can use the Custom Agent SDK in these places:
| Event or location | Example use |
|---|---|
| Page load or pop-up open | Prepare a summary when a record opens. |
| Button, card, or image click | Start a review after a person asks for it. |
| Row selection or tab change | Analyze the selected item. |
| Form events on a page | Run a check when a person saves or acts on a form. |
| Field On change script or Button field script | Review changed information inside the app. |
| Custom component | Run an agent from the component's code. |
Use kf.app.getAgent(agentId) with execute({ inputData }), getExecution and onExecutionComplete. See Agent SDK for page JavaScript patterns and the SDK reference for signatures.
Form, field, gallery and table scripts stop after 1 minute, and the SDK watch for a run gives up after about 6 minutes. Those scripts, and page event scripts, also stop as soon as the next script starts on the same form, component or page, and a pending call or watch ends with them. In those scripts, keep the ExecutionId (for example, on the item) and read the run later with getExecution, or start the agent from a custom page or a custom component instead.
Check the page behavior
Keep the execution ID in custom page code so you can read the same run again. Show a running state and prevent accidental repeated starts. Start dependent work only after the run has completed successfully.
Page and form builders do not have a no-code Run agent action. These event routes require JavaScript and apply inside the app; they do not enable agents on portals, public forms, or forms opened outside the app, such as in My Tasks.

