Case study · 06 / 07

What it had to do
Most questions HR gets are routine: how many leave days are left, what happens to unused sick leave, who the supervisor is. HR Agent Pro answers them itself. A LangChain ReAct agent reads the question and picks a tool — semantic search over the HR policy in Pinecone, a lookup in the employee records, or a calculator — then answers in the employee’s own language.
From input to result
How it works
- 01
Ask
in any language; it is translated both ways
- 02
Reason
the agent decides which tool it needs
- 03
Look up
the policy, the records, or the maths
- 04
Answer
in the asker’s language, with a sentiment badge
- ReAct agent with three tools
- Multilingual questions and answers
- Sentiment on every message, from a local DistilBERT model
- Prompt-injection guard, rate limits and input clean-up
- Every query in an audit log
- HR analytics tab
- /health and /metrics for Prometheus
Decisions
The calls that mattered
01
Tools, not a script
The agent decides per question whether it needs the policy, the records or the calculator, so one chat covers all three without hard-coded flows.
02
Answers from the documents
Policy answers come from semantic search over the actual HR policy, and balances from the records — not from the model’s memory.
03
Safe in front of staff
Prompt-injection attempts are blocked, each user gets 20 requests a minute, inputs are cleaned, and every query is written to an audit log.
04
A fallback when the model is down
Claude 3 Haiku answers first. If it is unavailable, a local Mistral on Ollama takes over; if both fail, the error says how to fix it.
Built with
- Python 3.11
- LangChain
- Claude 3 Haiku
- Ollama (Mistral)
- Pinecone
- Streamlit
- FastAPI
- DistilBERT
- Docker
- GitHub Actions
- Prometheus