Ai Workplace
- Author: azfar3
- Repository: https://github.com/azfar3/ai_workplace
- GitHub stars: 0
- Forks: 0
- License: NOASSERTION
- Category: HR & Payroll
- Maintenance: Actively Maintained
Install Ai Workplace
bench get-app https://github.com/azfar3/ai_workplace
Add the Frappe Gems badge to your README
Maintain Ai Workplace? Paste this into your README:
[](https://frappegems.com/gems/apps/azfar3/ai_workplace)
About Ai Workplace
AI Workplace
> Enterprise AI Workplace for ERPNext — Secure, Deterministic, Knowledge-Aware, and Extensible
AI Workplace is an enterprise-grade AI application built on the Frappe Framework and designed to provide employees and organizations with a secure natural-language interface to HR and workplace services powered by ERPNext/Frappe HR.
The system combines deterministic business logic, controlled AI tools, enterprise knowledge retrieval, role-based authorization, and optional LLM capabilities to provide intelligent workplace assistance without giving the AI unrestricted access to the ERP system.
Overview
AI Workplace is designed around a simple principle:
> The ERP system remains the source of truth. AI is an interface and reasoning layer — not the system of record.
Employees should be able to ask questions and perform supported workplace tasks using natural language without needing to navigate through multiple ERPNext screens.
Examples:
"What is my remaining annual leave?"
"When is my next approved leave?"
"Show my attendance summary for August."
"How many casual leaves do I have remaining?"
"How do I apply for maternity leave?"
"What documents are required for employee onboarding?"
"Show me the HR policy for remote work."
"Submit a leave application for next Monday."
Depending on the request, AI Workplace determines whether the query should be handled by:
- deterministic application logic
- a controlled ERP tool
- the knowledge layer
- an LLM
- or a combination of these components
The LLM is never treated as the authority for authorization or business rules.
Core Architecture Principles
AI Workplace follows several architectural principles.
1. ERPNext is the source of truth
Employee, attendance, leave, payroll, organizational, and transactional data remain inside ERPNext/Frappe.
AI Workplace does not replace ERPNext as the authoritative business system.
2. Authorization never belongs to the LLM
The model does not decide whether a user is allowed to access a record.
Authorization is enforced by the application and ERPNext permission system.
3. Business logic remains deterministic
Rules such as:
- leave balance calculation
- employee access
- approval requirements
- document permissions
- workflow transitions
- attendance calculations
- payroll-related access
are handled by deterministic application logic.
4. The LLM does not receive unrestricted ERP access
The model cannot arbitrarily query the database or execute arbitrary ERP operations.
Instead, it interacts with a controlled set of application-defined tools.
5. Use AI only when AI adds value
Not every query requires an LLM.
Simple, deterministic requests should be handled directly by application logic.
For example:
User:
"What is my leave balance?"
↓
Intent detection
↓
Leave Balance Tool
↓
ERPNext
↓
Deterministic Response
There is no reason to spend an LLM call generating an answer that the application can safely produce itself.
Key Features
Employee AI Assistant
Employees can interact with workplace services using natural language.
Supported use cases can include:
- Leave balance
- Leave applications
- Attendance information
- Employee information
- Holiday information
- HR policies
- Company procedures
- Onboarding information
- Payroll-related information
- Workplace FAQs
- HR document retrieval
- General workplace assistance
Intelligent Request Routing
AI Workplace classifies incoming requests before deciding how they should be processed.
A request may be routed to:
User Request
│
▼
Request Router
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
Deterministic Tool Knowledge
Logic Execution Search
│ │ │
└──────────────┼──────────────┘
│
▼
Optional LLM
│
▼
Final Response
This reduces unnecessary model usage while improving reliability and cost efficiency.
Deterministic vs AI Processing
AI Workplace intentionally separates deterministic operations from AI reasoning.
Deterministic operations
Examples:
- Leave balance
- Attendance summary
- Employee information
- Holiday lookup
- Document status
- Workflow status
- Permission checks
- Transaction creation
- Validation
These operations should preferably use application logic and tools rather than an LLM.
AI-assisted operations
Examples:
- Understanding ambiguous natural language
- Summarizing HR policies
- Answering questions from organizational knowledge
- Explaining complex HR procedures
- Combining information from multiple knowledge sources
- Conversational assistance
- Generating human-friendly explanations
This architecture provides a balance between:
Reliability + Security + Cost Efficiency + Intelligence
Knowledge Layer
An AI assistant is only as useful as the knowledge available to it.
AI Workplace therefore includes a dedicated knowledge architecture for organizational information.
Knowledge can include:
- HR policies
- Employee handbooks
- SOPs
- Leave policies
- Attendance policies
- Payroll policies
- Benefits information
- Onboarding documentation
- Company procedures
- Department documentation
- FAQs
- ERPNext/Frappe documentation
- Internal organizational knowledge
The knowledge pipeline is responsible for:
Documents
│
▼
Ingestion
│
▼
Parsing
│
▼
Chunking
│
▼
Metadata
│
▼
Embeddings
│
▼
Vector / Search Index
│
▼
Retrieval
│
▼
AI Response
Knowledge retrieval is separated from transactional ERP access.
This prevents organizational documentation from being mixed indiscriminately with sensitive transactional data.
Controlled Tool Architecture
AI Workplace uses application-defined tools to interact with ERPNext.
Instead of allowing the LLM to execute arbitrary database queries, the system exposes controlled operations such as:
get_employee_info
get_leave_balance
get_leave_history
get_attendance_summary
get_holiday_list
get_salary_information
create_leave_application
get_hr_policy
search_knowledge
Each tool is responsible for:
- validating input
- validating the authenticated user
- checking authorization
- executing the operation
- validating the result
- returning structured data
The LLM receives the result rather than unrestricted ERP/database access.
Security Architecture
Security is a first-class component of AI Workplace.
The system follows a defense-in-depth approach.
User
│
▼
Authentication
│
▼
Session / Identity
│
▼
Authorization
│
▼
Request Validation
│
▼
Tool Permission Guard
│
▼
ERPNext Permission Layer
│
▼
Controlled ERP Operation
│
▼
Sanitized Result
│
▼
Optional LLM
Security principles
- No unrestricted database access for the LLM
- No LLM-controlled authorization
- Role-based access control
- User-scoped ERP data access
- Tool-level permission checks
- Input validation
- Output validation
- Sensitive-field protection
- Audit logging
- Rate limiting
- Session controls
- Prompt-injection defenses
- Controlled write operations
Write Operations
Read operations and write operations are treated differently.
A read request such as:
"What is my leave balance?"
can be executed through a controlled read tool.
A write request such as:
"Apply for leave from September 10 to September 12."
requires additional validation.
Typical flow:
User Request
│
▼
Intent Detection
│
▼
Tool Selection
│
▼
Permission Check
│
▼
Input Validation
│
▼
Confirmation
│
▼
ERPNext Transaction
│
▼
Audit Log
The AI does not directly mutate ERPNext data.
HR Knowledge and Services
AI Workplace is primarily designed around workplace and HR use cases.
Potential service areas include:
Employee Services
- Employee profile
- Department
- Designation
- Joining information
- Employment information
Leave Management
- Leave balance
- Leave history
- Leave status
- Leave policy
- Leave application
- Leave cancellation
- Holiday information
Attendance
- Attendance summary
- Missing attendance
- Attendance history
- Working days
- Late/early information
Payroll
Where permissions allow:
- Salary information
- Salary slip information
- Payroll-related FAQs
- Payroll policies
HR Policies
Employees can ask questions such as:
"What is the annual leave policy?"
"How many casual leaves can I take?"
"What is the procedure for requesting remote work?"
"What documents are required for onboarding?"
Answers should be grounded in the organization's approved knowledge sources.
WhatsApp Integration
AI Workplace can be extended to provide HR services through messaging platforms such as WhatsApp.
The same controlled backend can serve multiple channels:
AI Workplace
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
Web UI WhatsApp Other APIs
│ │ │
└────────────────┼────────────────┘
▼
Request Processing
│
┌───────────┴───────────┐
▼ ▼
ERPNext Tools Knowledge
│ │
└───────────┬───────────┘
▼
AI Layer
This allows employees to access supported HR services without opening ERPNext directly.
Agent Architecture
AI Workplace is designed to support specialized agents where they provide meaningful value.
Examples include:
- HR Assistant
- Knowledge Assistant
- Leave Assistant
- Attendance Assistant
- Employee Services Assistant
- Policy Assistant
- Administrative Assistant
Agents should operate within defined capabilities and permissions rather than receiving unrestricted access to the entire system.
Observability and Auditability
Enterprise AI systems must be observable.
AI Workplace is designed to track important operational information such as:
- requests
- sessions
- tool executions
- response times
- model usage
- token consumption
- errors
- failures
- security events
- knowledge retrieval
- AI decisions
- write operations
This enables administrators to understand:
What happened?
Why did it happen?
Which tool was called?
What data was accessed?
Was AI involved?
How much did the request cost?
Did the operation succeed?
Architecture
High-level architecture:
```text ┌──────────────────────┐ │ User │ └──────────┬───────────┘ │ ┌──────────────┴──────────────┐ │ │ ▼ ▼ Web UI WhatsApp │ │ └──────────────┬──────────────┘ │ ▼ ┌──────────────────────┐ │ AI Workplace API │ └──────────┬───────────┘ │ ┌──────────▼─
Related HR & Payroll apps for Frappe & ERPNext
- Hrms — Open Source HR and Payroll Software
- Huf — Open-source, self-hosted multi-agent AI infrastructure for teams and apps with support for cloud and local models, tool integrations, workflows, and automation across business systems including Slack, ERPNext, Discord & Gmail.
- Bookings — Hotel Management App for Erpnext
- Employee Self Service — This is the backend component for Nesscale ESS - a mobile app that brings ERPNext to your phone. Employees can manage their HR tasks, sales activities, and projects right from their mobile devices.
- Inventory Tools — A collection of features to streamline and enhance inventory management and manufacturing workflows in ERPNext.
- Check Run — Payables utility for ERPNext
- Next Ai — NextAI is an AI-powered app for Frappe and ERPNext, delivering seamless content generation, automation, and productivity enhancements.
- Projectit — Open Source PWA mobile app to track the Employees out in the field. This mobile app is developed on Frappe Framework and it is integrated with the Project functionalities of ERPNext and integrated tightly with Frappe HR.