Unit 5: LLM-Driven Agents and Generative Workflows - Subjective Questions
CSE473 — Large Language Models And Agentic Ai • Practice Questions with Detailed Answers
20 questions
Define an LLM-driven agent and explain its major components.
An LLM-driven agent is an intelligent system that uses a large language model as its reasoning and decision-making engine to perceive information, plan actions, use tools, and pursue goals.
Major components include:
- LLM core: Interprets inputs, reasons about tasks, and generates decisions.
- Prompt or policy: Specifies the agent's role, goals, constraints, and expected behavior.
- Memory: Stores conversation history, observations, intermediate results, or long-term knowledge.
- Planner: Decomposes a goal into manageable steps and selects the next action.
- Tools: Provide capabilities such as web search, calculation, code execution, or database access.
- Action executor: Invokes selected tools and records their results.
- Environment: The external system with which the agent interacts.
- Feedback loop: Enables the agent to observe outcomes, revise its plan, and continue until a stopping condition is reached.
Explain how a large language model can be integrated into an agentic framework.
An LLM is integrated into an agentic framework by placing it inside an iterative control loop:
- Receive a goal: The user or another system supplies a task.
- Construct context: The framework combines instructions, relevant memories, current state, and available tool descriptions.
- Reason and decide: The LLM proposes a response, plan, or structured tool call.
- Execute an action: The framework validates the proposal and invokes the selected tool or API.
- Observe the result: Tool output is returned to the agent as a new observation.
- Update state: Memory, task status, and the current plan are revised.
- Repeat or terminate: The loop continues until the goal is achieved, a limit is reached, or human approval is required.
The framework supplies orchestration and control, while the LLM contributes language understanding, reasoning, planning, and flexible decision-making.
Describe the role of chain-of-thought reasoning in agent planning. Also discuss its benefits and limitations.
Chain-of-thought reasoning refers to breaking a difficult problem into intermediate reasoning steps before producing a decision or answer. In planning, it helps an agent identify subgoals, dependencies, required tools, and the order of actions.
Benefits:
- Supports decomposition of complex tasks.
- Makes multi-step planning more systematic.
- Helps the agent compare alternatives and revise failed steps.
- Can improve performance on logical and procedural tasks.
Limitations:
- Intermediate reasoning may still contain confident errors.
- Long reasoning traces increase latency and token cost.
- Excessive reasoning can cause repetition or unnecessary actions.
- Revealing raw internal reasoning may create privacy or security concerns.
Practical systems often use concise plans, structured scratchpads, verification, or hidden internal reasoning rather than exposing unrestricted reasoning traces.
Design a planning workflow for an LLM agent that must organize a technical workshop. Explain each stage.
A suitable planning workflow is:
- Interpret the objective: Extract the workshop topic, audience, budget, date, duration, and expected outcomes.
- Identify constraints: Record venue capacity, speaker availability, deadlines, and approval requirements.
- Decompose the goal: Create subgoals for venue selection, agenda preparation, speaker coordination, registration, publicity, and feedback collection.
- Establish dependencies: Confirm the date and venue before publishing invitations; finalize speakers before announcing the agenda.
- Select tools: Use calendar, email, budgeting, document-generation, and registration APIs.
- Execute tasks: Perform low-risk actions automatically and request approval for payments or external communication.
- Monitor progress: Store completion status, failures, and responses in memory.
- Replan: Find replacement speakers or venues when constraints change.
- Validate completion: Check that all required resources, notifications, and documents are ready.
- Produce a report: Summarize actions, unresolved issues, expenses, and final arrangements.
This workflow combines goal decomposition, tool use, memory, verification, and human oversight.
What is memory augmentation in an LLM agent? Distinguish among working, episodic, semantic, and procedural memory.
Memory augmentation extends an agent beyond the LLM's immediate context by storing and retrieving information needed across interactions or tasks.
- Working memory: Holds the current conversation, active plan, intermediate results, and recent observations. It is short-lived and directly supports the current task.
- Episodic memory: Records past events or interaction histories, such as how a previous customer issue was resolved.
- Semantic memory: Stores general facts, concepts, documents, and organizational knowledge, often retrieved through embeddings and vector search.
- Procedural memory: Stores reusable methods, workflows, policies, or instructions describing how tasks should be performed.
Together, these forms of memory improve continuity and personalization. However, stored information must be filtered, updated, access-controlled, and checked for relevance to avoid stale data, privacy leakage, or incorrect retrieval.
Explain how a retrieval-augmented memory system works for an LLM agent.
A retrieval-augmented memory system commonly follows these stages:
- Capture: Collect useful messages, observations, documents, and task results.
- Process: Clean the content, divide large documents into chunks, and attach metadata.
- Represent: Convert each chunk into an embedding vector that captures semantic meaning.
- Store: Save vectors and metadata in a vector database or another searchable memory store.
- Form a query: Convert the agent's current information need into a search query or embedding.
- Retrieve: Select relevant records using semantic similarity, keyword matching, metadata filters, or a hybrid method.
- Rank and filter: Prefer recent, trustworthy, and task-relevant memories.
- Inject context: Add selected memories to the LLM prompt.
- Generate and verify: Produce an answer or action grounded in the retrieved information and, where possible, retain source references.
This approach gives the agent access to external knowledge without retraining the underlying model.
Compare short-term memory and long-term memory in agentic AI.
Short-term memory stores information needed during the current interaction, whereas long-term memory preserves useful knowledge across sessions.
| Aspect | Short-term memory | Long-term memory |
|---|---|---|
| Duration | Current task or session | Multiple sessions or extended periods |
| Typical content | Recent messages, active plan, tool results | User preferences, past episodes, documents, learned procedures |
| Storage | Prompt context, state object, temporary cache | Database, vector store, knowledge graph, or file system |
| Access | Usually immediate | Requires retrieval and ranking |
| Main limitation | Restricted by context-window size | Can become stale, irrelevant, or privacy-sensitive |
An effective agent summarizes or discards low-value short-term information and promotes only useful, authorized information to long-term memory.
Describe how an LLM agent performs tool selection, tool invocation, and result interpretation.
Tool use generally occurs in three stages:
- Tool selection: The agent compares the task with tool names, descriptions, capabilities, costs, and constraints. It chooses a tool only when external computation or information is required.
- Tool invocation: The LLM produces a structured request containing the tool name and arguments. The orchestrator validates the request against a schema, checks permissions, and executes it.
- Result interpretation: The framework converts the tool response into a normalized observation. The LLM evaluates whether the result satisfies the current subgoal, requires another action, or indicates failure.
Reliable systems also include input validation, authentication, timeouts, retry limits, error handling, output sanitization, logging, and human approval for consequential actions.
Explain the major challenges involved in API orchestration by autonomous agents and suggest appropriate safeguards.
Major challenges and safeguards include:
- Incorrect arguments: Enforce typed schemas, required fields, and range validation.
- Tool hallucination: Expose only registered tools and reject unknown function names.
- Authentication risks: Store credentials outside prompts and apply least-privilege access.
- Unreliable services: Use timeouts, bounded retries, fallback services, and circuit breakers.
- Duplicate operations: Apply idempotency keys, especially for payments or record creation.
- Conflicting outputs: Rank sources, check provenance, and request clarification when needed.
- Excessive cost or latency: Set budgets, rate limits, and execution deadlines.
- Unsafe actions: Use allowlists, sandboxing, policy checks, and human approval gates.
- Malicious tool output: Treat API responses as untrusted data and sanitize them before reuse.
- Poor traceability: Record tool requests, responses, decisions, errors, and approvals in audit logs.
These controls make orchestration more predictable, secure, and recoverable.
Define the ReAct framework and explain its reasoning-and-acting cycle with an example.
ReAct, meaning Reasoning and Acting, is an agent pattern that interleaves task reasoning with actions performed in an external environment.
Its cycle is:
- Reason: Determine what information or capability is needed next.
- Act: Select and invoke an appropriate tool.
- Observe: Receive the tool's result.
- Update: Use the observation to revise the plan.
- Repeat: Continue until enough evidence is available for a final answer.
For example, an agent answering a question about current inventory may first decide that internal records are required, call an inventory API, observe the returned quantities, call a pricing API if valuation is also required, and then synthesize the final response.
ReAct grounds generation in external observations and supports correction after failures. Its weaknesses include long execution traces, repeated tool calls, error propagation, and the need for reliable stopping conditions.
Compare the ReAct approach with a plan-first agent architecture.
ReAct decides and acts incrementally, while a plan-first architecture creates a broader plan before execution.
| Aspect | ReAct | Plan-first architecture |
|---|---|---|
| Decision style | Chooses the next action after each observation | Produces an initial sequence of subgoals |
| Adaptability | High in changing or uncertain environments | Requires explicit replanning when assumptions fail |
| Global coordination | May become locally focused or repetitive | Better visibility of dependencies and overall structure |
| Initial overhead | Usually low | Higher because planning occurs before action |
| Suitable tasks | Search, diagnosis, exploration | Projects with predictable stages and dependencies |
A hybrid design is often preferable: create a high-level plan, execute each stage through a ReAct loop, and replan when observations invalidate the original assumptions.
Describe the architecture and operation of a LangChain agent.
A LangChain agent combines a language model with tools and an execution loop.
Key elements include:
- Chat model: Interprets the task and decides whether to answer or call a tool.
- Prompt and instructions: Define the agent's role, constraints, tool descriptions, and response format.
- Tools: Wrapped functions with names, descriptions, and input schemas.
- Agent state: Stores messages, intermediate steps, and observations.
- Executor or graph runtime: Runs the decision loop, invokes tools, handles errors, and enforces stopping rules.
- Memory or persistence: Retains selected state within or across sessions.
- Callbacks and tracing: Capture model calls, tool use, latency, and failures.
During execution, the model receives the current state, emits a structured action, obtains an observation from the chosen tool, and repeats until it produces a final response. Production implementations should add validation, access controls, limits, and observability.
Explain the purpose of tools, prompts, memory, and executors in LangChain-based agent development.
These components have complementary responsibilities:
- Tools: Connect the agent to external capabilities such as databases, search engines, calculators, and business APIs. Their descriptions and schemas guide correct selection and invocation.
- Prompts: Specify the objective, behavioral rules, available context, output structure, and constraints. Clear prompts reduce ambiguity.
- Memory: Preserves relevant conversation state, prior observations, summaries, or retrieved knowledge. It supports continuity but requires careful filtering.
- Executors: Coordinate the runtime loop. They pass state to the model, parse requested actions, invoke tools, return observations, manage errors, and stop execution.
A robust application keeps these responsibilities modular so models, tools, memory strategies, and control policies can be tested or replaced independently.
What is AutoGPT? Describe its autonomous task-execution loop and identify its major limitations.
AutoGPT is an early autonomous-agent approach in which an LLM repeatedly generates goals or tasks, chooses actions, uses tools, stores information, and evaluates progress with limited user intervention.
A typical loop is:
- Accept a high-level objective.
- Generate or prioritize subtasks.
- Select the next action or tool.
- Execute the action.
- store the resulting observation in memory.
- Evaluate progress and revise the task list.
- Continue until completion or a stopping limit.
Major limitations include:
- Repeated or unproductive loops.
- Accumulation of planning errors.
- High token, API, and execution costs.
- Weak guarantees that the stated goal has been achieved.
- Unsafe actions when permissions are too broad.
- Context loss and retrieval of irrelevant memories.
- Difficulty handling vague objectives and stopping correctly.
Consequently, practical deployments use bounded autonomy, explicit budgets, permission controls, monitoring, and human approval.
Compare LangChain Agents and AutoGPT in terms of purpose, control, and suitable applications.
LangChain Agents are components for building customized tool-using applications, while AutoGPT represents a more opinionated autonomous goal-pursuit pattern.
| Aspect | LangChain Agents | AutoGPT |
|---|---|---|
| Primary purpose | Framework for constructing agent workflows | Autonomous pursuit of broad objectives |
| Developer control | High; tools, state, prompts, and flow can be customized | More emphasis on self-generated tasks and iterative execution |
| Workflow structure | Can be tightly constrained or graph-based | Commonly uses an open-ended task loop |
| Integration | Designed for application components and external systems | Often presented as a complete autonomous agent |
| Suitable use | Controlled assistants, support systems, workflow automation | Experiments and bounded projects requiring autonomous decomposition |
| Main risk | Misconfigured tools or control flow | Runaway loops, cost growth, and goal drift |
The choice depends on whether the application requires precise orchestration or broader autonomy. For production systems, controlled and observable workflows are generally preferred.
Explain autonomous task delegation in a multi-agent system. What factors should guide the delegation decision?
Autonomous task delegation occurs when a coordinating agent assigns subtasks to specialized agents or services without requiring a human to direct every step.
Delegation decisions should consider:
- Capability: Which agent has the tools and expertise required?
- Task dependency: Which subtasks can run independently, and which require earlier results?
- Cost and latency: Is delegation worth the communication and computation overhead?
- Reliability: How accurate and available is the selected agent?
- Permissions: Is the delegate authorized to access the required resources?
- Context needs: Can the coordinator provide sufficient information without exposing unnecessary data?
- Risk: Does the task require review, approval, or execution in a sandbox?
The coordinator should define expected inputs, outputs, deadlines, and success criteria. It must then validate returned results, resolve conflicts, combine outputs, and reassign failed tasks when appropriate.
Design a multi-agent system for producing a market research report, including delegation, communication, and verification.
A multi-agent design may contain the following roles:
- Coordinator agent: Interprets the objective, creates the task graph, delegates work, and tracks completion.
- Research agents: Gather information about customers, competitors, industry trends, and regulations from approved sources.
- Data-analysis agent: Cleans data, computes statistics, and creates tables or summaries.
- Writer agent: Combines validated findings into a coherent report.
- Verifier agent: Checks claims, citations, consistency, freshness, and unsupported conclusions.
- Compliance agent: Reviews privacy, licensing, and organizational policy requirements.
The coordinator provides each agent with a bounded subtask, required output schema, source restrictions, and deadline. Independent research tasks can execute in parallel. Results are returned with provenance and confidence information. The verifier rejects unsupported claims or sends them back for revision. The writer uses only approved evidence, and human approval is required before publication.
This architecture improves specialization and parallelism but must control duplicated effort, communication overhead, inconsistent outputs, and cascading errors.
Discuss the applications of LLM-driven agents in business-process automation. Illustrate with suitable examples.
LLM-driven agents can automate processes involving unstructured language, multiple systems, and context-dependent decisions.
Applications include:
- Customer support: Classifying tickets, retrieving account information, drafting responses, and escalating exceptional cases.
- Document processing: Extracting fields from contracts or invoices and entering validated data into business systems.
- Human resources: Answering policy questions, coordinating interviews, and preparing onboarding checklists.
- Software operations: Summarizing incidents, querying monitoring tools, and recommending remediation steps.
- Sales operations: Updating customer records, preparing meeting briefs, and generating follow-up drafts.
- Supply-chain support: Comparing inventory, demand, and delivery data to identify potential shortages.
Agents are especially useful when they can combine language understanding with API access. High-impact actions such as payments, account changes, or production modifications should remain subject to deterministic checks and human authorization.
Explain how LLM-driven agents support decision-making without replacing accountable human decision makers.
LLM-driven agents support decisions by collecting evidence, retrieving relevant policies, comparing alternatives, summarizing trade-offs, identifying missing information, and generating recommendations.
A responsible decision-support workflow should:
- Define the decision, constraints, and accountable human owner.
- Gather information from approved and traceable sources.
- Separate verified facts from assumptions and model-generated interpretations.
- Present multiple options with benefits, risks, and uncertainty.
- Check recommendations against rules, policies, and quantitative evidence.
- Allow the human reviewer to inspect sources and override the recommendation.
- Record the inputs, recommendation, approval, and final outcome.
- Monitor results for systematic errors or bias.
The agent should not be treated as the accountable authority in high-stakes settings because outputs can be incorrect, biased, incomplete, or difficult to explain.
Propose an evaluation framework for an LLM-driven agent that uses memory, planning, and external tools.
A comprehensive evaluation framework should measure both final outcomes and execution behavior.
Task performance:
- Completion rate and output correctness.
- Quality of decomposition and ordering of subgoals.
- Ability to recover from failed actions.
Tool performance:
- Correct tool-selection rate.
- Argument validity and API success rate.
- Number of redundant or unnecessary calls.
Memory performance:
- Retrieval precision and relevance.
- Use of current rather than stale information.
- Resistance to unauthorized or malicious memory content.
Efficiency:
- End-to-end latency, token use, API cost, and number of steps.
Safety and governance:
- Policy-violation rate, permission compliance, privacy protection, and human-escalation accuracy.
Robustness:
- Performance under ambiguous requests, unavailable tools, conflicting evidence, malformed outputs, and prompt injection attempts.
Evaluation should use representative benchmark tasks, adversarial cases, controlled simulations, human review, and production monitoring. Execution traces should be inspected to ensure that apparent success was achieved through valid and safe actions.
Define an LLM-driven agent and explain its major components.
An LLM-driven agent is an intelligent system that uses a large language model as its reasoning and decision-making engine to perceive information, plan actions, use tools, and pursue goals.
Major components include:
- LLM core: Interprets inputs, reasons about tasks, and generates decisions.
- Prompt or policy: Specifies the agent's role, goals, constraints, and expected behavior.
- Memory: Stores conversation history, observations, intermediate results, or long-term knowledge.
- Planner: Decomposes a goal into manageable steps and selects the next action.
- Tools: Provide capabilities such as web search, calculation, code execution, or database access.
- Action executor: Invokes selected tools and records their results.
- Environment: The external system with which the agent interacts.
- Feedback loop: Enables the agent to observe outcomes, revise its plan, and continue until a stopping condition is reached.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →