StudyVisuallyStart studying
AI agents

AI engineer interview questions for JavaScript developers, and how to practise them

By the StudyVisually teamPublished

Interviews for AI engineer roles keep coming back to the same five areas: what an agent is, how tool calling works, RAG, how you test an agent, and how you keep it safe. Below are twelve questions that cover them, with what a strong answer includes and the weak answer that loses the point. Knowing the answer isn't enough, though. You have to say it clearly in about a minute, so practise out loud with a timer, not by rereading.

The agent questions

1. What is an AI agent?

A strong answer: a language model running in a loop with tools. It picks a tool, reads the result, and decides again until it can answer or hits a step limit. Mention the step limit: it shows you have thought about failure.

The weak answer: "an AI that can do tasks on its own". True, but it says nothing about how. (lesson)

2. Agent or workflow?

A strong answer: a workflow runs steps you fixed in advance; an agent lets the model choose the next step. Workflows are cheaper, faster and easier to test, so use one whenever the steps can be drawn as a fixed flowchart. Use an agent when the next step depends on what the last one found. Interviewers like hearing that you would pick the simpler option. (lesson)

3. How does tool calling work?

A strong answer: walk the round trip. You describe tools with a name, description and JSON schema. The model replies with tool_calls instead of text. You parse the arguments (they arrive as a JSON string), validate them, run the function, and send the result back as a tool message with the matching tool_call_id. A second model call writes the answer. (full walkthrough)

4. Single agent or multi-agent?

A strong answer: start with one agent and good tools. Split into specialists only when one prompt has too many tools and accuracy drops, because every extra agent adds cost, latency and places for things to go wrong. (lesson)

The RAG questions

5. What is RAG and why use it?

A strong answer: search your own documents first, put the best matches in the prompt, and tell the model to answer only from them. It gives the model knowledge it never trained on and cuts down made-up answers. Name both halves: indexing (chunk, embed, store) and querying (embed the question, fetch the nearest chunks, answer). (step by step)

6. RAG or fine-tuning?

A strong answer: RAG adds knowledge and is easy to update by re-indexing a document. Fine-tuning changes behaviour or style and needs training data and retraining. For company knowledge, pick RAG almost every time. (lesson)

7. Your RAG gives wrong answers. How do you debug it?

A strong answer: look at the trace first. Were the right chunks retrieved? If not, fix retrieval: chunking, hybrid search, re-ranking, metadata filters. If they were, fix the prompt or the model. Then add the failing question to the eval set so it stays fixed.

The weak answer: "use a bigger model". It skips the most common cause, which is retrieval.

The production questions

8. How do you evaluate an agent?

A strong answer: a fixed set of 20 to 50 real cases with the expected tools and key facts, run on every prompt or model change. Exact checks where you can; a second model as judge for open-ended answers. Add new failures from production as you find them. Many candidates can't answer this one, which is why it is worth preparing. (lesson)

9. How do you stop an agent doing something harmful?

A strong answer: the safety lives in code, not in the prompt. A step limit, schema validation on every tool argument, tools with the least access they need, and human approval before anything that writes, deletes, pays or emails. (lesson)

10. What is prompt injection?

A strong answer: text the model reads, from a web page, an email or a document, that tries to give it new instructions. You can't fully filter it out, so limit the damage: treat tool inputs as untrusted, keep permissions small, and require approval for sensitive actions. (lesson)

11. How do you handle hallucinations?

A strong answer: ground the model in retrieved text with "answer only from the context, otherwise say you don't know", lower the temperature for factual tasks, ask it to cite where an answer came from, and measure the rate with evals instead of guessing. (lesson)

12. How do you handle memory?

A strong answer: the model itself remembers nothing between calls. Short-term memory is the message history, trimmed or summarised near the context limit. Long-term facts live in a database and are retrieved when relevant. For long tasks, a checkpointer (such as LangGraph's) saves the working state after every step. (lesson)

How should I practise these?

Say each answer out loud, against a 60-second timer, before you look at the key points. Then compare and try again on another day.

This works because recalling an answer strengthens memory far more than reading it again. In a well-known experiment, students who read a passage once and then tested themselves three times recalled 61% of it a week later. Students who read it four times recalled 40% (Roediger and Karpicke, 2006). The rereaders also felt more confident they would remember it. That confidence is the trap: rereading your notes the night before feels like preparation, but it doesn't build the recall an interview needs. Active recall beats rereading covers the research.

The Interview mode in the StudyVisually app is built for this. It shows one question, runs a 60-second timer, hides the key points until you have answered, and keeps a history of how each attempt went. Signed-in learners can also type an answer (or speak it, on Premium) and get AI feedback on what they covered and what they missed. The guide has 20 questions in total, linked to the lessons behind each one.

Read it? Now test yourself on it.

Sources

Try it with today's mission.

Open the app and spend 20 minutes on a free subject or your own notes. Start without signing up, no card needed.

Start studying

See you tomorrow?