Scrivio Interview library

AI agents and MCP in Java

19 questions in 5 subtopics.

Agents and tool loops

ConceptFoundations5 min read
What is a tool-calling loop in an LLM agent? Describe the steps between the user's message and the final answer when the model decides to call a Java method such as getOrderStatus(orderId).
CodingFoundations6 min read
Using Spring AI, expose a method that looks up an order's status as a tool and let a ChatClient call it. What do you put in the tool description, and how do you avoid letting the model read other customers' orders?
DebuggingIntermediate6 min read
An agent in production sometimes makes 40 tool calls for one request, costs spike, and some answers mention refunds that were never issued. How do you investigate and fix it?
DesignAdvanced5 min read
Design the architecture for an agent that helps support staff resolve billing issues by reading account data, explaining invoices and proposing credits, across five backend services.
LeadershipPrincipal5 min read
Leadership wants 'agents everywhere' within a year. As the senior technical leader, how do you decide where agents are worth it and where simple automation or a plain LLM call is better?

Model Context Protocol servers and clients

ConceptFoundations5 min read
What is the Model Context Protocol (MCP)? Explain servers, clients, tools, resources and prompts, and the transports a Java MCP server can use.
CodingIntermediate6 min read
Build an MCP server in a Spring Boot application that exposes a searchTickets tool over HTTP for internal AI assistants. Outline the dependencies, the tool definition and how you secure it.
ScenarioIntermediate6 min read
A developer connects a third-party MCP server to an internal assistant that also has a tool which sends emails. A crafted document read through the third-party server makes the assistant email internal data outside. Explain the attack and the defences.
DesignAdvanced6 min read
Your company wants to expose 30 internal systems to AI assistants through MCP. Design the platform: hosting, discovery, identity, and change management for tool schemas.
LeadershipPrincipal5 min read
MCP appeared recently and adoption moved fast. How do you decide how much to standardise on it for the next five years, given that protocols in this area may change?

Multi-agent systems

ConceptFoundations5 min read
What are common patterns for combining several LLM agents (sequential pipeline, router, orchestrator with workers, evaluator loop), and how would you implement a router in Java?
DesignIntermediate6 min read
A team proposes a multi-agent system with a planner agent, a research agent, a coding agent and a reviewer agent for internal report generation. When is this better than one agent with several tools, and what problems should you expect?
ScenarioAdvanced6 min read
In a multi-agent pipeline, the reviewer agent approves almost everything the writer agent produces, and errors reach users. How do you make review effective?

Chatbots in Java

CodingFoundations6 min read
Build a customer-facing chatbot endpoint in Spring Boot with Spring AI that remembers the last messages of a conversation. How do you store memory and keep the prompt within token limits?
DesignIntermediate6 min read
Design a Java chatbot that answers questions about your product documentation with citations, using retrieval-augmented generation. Describe ingestion, retrieval, prompting and evaluation.
LeadershipAdvanced5 min read
Your company's public chatbot gave a customer wrong refund information, and the customer took legal action. What changes would you make to the chatbot programme?

Guardrails and human approval

ConceptFoundations7 min read
What are input and output guardrails for an LLM application, and give three concrete checks you would implement in a Java service before showing a model's answer to a user.
DesignIntermediate6 min read
An agent can issue refunds up to 500 dollars. Design the human approval flow so the agent proposes refunds, a person approves, and nothing is paid twice or without approval.
LeadershipPrincipal5 min read
How would you set company-wide policy on which actions AI agents may take autonomously, which need human approval and which are forbidden?