CtrlK
BlogDocsLog inGet started
Tessl Logo

jbaruch/spring-ai-agent

Build AI agents with Spring AI 2.0 - basic agent, memory, tools/MCP, agentic workflows, guardrails, and observability

86

2.43x
Quality

85%

Does it follow best practices?

Impact

90%

2.43x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

HR Assistant Agent with Employee Lookup Tools

Problem/Feature Description

Acme Corp's HR department is rolling out an internal AI assistant that employees can use to look up payroll summaries, check time-off balances, and query the company directory. Employees interact via a REST endpoint and expect the assistant to remember context within a session (e.g., if an employee asks about a colleague and then asks a follow-up, the assistant should know who they were discussing). Each request carries a session token that should be used to scope conversation memory.

The assistant must also be multi-tenant: the HR system exposes data for several subsidiary companies, and every tool invocation must be scoped to the caller's subsidiary ID — but this information should not be visible in the conversation transcript itself. The system should be robust: if a tool call fails (e.g., payroll service is temporarily unavailable), the assistant should handle it gracefully rather than throwing an exception to the user.

Output Specification

Produce a self-contained Spring Boot application (Java source files + pom.xml + application.properties) implementing the HR assistant. The application should include:

  • HrAgentApplication.java — Spring Boot main class with ChatClient and ChatMemory beans
  • EmployeeTools.java — Tool-annotated component with at least three tools: employee directory lookup, time-off balance check, and payroll summary retrieval. At least one tool parameter should be optional. At least one tool should bypass the LLM when returning its output — the raw tool result should be sent back to the caller as-is.
  • HrChatController.java — REST controller exposing a POST /chat endpoint that accepts a message, a sessionId, and a subsidiaryId, and returns the assistant's response
  • pom.xml — Maven build descriptor with all required dependencies
  • application.properties — Application configuration

The controller must pass the subsidiaryId as extra context to tools without it appearing in the system prompt or conversation history. Tools must use this context when making their (simulated) data lookups.

All tool data-access methods may return hardcoded or simulated data — no real database or external service is required.

evals

tile.json