CtrlK
BlogDocsLog inGet started
Tessl Logo

jbaruch/langchain4j-ai-agent

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

90

2.90x
Quality

90%

Does it follow best practices?

Impact

90%

2.90x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Safe Content Assistant with Execution Reporting

Problem/Feature Description

A children's educational platform needs an AI assistant that enforces strict content policies: user inputs must be checked before reaching the model (blocking manipulative prompt patterns), and model outputs must be checked before being returned to the child (flagging or rewriting inappropriate language). The compliance team also requires that every agent invocation produces a structured execution report showing timing, token usage, and tool calls — so they can audit the system and demonstrate policy adherence.

The development team wants a plain Java (non-Quarkus) implementation. They need two separate guardrail classes (one for input, one for output) with appropriate handling paths: Input violations should immediately prevent the message from reaching the model; Output violations should give the model a chance to self-correct before being treated as a failure. The compliance team needs a structured execution report for each agent invocation showing timing, token usage, and tool calls, viewable in a browser.

Output Specification

Produce a Maven Java project with:

  • pom.xml — with all required dependencies
  • src/main/java/education/guardrails/InputSafetyGuard.java — input guardrail implementation
  • src/main/java/education/guardrails/OutputSafetyGuard.java — output guardrail implementation
  • src/main/java/education/TutoringAgent.java — the AI service interface with guardrails applied
  • src/main/java/education/TutoringDemo.java — demo that:
    1. Sends at least one message that passes all checks
    2. Sends at least one message designed to trigger the input guardrail
    3. After invocation, generates and saves an HTML monitoring report to agent-report.html
  • guardrail-design.md — documents which result methods were used for each guardrail and why

evals

tile.json