Skip to main content

Building AI Agents

An AI agent is an assistant that can understand a user's request, choose the right Automation Hub action, follow progress, and explain the result in plain language.

The goal is not to make the AI do everything on its own. The goal is to make the AI helpful, careful, and easy to trust.

What an AI Agent Does

Understand
Read what the user wants to get done
Find
Look for the best matching automation
Confirm
Ask for missing or important details
Run
Start the approved automation
Report
Explain what happened and what to do next
Simple: a good agent turns a user request into a safe Automation Hub run, then keeps the user informed.

A Good Agent Feels Like This

User saysGood agent response
"Send the monthly sales report""I found the Monthly Sales Report automation. Which month should I use?"
"Run the backup job""I found two backup jobs: Database Backup and File Storage Backup. Which one should I run?"
"Stop that sync""I can stop the Customer Data Sync that is currently running. Please confirm before I stop it."
"Why did the job fail?""The job failed while sending the email because the recipient address was missing."

Core Responsibilities

1. Understand the Request

The agent should first identify what the user is trying to achieve.

Good examples:

  • "Generate a report"
  • "Check whether a job finished"
  • "Run onboarding for a new employee"
  • "Pause the current data sync"
  • "Find out why an automation failed"

If the request is unclear, the agent should ask a simple follow-up question before taking action.

2. Find the Right Automation

The agent should search Automation Hub instead of guessing.

If the user...The agent should...
Knows the exact automation nameLook up that automation directly
Describes the outcomeSearch for matching automations
Mentions a department or processNarrow the search by workspace or collection
Gives a vague requestShow the best matches and ask the user to choose

Example:

"I found three automations that may match: Monthly Sales Report, Regional Sales Summary, and Sales Email Digest. Which one do you want to run?"

3. Check Required Details

Before running anything, the agent should check what information the automation needs.

Common inputs include:

  • Date or month
  • Customer, vendor, or employee name
  • Region or department
  • Email recipient
  • File, folder, or report type
  • Approval choice

The agent should never guess important values when a wrong value could cause confusion, send the wrong message, or change important data.

4. Confirm Risky Actions

Some actions should require a clear confirmation.

SituationWhy the agent should confirm
Sending emails or notificationsThe message may go to real people
Updating business recordsIncorrect data can affect operations
Deleting, stopping, or overwriting workThe action may be hard to undo
Running a high-impact jobIt may affect many users or systems
More than one automation matchesThe agent may pick the wrong one

Confirmation should be short and specific:

"I am about to run Monthly Sales Report for March 2026 and email it to finance@example.com. Should I continue?"

5. Start and Monitor the Run

After the user confirms and all required details are available, the agent can start the automation.

While the automation is running, the agent should be able to answer:

  • Has it started?
  • Which step is running now?
  • Did it complete?
  • Did it fail?
  • Is it paused or stopped?
  • What should happen next?

6. Explain the Result

The user usually does not need raw technical output. They need a clear answer.

Automation resultHelpful explanation
Completed"The report was generated and emailed to the finance team."
Failed"The report was created, but the email step failed because the recipient was missing."
Paused"The job is waiting for approval before it sends the final email."
Stopped"The run was stopped before updating any records."

Example Conversation

User
"Send the March sales report to finance"
Agent
Finds the Monthly Sales Report automation
Agent
Confirms March 2026 and finance recipients
Automation Hub
Generates and emails the report
Agent
Reports that the job completed successfully

What to Prepare Before Using an Agent

Agents work best when automations are easy to understand.

PreparationWhy it helps
Clear automation namesThe agent can find the right job faster
Helpful descriptionsThe agent can explain what each automation does
Well-defined required inputsThe agent knows what to ask the user
Sensible tags and categoriesSearch results become more accurate
Permission rulesUsers only run automations they are allowed to use
Owner informationThe agent can tell users who to contact when something fails

Good Agent Rules

Search before acting

If the user does not name an exact automation, the agent should search first.

Ask when unsure

If the request is ambiguous, the agent should ask one clear question.

Confirm important actions

If the automation sends messages, changes data, or affects many users, the agent should confirm before running it.

Keep users updated

For longer jobs, the agent should explain whether the automation is running, paused, failed, or completed.

Explain failures simply

The agent should say which step failed and what the user can do next.

Common Agent Types

Agent typeWhat it helps with
Report assistantFinds, runs, and sends business reports
Operations assistantChecks health jobs, backups, alerts, and maintenance runs
Support assistantLooks up ticket-related automations and runs follow-up actions
Approval assistantStarts jobs that wait for manager or business approval
Monitoring assistantWatches running jobs and explains failures or delays

When the Agent Should Pause and Ask

The agent should stop and ask the user before continuing when:

  • Multiple automations look correct
  • Required information is missing
  • The action may send external communication
  • The action may change important data
  • The user asks to stop, pause, or resume a run
  • A previous run failed and the user asks to retry
  • The agent cannot tell whether the request is safe

Design Checklist

Use this checklist before making an automation available to AI assistants.

QuestionGood answer
Is the automation name clear?A user can understand it without opening details
Does the description explain the outcome?It says what the automation creates, sends, checks, or updates
Are required inputs obvious?The agent knows exactly what to ask for
Are risky actions protected?The agent knows when to request confirmation
Is there an owner?Users know who can help if the run fails
Are permissions correct?Only the right users can find or run it

Guardrails Are Enforced, Not Advisory

The confirmation habits above describe how a well-behaved agent should act. The platform also enforces those boundaries mechanically through a guardrail policy attached to the run. The engine applies the policy on every tool call and every model response — the agent cannot opt out.

A guardrail is an enforced cap, not a suggestion. When more than one guardrail applies to a run, the engine merges them into the tightest effective policy:

  • Permission rules union, keeping the strongest outcome per tool. Strength order is deny > ask > allow.
  • Numeric limits take the smallest value across all applied policies (tool-call caps, timeouts, run limits).
  • maxTokensPerResponse is a hard clamp — the response cannot exceed the tightest configured value, regardless of what a model request asks for.

Human-in-the-Loop Approval

When a guardrail sets destructiveApprovalMode to ask, a destructive tool call does not run immediately. The engine pauses the run and waits for a person to decide.

Agent Requests
A destructive tool call is proposed
Run Pauses
Status becomes awaiting_approval
Operator Decides
Approve or reject the pending action
Run Resumes
The tool runs, or the run is cancelled

ask vs deny

ModeBehavior
askThe run pauses and surfaces a pending approval; a person approves or rejects
denyThe destructive call is blocked outright — no pause, no approval path

The pending approval

When the run pauses, the engine surfaces a pending approval with these fields:

FieldDescription
approvalIdIdentifier used to resolve this approval
toolThe tool the agent wants to call
inputThe arguments the agent proposed
reasonWhy approval is required
requestedAtWhen the request was raised

The AI Agent node polls for the decision within its maxWaitSeconds window. An operator resolves the approval with:

POST /api/v2/runs/{id}/approvals/{approval_id}
{
"decision": "approve", // or "reject"
"reason": "optional note",
"modifiedInput": { } // optional: run the tool with adjusted arguments
}

How each outcome ends

OutcomeWhat happens
ApproveThe tool runs (with modifiedInput if supplied) and the run continues
RejectThe run is cancelled with cancelReason = approval_rejected
TimeoutIf no decision arrives within maxWaitSeconds, the run is cancelled; the step fails with errorType = APPROVAL_TIMEOUT

Error Taxonomy

When an agent step fails, it returns a structured error whose errorType tells you whether a retry could help. The retryable flag is derived from the error code, never from message text.

errorTypeRetryableTypical cause
CONFIGURATION_ERRORNoInvalid or unsupported node configuration
VALIDATION_ERRORNoRequest failed validation
NOT_FOUNDNoA referenced resource does not exist
CONFLICTNoA conflicting state prevented the operation
RUN_NOT_RESUMABLENoThe run cannot be resumed from its current state
BUDGET_EXCEEDEDNoA token or cost budget was exhausted
APPROVAL_TIMEOUTNoNo approval decision arrived in time
RUN_TIMEOUTNoThe run exceeded its time limit
UPSTREAM_LLM_ERRORYesThe model provider returned a transient error
UPSTREAM_TOOL_ERRORYesA tool or MCP call failed transiently
INTERNALNoAn unexpected internal error

See the AI Agent node for the full result and error contract as it appears on the node.