# How to add AI agents to Oracle NetSuite

> Source: https://netray.co/integrations/netsuite-ai-agents
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

An AI agent on NetSuite is a model plus a small set of tools that call SuiteQL, the REST record API or a RESTlet under a dedicated integration role. Start with read-only tools, add draft-only writes that land as pending records, and require a person to approve anything that changes the books or a purchase commitment.

## System

Oracle NetSuite

## Capability

ai-agents

## Intro

Most NetSuite teams already have saved searches, SuiteFlow workflows and a few User Event scripts doing the repetitive work. What they lack is something that reads an exception, decides what to look at next, and drafts the fix. That is the gap an agent fills: late purchase orders, unmatched vendor bills, work orders short on components, sales orders stuck in pending approval.

NetSuite is a multi-tenant cloud ERP, so the agent never lives inside it. It sits beside it, calls the documented APIs with a scoped token, and writes results back through the same APIs. That makes the design cleaner than on a customised on-prem ERP, but it also means you inherit NetSuite's governance and concurrency limits and must design for them.

The decision that matters most is what the agent may write. Teams that succeed treat the first release as an analyst that opens drafts, not an operator that posts transactions.

## Use Cases

### Late PO expediting

**Description:** The agent runs a SuiteQL query for open purchase order lines past their expected receipt date, checks the vendor's email history, and drafts a follow-up with the exact line numbers and revised dates.

### Work order shortage triage

**Description:** For released work orders, it compares component requirements against on-hand and inbound supply by location and proposes expedite, substitute or reschedule actions for the planner.

### Vendor bill exception handling

**Description:** It explains why a vendor bill failed three-way match, whether by price, quantity or a missing item receipt, and drafts the correction for the AP clerk to approve.

### Order hold review

**Description:** Sales orders on credit hold or pending fulfilment get a summary of open invoices, payment history and promised dates so the approver decides in one screen.

### Month-end accrual prep

**Description:** The agent finds received-not-billed lines, builds the accrual journal as a draft, and attaches the saved-search evidence for the controller.

## System Surface

- SuiteQL through the REST Web Services endpoint (the suiteql query service) is the best read tool: SQL-like, joins across records, and paged results.
- The REST record API exposes standard and custom records for create, update and transform, and honours the role's permissions.
- RESTlets (SuiteScript 2.x) let you wrap multi-step logic in one authenticated call, which is safer than letting a model compose several raw writes.
- Authentication is OAuth 2.0 or Token-Based Authentication against an integration record, tied to a dedicated role. Exact grant options vary by release, so check your account.
- SuiteScript User Event and Map/Reduce scripts, plus SuiteFlow, can trigger or receive agent work, and governance units and concurrency limits cap how hard you can call.

## How It Works

### Create a dedicated integration role

**Detail:** Build a custom role with view access on the records the agent reads, and create-only access on the few draft records it writes. Never reuse an administrator or a person's token.

### Register the integration record

**Detail:** Set up OAuth 2.0 or token-based credentials for that role. Store secrets in a vault on the agent host, and rotate them on a schedule.

### Define a narrow tool layer

**Detail:** Expose named tools such as open_po_lines, wo_shortages, bill_match_status and create_draft_journal. Each tool has fixed parameters and a validated output, so the model never writes free-form SuiteQL against sensitive tables.

### Add a planner loop with limits

**Detail:** Let the model call tools in sequence with a step cap, a token cap and a per-run record cap. Log every call, input and result.

### Route writes through approval

**Detail:** Drafts are created as unapproved or pending records. A person reviews in NetSuite or in a chat surface, and approval triggers the final transaction.

### Evaluate on historical exceptions

**Detail:** Replay last quarter's exceptions, compare the agent's proposed action with what the planner actually did, and only then widen the scope.

## Example Flows

### Expedite a late purchase order

**Trigger:** A scheduled run finds PO lines more than three days past expected receipt on a critical item.

**Steps:**

- Query open lines with item, vendor, quantity and need-by date.
- Check on-hand and demand to see whether the delay stops production.
- Draft a vendor email with line numbers and a requested date.
- Post the draft and a summary to the buyer for review.

**Result:** The buyer sends or edits one email instead of building the list by hand.

### Resolve a failed three-way match

**Trigger:** A vendor bill enters the approval queue with a variance.

**Steps:**

- Pull the bill, PO and item receipt by transaction ID.
- Compare quantity and unit price per line.
- Classify the cause as price, quantity, unreceived or duplicate.
- Draft a vendor credit request or a receipt correction request.

**Result:** AP sees the cause and the proposed fix next to the bill, with nothing posted yet.

## On Prem

NetSuite itself stays in Oracle's cloud, but the reasoning layer does not have to. Run the agent and an open-weight model on your own GPUs or in a private cloud, and let it call the NetSuite APIs outbound over TLS. Only the rows a tool returns are sent to the model, so you can mask supplier banking details, pay rates or customer pricing before they ever reach it. Keep prompts, tool traces and embeddings on your side, and allow-list the agent's egress to your NetSuite account domain only. If a plant network is isolated, place a thin relay in a DMZ rather than opening the plant to the internet.

## Security

- Use a dedicated role and integration record, never a shared administrator login.
- Grant write access only to draft or pending record types, and enforce approval before posting.
- Log each tool call with user, role, parameters and row count for audit.
- Mask sensitive fields in the tool layer, not in the prompt.
- Respect subsidiary and location restrictions so a role cannot read across entities it should not see.

## Options

### Use NetSuite's own AI features and SuiteFlow

**Fit:** Enough when the need is text drafting or simple rule-based routing inside one record.

**Effort:** Days to configure, but limited to what Oracle ships.

### Build in-house with SuiteQL, RESTlets and an agent framework

**Fit:** Good when you have SuiteScript skills and a clear short list of exceptions.

**Effort:** Typically two to three months for a first read-and-draft agent.

### Work with a partner such as Netray

**Fit:** Useful when you need a private model, an evaluation harness and approval flows without staffing it.

**Effort:** A scoped pilot over one workflow, then expand.

## Pitfalls

- Letting the model write raw SuiteQL against the whole schema invites slow queries and data leaks. Use fixed tools.
- Ignoring concurrency limits, so a burst of agent calls starves your other integrations.
- Writing posted transactions directly. Drafts and approvals save you from a bad accrual.
- Using one token for all agents, which makes audit and revocation impossible.
- Skipping evaluation, then discovering the agent misreads your custom fields.

## Faq

### Can an AI agent post transactions in NetSuite on its own?

**Answer:** Technically yes through the REST record API or a RESTlet, but it is a poor first release. Have the agent create drafts or pending records and let a person approve. Once you have months of evaluation data on one narrow workflow, you can consider auto-posting low-risk items with limits.

### Which NetSuite API should the agent use?

**Answer:** Use SuiteQL for reads because it joins across records in one call. Use the REST record API for simple creates, and wrap multi-step writes in a RESTlet so validation lives in one reviewed script rather than in model-composed calls.

### Does the agent respect NetSuite roles?

**Answer:** It does if every call runs under a dedicated integration role with the minimum permissions. The role, not the model, decides what is visible. Avoid administrator tokens, and test by trying to read records the role should not see.

### Can this run without sending data to a public AI service?

**Answer:** Yes. Host an open-weight model on your own infrastructure and have the agent call NetSuite outbound. Only the rows returned by tools reach the model, and you can mask fields before that. NetSuite remains in Oracle's cloud, which is separate from where the model runs.

### How is this different from SuiteFlow workflows?

**Answer:** SuiteFlow follows fixed rules you define in advance. An agent reads unstructured context such as emails and notes, chooses which records to inspect and drafts an action. Keep SuiteFlow for deterministic steps and use the agent for judgment-heavy exceptions.

## Search terms

netsuite ai agents, ai agents for netsuite, add ai agent to netsuite, netsuite agentic ai, netsuite suiteql ai, netsuite restlet ai agent, netsuite automation with ai, netsuite purchase order ai agent, private ai agent netsuite, netsuite llm agent

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
