Tool Calling & Agent Loops Questions with Answers

23 practice questions on Tool Calling & Agent Loops (AI Engineering (LLM Apps)) with answers and step-by-step solutions. Try 10 samples below, then practise all 23 free in the AptiNest app.

Sample questions

Question 1Easy

A routing step in an LLM app:

  1. Encrypts the request before sending it to the API
  2. Picks which GPU in the serving cluster will run the model for that request
  3. Classifies the input and sends it to a specialised prompt or model
  4. Splits a document into equal-sized chunks

Answer: C. Classifies the input and sends it to a specialised prompt or model

Explanation

Routing lets different kinds of request get handling tuned for them, such as a cheaper model for simple queries.

Step-by-step solution

  1. Routing classifies the input.
  2. It sends to the best prompt or model.
  3. Examples: cheap vs strong model.

Why the other options are wrong

  • A. Not encryption.
  • B. Not GPU scheduling.
  • D. That is chunking.

Question 2Easy

A coding agent has just edited a source file. Which observation is most useful to feed back to it next?

  1. The file's size in bytes after the edit
  2. The current date and time on the server
  3. The output of running the tests
  4. The number of tokens in the system prompt

Answer: C. The output of running the tests

Explanation

Test results tell the agent whether the change worked and what to fix, closing the act-observe loop.

Step-by-step solution

  1. Agents need feedback on whether the edit worked.
  2. Test output shows success or failure.
  3. The agent can then fix errors.

Why the other options are wrong

  • A. File size is not informative.
  • B. Date is irrelevant.
  • D. Token count is irrelevant.

Question 3Easy

Which tool is most appropriate for an agent to answer "What is 18% GST on ₹12,499?" reliably?

  1. An image generation tool
  2. A translation tool
  3. A calculator or code-execution tool
  4. A web search tool

Answer: C. A calculator or code-execution tool

Explanation

Exact arithmetic is better delegated to code than done in the model's head.

Step-by-step solution

  1. The question needs exact arithmetic: 18% of ₹12,499.
  2. 12,499 × 0.18 = 2,249.82, which must be exact.
  3. A calculator or code tool computes this exactly every time.
  4. So option C, the calculator or code-execution tool, is the right choice.

Why the other options are wrong

  • A. An image generation tool cannot compute a percentage.
  • B. A translation tool does not do arithmetic.
  • D. A web search might find a rate, but it does not compute the exact tax reliably.

Tip: Send exact arithmetic to code; language models can slip on digits.

Question 4Easy

In function calling, what does the application send the model so it can decide to use a tool?

  1. A compiled binary of each tool's server
  2. Each tool's name, description and parameter schema
  3. The full source code of every tool function, so it can be checked
  4. Only the tool names, nothing else

Answer: B. Each tool's name, description and parameter schema

Explanation

The model reads names, descriptions and JSON-schema parameters to choose a tool and fill its arguments.

Step-by-step solution

  1. Application sends tool names for the model to select.
  2. Descriptions help the model understand each tool's purpose.
  3. Parameter schema tells the model what inputs are needed.
  4. Model uses this info to decide which tool to call.
  5. Final answer: Each tool's name, description and parameter schema.

Why the other options are wrong

  • A. The model never sees compiled binaries; it only needs a textual description of each tool it can call.
  • C. Sending full source code is unnecessary; the model only needs the name, description and parameter schema.
  • D. Names alone are not enough; without description and parameters the model cannot know when or how to call.

Tip: Always provide full tool details for accurate function calling.

Question 5Medium

An agent writes intermediate results to a scratchpad file and reads them back in later steps. This mainly helps with:

  1. Making each individual tool call run faster on the server side
  2. Reducing the model's parameter count
  3. Avoiding the need for tool schemas
  4. Long tasks whose state would not fit in the context window

Answer: D. Long tasks whose state would not fit in the context window

Explanation

External memory lets an agent keep progress beyond what the context can hold, and survive context resets.

Step-by-step solution

  1. Scratchpad stores intermediate results between steps.
  2. This allows handling tasks that need more memory than available.
  3. Long tasks use scratchpad to save state across steps.
  4. Context window limits how much data can be held at once.
  5. Scratchpad helps when task state exceeds context window size.
  6. Final answer: Long tasks whose state would not fit in the context window.

Why the other options are wrong

  • A. A scratchpad is a file read and written by steps, so it does not speed up each server-side tool call.
  • B. The scratchpad stores intermediate results and does not change the model's parameter count.
  • C. Tool schemas are still needed; a scratchpad is for keeping task state beyond the context window.

Tip: Use scratchpad for tasks longer than context window limits.

Question 6Medium

Why is a "tool_call_id" (or similar) attached to each tool call and its result?

  1. To rank tools by how often they are used
  2. To match each result to the call that produced it
  3. To bill each tool to a different customer
  4. To encrypt the tool's output in transit

Answer: B. To match each result to the call that produced it

Explanation

With several calls in one turn, IDs pair every result with its request.

Step-by-step solution

  1. Tool call and result need to be linked for correct matching.
  2. Each tool call has a unique ID to track its result.
  3. This ensures the right result is paired with the right call.
  4. ID helps in tracing which call produced which result.
  5. So, the main purpose is to match each result to the call that produced it.

Why the other options are wrong

  • A. The ID links a result to its call; it is not used to rank how often each tool is used.
  • C. Billing is handled separately; the call ID exists to pair each result with the call that made it.
  • D. Encryption is a transport concern; the call ID only matches each result to its call.

Tip: Use IDs to connect calls with their corresponding results.

Question 7Medium

An agent has two tools, search_docs and search_documents, with nearly identical descriptions. What problem is likely?

  1. The API rejects tools whose names share a prefix
  2. Both tools are always called on every turn by default
  3. Inconsistent tool choice; merge or clearly separate them
  4. The model can no longer call any other tool in the list

Answer: C. Inconsistent tool choice; merge or clearly separate them

Explanation

Overlapping tools give the model no basis to choose, so behaviour becomes erratic; each tool should have a distinct, documented purpose.

Step-by-step solution

  1. Search_docs and search_documents are too similar, causing confusion.
  2. The model cannot decide which tool to use, leading to inconsistent choices.
  3. This results in erratic behaviour and poor performance.
  4. Tools should have distinct purposes to avoid this issue.
  5. Final answer: Inconsistent tool choice; merge or clearly separate them.

Why the other options are wrong

  • A. The API does not reject tools that share a prefix; the real issue is that the two tools are too alike.
  • B. Tools are only called when the model chooses them; nothing calls both by default on every turn.
  • D. The model can still call other tools; these two look alike, but the rest of the list is unaffected.

Tip: Ensure each tool has a unique and clear purpose to avoid confusion.

Question 8Medium

A 30-minute agent task crashes at step 40 of 60. Which design lets it resume without repeating finished work?

  1. Restart the whole task from step 1 with a larger budget
  2. Ask the model to remember its progress in its weights
  3. Raise the temperature so the next attempt takes another path
  4. Checkpoint state after each step and resume from the last one

Answer: D. Checkpoint state after each step and resume from the last one

Explanation

Persisting progress (plus idempotent tools for any step that is retried) turns a crash into a resume rather than a rerun.

Step-by-step solution

  1. Checkpoint state after each step saves current progress.
  2. Resuming from last checkpoint avoids repeating earlier steps.
  3. This ensures the task continues from where it left off.
  4. Crash is turned into a resume instead of a full restart.
  5. Final answer: Checkpoint state after each step and resume from the last one.

Why the other options are wrong

  • A. Restarting from step 1 repeats finished work and wastes time; a larger budget does not fix that.
  • B. A model cannot reliably store task progress in its weights; progress must be saved outside the model.
  • C. Higher temperature gives a different path but does not save progress, so finished steps are still repeated.

Tip: Always checkpoint state to avoid rework on crashes.

Question 9Hard

Two agents in a multi-agent system each call a tool to reserve the last seat. What classic problem can occur?

  1. A race condition, unless the tool locks or checks atomically
  2. Lost-in-the-middle in the shared prompt
  3. Tokenizer mismatch between the two agents
  4. Catastrophic forgetting of the model weights during the conversation

Answer: A. A race condition, unless the tool locks or checks atomically

Explanation

Concurrent agents share external state like any concurrent program, so tools need atomic checks or locks.

Step-by-step solution

  1. Agents call tool to reserve last seat at same time.
  2. Tool may process both calls without checking atomically.
  3. This leads to both agents getting the last seat.
  4. Race condition occurs unless tool locks or checks atomically.
  5. Final answer: A race condition, unless the tool locks or checks atomically.

Why the other options are wrong

  • B. Lost-in-the-middle is about long prompts losing details; it does not describe two agents racing for one seat.
  • C. A tokenizer mismatch is not the issue here; the problem is two agents acting on the same resource at once.
  • D. Model weights do not change during a conversation, so catastrophic forgetting does not apply to seat booking.

Tip: Use atomic checks or locks for shared resource access in concurrent systems.

Question 10Hard

In a ReAct-style transcript the model writes a "Thought", then an "Action", then the app inserts an "Observation". A run fails because the model wrote its own fake Observation. What prevents this?

  1. Increase max_tokens so the model has room to finish all of its thinking
  2. Add more few-shot examples with fake observations
  3. Stop generation at the action and let only the host insert observations
  4. Raise the temperature so the model explores more

Answer: C. Stop generation at the action and let only the host insert observations

Explanation

Using a stop sequence (or native tool-call messages) ends the model's turn at the action, so observations come only from real tool runs.

Step-by-step solution

  1. Model must stop after writing the action.
  2. Host inserts observation instead of model.
  3. This stops fake observations.
  4. Only real observations are added.
  5. Final answer: Stop generation at the action and let only the host insert observations.

Why the other options are wrong

  • A. A larger max_tokens only gives more room; it does not stop the model writing its own Observation.
  • B. More examples with fake observations teach the model to fabricate them, which makes the problem worse.
  • D. Raising temperature changes how much the model explores, not who writes the Observation, so the fake text still appears.

Tip: Use stop sequences to control where the model stops writing.

Practise all 23 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all AI Engineering (LLM Apps) topics · All topics