The Agent Loop Flashcards

(54 cards)

1
Q

What is an agent loop?

A

A programmatic cycle where the AI selects an action, the system executes it, feedback is captured, and the process repeats until termination.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why build an agent loop?

A

To convert a manual conversation into an autonomous agent that can act, observe results, and adapt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Who kicks off the agent loop?

A

A human or human-driven process supplies an initial goal or task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the agent’s role in the loop?

A

Decide the next action at each iteration based on the current prompt and feedback.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Who controls the loop execution?

A

The developer/system controls the loop; the agent chooses actions within it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the core sequence of the agent loop?

A

Prompt → Model response (action) → Parse → Execute → Capture feedback → Decide to continue/terminate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the first step of the loop?

A

Construct a clear, task-oriented prompt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why is prompt construction critical?

A

A well-structured prompt guides the agent’s decisions and improves reliability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens after sending the prompt to the model?

A

The model returns a response that includes the next desired action.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does “parse the response” mean?

A

Convert the model’s output into a structured, machine-actionable representation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why is parsing necessary?

A

Traditional software and tools require precise, structured inputs to execute actions reliably.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What follows parsing in the loop?

A

Execute the specified action via APIs, functions, or system operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is “feedback” in the loop?

A

The result of executing the action, including data, status codes, or error messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is feedback used?

A

It is turned into text and incorporated into the next prompt for context and adaptation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When does the loop terminate?

A

When the agent or system decides the goal is complete or a stop condition is met.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is added to the next prompt after each action?

A

The latest feedback and relevant context from prior steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How does the loop create autonomy?

A

By repeatedly letting the agent choose actions and adapt using execution feedback.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What simple example demonstrates loop use?

A

“Add travel expense” → list rows → check for duplicates → add new row → confirm result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do agents handle “I’m out of beans” in the loop?

A

They adapt the plan (e.g., skip or substitute) based on feedback.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Why are agents more robust than brittle scripts?

A

They can revise plans dynamically when conditions change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the human-in-the-loop alternative?

A

The agent outputs instructions or code, and a human manually executes and reports back.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Why is full manual execution undesirable for agents?

A

It is inefficient and prevents true autonomy.

23
Q

What enables autonomous execution?

A

A loop that parses model outputs and programmatically calls tools/APIs.

24
Q

What translation does the agent perform?

A

Translates natural-language goals into concrete computations and API calls.

25
Why are transformers suited for this translation?
They excel at converting between languages, including natural language and code-like formats.
26
What must the response format enable?
Reliable parsing to identify actions, parameters, and targets.
27
What is a common response format strategy?
Constrain outputs to JSON or another schema the system can parse.
28
What do we do with API errors?
Treat them as feedback, add them to context, and let the agent adapt the next action.
29
How does the loop handle HTTP status codes?
Include codes and messages in feedback to guide the agent’s next step.
30
What does “build up the prompt over time” mean?
Each iteration appends outcomes and context, forming a growing working memory.
31
Why is iterative prompting effective?
It focuses the agent on immediate next steps while preserving relevant history.
32
What is the minimal architecture most agents need?
The simple loop of prompt, parse, execute, feedback, repeat.
33
How do frameworks relate to the loop?
Most agent frameworks implement this same loop under the hood.
34
What risk does free-form output pose?
It can be unparseable or ambiguous for rigid systems.
35
How can we reduce parsing failures?
Use strict schemas, function-calling, or tool-usage formats in prompts.
36
What decides “continue or stop” each iteration?
A termination check based on goal completion or explicit stop signals.
37
What should be logged each iteration?
Prompt, model output, parsed action, execution result, and feedback summary.
38
Why include execution results verbatim in feedback?
It preserves exact details (data values, error text) for accurate adaptation.
39
What if the agent chooses an invalid action?
The executor returns an error; the agent revises the plan using that feedback.
40
What if the needed tool is unavailable?
The agent should detect the limitation from feedback and choose an alternative path.
41
How does the loop prevent infinite wandering?
Add guardrails like step limits, budget/time caps, or explicit success criteria.
42
Why is stepwise action selection preferred?
It limits error propagation and supports rapid course correction.
43
How do you seed the initial loop prompt?
Provide the goal, available tools, constraints, output format, and first-step instruction.
44
What is a good first-step instruction?
“Decide and return exactly one next action in the required schema.”
45
How do you ensure tool parameters are precise?
Require explicit fields, types, and units in the response schema.
46
What belongs in the tool registry given to the agent?
Tool names, capabilities, parameter schemas, and usage constraints.
47
Why include examples of valid actions in the prompt?
To prime the model to follow the schema and avoid hallucinated tools.
48
What is the role of a dispatcher in the loop?
Map parsed actions to the correct tool or API implementation.
49
How do you handle multi-step dependencies?
Pass outputs from prior actions as inputs or context for subsequent steps.
50
Why is idempotency important for actions?
It allows safe retries without duplicating effects (e.g., duplicate expense rows).
51
How can the loop detect completion in CRUD tasks?
Verify post-conditions (e.g., row exists with expected values) before terminating.
52
What metric signals loop quality?
High parse success, low error rate, and successful goal completion within step limits.
53
How does the loop enable adaptability?
Feedback closes the sense–think–act cycle, letting the agent revise plans each step.
54
What principle keeps the architecture simple?
Prefer the basic loop; add complexity only when required by the task.