ERP AI Agent
Talk to your ERP system in plain English — the agent figures out the API calls.
"Show me all unpaid invoices" → agent calls
GET /invoices?status=unpaid→ returns a formatted table.
"Create a new customer called Acme Corp" → agent callsPOST /thirdpartieswith the right payload → confirms success.
What this is
A natural language interface for Dolibarr, an open-source ERP used by thousands of small businesses. Instead of navigating menus or writing API requests manually, you just describe what you want and the agent handles the REST API call, formats the response, and presents it in a readable way.
Built on OpenAI function calling — the model decides which API endpoint to hit, constructs the parameters, executes the call, and synthesizes the response. No rigid intent classification, no handcrafted routing logic.
Why this is technically interesting
- LLM as a router, not a chatbot. The model is given a function schema describing the Dolibarr API surface. When you ask a question, it doesn't generate a text answer — it generates a structured function call. The actual HTTP request is executed server-side, and the raw API response is fed back to the model for formatting.
- Single function, full ERP coverage. Rather than defining 30+ individual functions for each endpoint, a single
dolibarr_api(method, endpoint, payload)abstraction covers the entire API. The model learns the endpoint structure from the system prompt. - Agentic loop. For multi-step tasks ("find customer ID 5 and list their invoices"), the model can chain calls: first
GET /thirdparties/5, thenGET /invoices?thirdparty=5.
Architecture
User message
│
▼
OpenAI Chat API (gpt-3.5-turbo)
+ function schema: dolibarr_api(method, endpoint, payload)
│
├── [if function_call in response]
│ │
│ ▼
│ Execute HTTP request → Dolibarr REST API
│ │
│ ▼
│ Feed result back to model
│ │
│ ▼
│ Model formats & returns natural language response
│
└── [if no function_call] → return response directly
Gradio ChatInterface wraps the whole loop
Tech Stack
- OpenAI API — function calling (tool use)
- Dolibarr ERP — target system (self-hosted, open source)
- Gradio — chat UI, zero frontend code needed
- Python (
requests,python-dotenv,anthropic,openai)
Quick Start
git clone https://github.com/richiekesh/ERP-AI-agent
cd ERP-AI-agent
pip install -r requirements.txt # or: pip install gradio openai requests python-dotenv
Create a .env file:
OPENAI_API_KEY=your_key_here
Run:
python doli4.py
Open http://localhost:7862 and start asking questions.
Example queries
"Show me all customers"
"List unpaid invoices"
"What products do we have in stock?"
"Create a new customer named Test Corp"
"Get details for customer ID 3"
"Show me all proposals from this month"
Built to explore how LLM function calling can replace traditional NLP intent classification for API-driven tasks.