AI Agent for webERP - POC #512
Replies: 9 comments 8 replies
-
|
Hi Ian, this looks fascinating stuff. Any chance this could be brought behind a webERP login for security puposes? Tim |
Beta Was this translation helpful? Give feedback.
-
|
Hi Tim. I was just thinking about it. Will try. Give me a week. Ian |
Beta Was this translation helpful? Give feedback.
-
|
Very cool! in your understanding @iangrech would it be feasible to use self-hosted free software (e.g. Google Gemini?) instead of OpenAI? Would would that entail? My knowledge of providing an AI backend is practially noob (and AI agents not much better). Does it mean starting from the very beginning training the model on PHP software, financial systems and language in general, and then ingest the webERP schema and source? Again, very cool you are looking into this. Continuing from @timschofield,
I would go further to say I think most webERP users (i.e. companies) would insist on total control over their data. Salesforce AI (based on marketing, not practical experience) offers suggestions and recommendations relating to supply chain and company metics in general based on aggregated data from many many companiesm but I don't think that's webERP. I think webERP users in general would insist on their data staying inhouse. Fwiw, personally, I think there is more benefit long-term to the webERP project by supporting a fully-free AI stack (if that is even possible) than by interfacing to a commercial stack, but supporting a free AI stack in addition to a commercial stack could require more effort than we have. |
Beta Was this translation helpful? Give feedback.
-
|
From the perspective of the webERP development project and if the AI agent also worked with the data, in order to test the AI agent would it be necessary to first create a large non-proprietary dataset? The webERP API could perhaps be used to script a going concern business e.g. create sales orders, shipping orders and enter customer payments, create purchase orders, goods receipt notices and enter supplier payments, create and close manufacturing orders, etc. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @iangrech : I find this extremely interesting. Thanks for sharing it. As I see it, the ultimate goal should be to be shipped inside webERP distribution. I have no clue if it's feasible. If it “only” generates SQL queries, I don't see any risk of data leakage, as the user should go to their own DB via phpMyAdmin or similar and run the query. But, if it can create the SQL query, and it is protected behind webERP security, I don't see any potential risk (or problem) for the module to go and execute the SQL and offer the results to the user. Just one caution here: we should probably check with user role, if he is allowed to see certain data, but it seems reasonably easy to adapt. In my case (and I guess I'm not alone here) users of a certain level always ask for data presented in a slightly different way, and the to do list of new report is a never-ending story. But if we can give this tool to final users, that would be great. R |
Beta Was this translation helpful? Give feedback.
-
|
I did some research into how we could support user questions like "Analyze these transactions for unusual spending patterns and summarize the top 3 cost drivers" into webERP with all data remaining local and using open source software (no community, freemium, non-commercial use only or commercial software). Automated periodic reports could also be easily generated and it all seems very reasonable and doable, but then I don't know what I don't know..... ;-) Thoughts? AI IntegrationTo implement a fully open-source, private, and locally-hosted AI analysis system for webERP, you can combine the existing webERP API with a Python-based "AI sidecar" running Ollama. This approach respects the permissive licensing requirements (BSD/MIT) and ensures that sensitive financial data never leaves your local network. 1. The Open Source Stack
[1] Meta Llama 3 Commnity License (paraphrased) - Commercial Use permitted for most users. More than 700 million monthly active users requires a special license. Improving or training other (competing) LLMs is not permitted. Must include “Built with Meta Llama 3” in application or product. Trained models must include "Llama 3" in the name (e.g. “webERP Llama 3 LLM”). Must comply with Acceptable Use Policy. Derivative works must be shared under same license. 2. Prepare the webERP APIwebERP uses a "KISS" (Keep It Simple, Stupid) XML-RPC API. The built-in API that allows external programs to extract and post data without touching the database directly. • Locate the API: The server-side script is located at webERP/api/api_xml-rpc.php.
3. Setup Local AI (Ollama)Install Ollama on your server and pull the Llama 3 model: The AI is now reachable via a local REST API at http://localhost:11434. 4. Build an AI Anaysis Middleware (The "Brain") (Python)Since webERP is PHP-based and most AI libraries (like LangChain, OpenAI SDKs, or Scikit-Learn) are Python-based, you should create a small Python middleware to bridge the two.
This script acts as the bridge. It pulls data from webERP, sends it to Llama 3 for analysis, and outputs a financial summary. 5. Display Results in webERPYou have two primary ways to display these insights back to the user in webERP: Option A: The "Report Link" (Easiest)Create a new script in webERP (e.g., AI_Financial_Analysis.php) that simply provides an iframe or a link to a dashboard hosted by your Python middleware (using Streamlit or Flask). This avoids complex UI changes within webERP itself. E.g. create a simple PHP "wrapper" page inside webERP that calls your Python script and displays the result.
Option B: Inject AI Insights into webERP ScreensIf you want the AI analysis to appear directly on existing pages (like CustomerInquiry.php):
6. Why this works well
7. Example Workflow for "AI Monthly Summary"
|
Beta Was this translation helpful? Give feedback.
-
|
OK, an idea that would use this AI agent. I have been messing around trying to create an improved report generator for a while. The only hard part is creating the SQL query in an easily used and simple way. This would seem to be something that this AI agent can easily do from a users description. Then it passes it to the report generator which runs the query, creates an HTML table, and can then export it directly to the screen, or as a PDF using DomPDF or as a spreadsheet using PHPSpreadsheet. What do we think? Tim |
Beta Was this translation helpful? Give feedback.
-
|
Imho the first step is to spend time with the POC @iangrech created asking "typical" questions to
As the queries will be arbitrary, I suspect the report generator will only be able to do basic prettifying of the query response (because query responses could vary greatly). Not considering server requirements, I think running a "private" LLM will provide much greater user value than a third-party AI service that only generates report SQL queries because
However, the third-party approach will be simpler and faster (@iangrech has already done the heavy lifting), not leak data and be a good place to start. Sample QuestionsFrom https://github.com/iangrech/weberp_ai_agent
|
Beta Was this translation helpful? Give feedback.
-
|
What is the user interface? If I was a new junior bookkeeper hired to create a bunch of reports that people had wanted since forever, how do you envision me doing that?
If the AI is hidden from the user behind a webERP script, and assuming you were the one writing the code, which AI service would you want to support first?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have created an AI Agent for webERP as a proof of concept. You can find it here.
The application is developed in Python and uses a Flask server. Note that the application interfaces directly with the webERP database
and does not include a login page.Edit: Login page added.
Beta Was this translation helpful? Give feedback.
All reactions