# How to add AI agents to Baan IV and Baan V

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

## Short answer

Run the agent outside Baan, give it a small set of tools that read from a replicated or read-only copy of the Baan database, and route every write through AFS or a Baan session with a human approving first. Baan's age is not the obstacle; the lack of a modern REST API is, and a thin tool layer fixes that.

## System

Baan IV / Baan V

## Capability

ai-agents

## Intro

Plenty of manufacturers still run Baan IV or Baan V, often on Unix hosts with a database that nobody wants to touch. The people who understand the customizations are retiring, the vendor moved on to Infor LN, and yet purchasing, planning and shop floor work still happens in Baan sessions every day. AI agents are attractive here because they do the repetitive reading and cross-checking that planners do by hand.

An agent is different from a chatbot: it plans a few steps, calls tools, looks at the results and then proposes an action. On Baan that means the hard part is not the model. It is deciding which tables the agent may read, how it learns what a planned order or a purchase schedule means in your customized setup, and how a proposed change gets back into the system without bypassing Baan's own business logic.

This guide describes a pattern that works on systems that predate REST and webhooks: read through the database or an extract, write only through Baan's supported entry points, and keep the model on your own hardware if the data is sensitive.

## Use Cases

### Late purchase order chasing

**Description:** The agent finds open purchase order lines past promised date (purchase order tables in the tdpur family, names vary by version), checks supplier history, and drafts an expedite email for the buyer to approve.

### Planned order exception triage

**Description:** After the MRP run, the agent reads planned orders and action messages, groups them by cause such as missing lead time or shortage, and gives the planner a ranked list with reasons instead of a thousand lines.

### Production order shortage review

**Description:** Before the morning meeting, the agent checks released production orders against component inventory and open supply, and lists the orders that will stall and which part blocks them.

### Item master clean-up proposals

**Description:** Reads the item data (the tiitm family) for duplicate descriptions, missing planner codes and inconsistent units, and proposes fixes in a review sheet rather than editing live data.

### Customer order promise checks

**Description:** Given a sales order line, the agent checks stock, supply and routing capacity and drafts a realistic delivery date for the order desk to confirm.

## System Surface

Database: Baan data lives in a relational database (Oracle, Informix, DB2, SQL Server or the older Bisam files depending on install) with tables named by package, module and number, for example tiitm001 or tdsls040. Table and field names differ by version and porting set, so map yours first.

ODBC: the Baan ODBC driver exposes tables to external tools, with the caveat that it respects some Baan logic and can be slow on large scans.

AFS (Application Function Server): a supported way to drive a Baan session programmatically for writes, so Baan business rules and DAL hooks still fire. Availability depends on your Baan tools level.

BOI and DAL: Business Object Interface and Data Access Layer exist on later tools and Baan V era installs; on Baan IV you will mostly rely on sessions, AFS and exchange schemes.

Flat file exports: Baan sessions and exchange schemes can write ASCII files on a schedule, which is the lowest risk integration path.

## How It Works

### Pick a read path

**Detail:** Nightly or hourly replicate the tables you need into a reporting database, or use read-only ODBC against the live database off-hours. Do not give the agent a read-write database login.

### Write a data dictionary for the agent

**Detail:** Translate your table and field names into plain business descriptions, including your customized fields. The agent is only as good as this map.

### Build tools, not free SQL

**Detail:** Expose functions such as get_open_po_lines(supplier, days_late) with parameterized queries. Avoid letting the model write arbitrary SQL against production.

### Add a write queue

**Detail:** Proposed changes land in a queue table. A buyer or planner approves, and only then does a small service call AFS or a session to apply it.

### Choose and host the model

**Detail:** An open-weight model on a local GPU server is usually enough for this kind of tool use, and keeps item costs and supplier terms inside your network.

### Log everything

**Detail:** Store each question, tool call, result and approval so you can review why the agent said what it said.

## Example Flows

### Expedite email for late purchase lines

**Trigger:** Daily 6 a.m. job over open purchase order lines.

**Steps:**

- Agent calls get_open_po_lines for lines more than three days late.
- For each supplier it pulls the last six months of receipts to see typical lateness.
- It drafts an email with line numbers, quantities and the production orders waiting.
- Buyer reviews the batch and sends or edits.

**Result:** Buyers start the day with a prepared follow-up list instead of building it from a session query.

### MRP exception summary

**Trigger:** MRP run finishes overnight.

**Steps:**

- Agent reads planned orders and messages created in the run.
- Groups them: reschedule in, reschedule out, cancel, new demand.
- Flags items where lead time looks wrong compared to actual receipts.

**Result:** Planner gets a one-page summary with the few lines that need a decision.

## On Prem

Baan is usually installed on your own servers, so keeping the agent on-prem is natural. Put the model server next to the reporting database, give it no internet route, and run the tool layer as a small service with its own read-only credentials. If your Baan host is an old Unix machine you cannot patch, keep it unchanged and pull data from it over ODBC or flat files, then do all agent work on a newer separate server. Open-weight models served with vLLM or Ollama on a single workstation-class GPU are enough for tool calling over structured data.

## Security

- Read-only database account scoped to the tables the tools need.
- No free-form SQL from the model; only parameterized tools.
- All writes go through an approval queue and AFS or a Baan session, never direct table updates.
- Mask supplier prices and customer data for users whose Baan role could not see them.
- Keep a full audit trail of prompts, tool calls and approvals.

## Options

### Build in-house on a replicated database

**Fit:** You have a developer who knows your Baan schema and a reporting database already.

**Effort:** Several weeks for a first read-only agent, longer for write-back.

### Wait for a vendor connector

**Fit:** Rarely realistic for Baan IV or V; few vendors maintain Baan connectors.

**Effort:** Low effort but low probability of existing.

### Work with a partner such as Netray

**Fit:** You want a private on-prem agent and need help mapping a customized schema.

**Effort:** A scoped pilot, usually one or two workflows first.

## Pitfalls

- Heavy agent queries on the live database slow down order entry; use a replica.
- Customized fields and company numbers (the _comp suffix pattern) are missed if the dictionary is built from standard documentation only.
- Writing straight into tables skips DAL and session logic and corrupts data; use AFS.
- Letting the agent act without review on purchase orders creates real financial commitments.

## Faq

### Can AI agents work with Baan IV without upgrading?

**Answer:** Yes. The agent sits outside Baan and reads data through ODBC, a replica or scheduled exports. Writes can go through AFS or a controlled session. No upgrade is required, though the answers depend on how clean your data and customizations are.

### Does Baan have a REST API for agents?

**Answer:** Not natively on Baan IV or V. Later Infor LN versions add web service layers. For Baan you build a small service that wraps database reads and AFS or session writes, and agents call that service.

### Is it safe to let an agent change Baan data?

**Answer:** Only with approval. The usual pattern is that the agent proposes a change, a person approves, and a separate service applies it through supported entry points so Baan business rules still run.

### Which model should we use?

**Answer:** For tool calling over structured data, a mid-sized open-weight model on local hardware is often adequate. Hosted models are also an option if your policy allows sending data out. Test on your own questions before deciding.

### Should we migrate to Infor LN first?

**Answer:** Not necessarily. If a migration is already planned, build the agent against a data layer that can be repointed. If not, agents can extend the useful life of Baan while you decide.

## Search terms

baan ai agents, ai agents for baan erp, baan iv ai, baan v ai integration, add ai to baan, baan erp automation, baan agentic ai, on-prem ai baan

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