All B-Agent apps Home
Case study · B-Agent

B-Agent HR

An HR portal with a chatbot that can actually do things.

Built it end to end: the React portal, the chatbot and the Azure Functions backend.

21actions in the shared API
13chatbot tools
3roles: employee, manager, owner
2languages, Turkish and English
The problem

Small companies run HR on spreadsheets and email: leave requests, advances, expenses and the org chart all live in different places. HR chatbots usually only answer questions, so people still had to find the right screen to actually get anything done.

The approach

One HR portal and one chatbot on top of the same action API. The model chooses an HR action, the app runs it as the signed-in user, and the server decides per action what that user may touch.

How it works

From request to answer, step by step.

  1. 01Microsoft sign-inEntra ID through MSAL, in Turkish or English
  2. 02Portal or chatClick a screen, or ask the chatbot in plain language
  3. 03Tool choiceThe model picks one of 13 HR tools
  4. 04One action APISame endpoint for portal and chatbot, 21 actions
  5. 05Scope checkSelf, manager or owner rules decided per action
  6. 06Cosmos DB recordsEmployees, leave, events, transactions, org chart, trainings
  7. 07Import or syncExcel import, or sync from an external HR system

What it does

  • Manage employee records, the org chart, leave, events and payroll transactions.
  • Request leave, advances, expenses, overtime or visa letters, with manager approval.
  • Ask the HR chatbot to check leave or update records, in Turkish or English.
  • Works on its own with Excel import, or syncs with an HR system.

Under the hood

  • The portal and the chatbot share one action API of 21 HR actions; the chatbot reaches them through 13 tools, as the signed-in user.
  • Roles are enforced on the server: employees reach only their own data, managers act on their team.
  • A mock mode runs the whole app on local sample data, with no cloud services.
Hard problems

What took real engineering.

Problem 1

The chatbot gets no extra powers

The chatbot has no backend of its own. Every tool call it makes goes to the same action API as the portal, as the same user, so the AI can never do more than that person could do by clicking. Anything the portal can do is available to the chatbot through the same actions.

Problem 2

Permissions decided per action, on the server

Each action declares a scope: any signed-in user, self only, self or a target chosen by an admin, or admin only. For an employee, any target the model passes is ignored and the action runs on their own record, so no wording of a prompt can reach someone else's data. Managers and owners must name the target explicitly, and it is resolved through the user directory.

Problem 3

Swap the backend, keep the contract

The first version called an external HR system for every action. I moved the data into its own Cosmos DB store while keeping the request and response format identical, so neither the portal nor the chatbot had to change. The external system became an optional import with its API token stored encrypted, alongside Excel import and a mock mode that runs the whole app offline.

Built with
React 19TypeScriptViteAzure FunctionsMSALAzure OpenAIAzure Speech