Q31Security
How can a tool result cause prompt injection?
Explain malicious instructions embedded in retrieved pages, emails, or documents.
Answer
A tool can return untrusted content that contains instructions such as ignoring prior rules, revealing data, or calling another tool. If the agent treats that content as authoritative instructions, it may misuse its capabilities.
Separate trusted system policy from external data, label retrieved content as untrusted, constrain tools and permissions, and require confirmation for sensitive actions. Prompt wording helps but cannot replace application-level controls.
Key Points
- External content is data, not policy.
- Use least-privilege tools and explicit authorization.
- Test indirect prompt-injection scenarios.
Q32Security
How do you apply least privilege to agent tools?
Design narrow capabilities and enforce user-level authorization.
Answer
Give each tool only the permissions needed for its task. Prefer read-only tools when possible, scope queries to the authenticated user's records, and separate privileged actions into dedicated tools with explicit checks and approval requirements.
Do not trust a user ID or account ID supplied by the model. Derive identity from the authenticated request and enforce authorization in the service layer on every call.
Key Points
- Use narrow, purpose-built tools.
- Derive identity from trusted authentication context.
- Authorize every request at the backend.
Q33Security
How should secrets be managed in an agent system?
Protect API keys, credentials, and tokens used by tools.
Answer
Store credentials in a secret manager or protected server-side configuration, rotate them, and grant each service only the scopes it needs. Never place secrets in prompts, tool descriptions, browser code, logs, or model-visible results.
Use short-lived credentials where possible and ensure tools do not let the model choose arbitrary URLs or access internal metadata services. Audit secret access and revoke compromised credentials promptly.
Key Points
- Keep secrets out of model context and client bundles.
- Use scoped credentials and rotation.
- Restrict destinations and audit access.
Q34Security
Where should authorization be enforced for agent actions?
Explain why authorization belongs in trusted application services.
Answer
Authorization must be enforced by the backend or trusted service immediately before an operation executes. A model's decision, prompt instruction, UI visibility, or tool schema is not proof that the user has permission.
Check the authenticated principal, resource ownership, role, tenant, requested action, and current business state. Recheck authorization for delayed approvals because roles or resource state may change.
Key Points
- Enforce authorization at the execution boundary.
- Never accept model-supplied identity as authority.
- Recheck permission after approvals and before mutations.
Q35Security
How would you design a safe tool layer for an enterprise agent?
Describe schemas, policy checks, identity, audit, and controlled execution.
Answer
Put a tool gateway between the model and business services. It should validate schemas, map calls to an allowlist, derive identity from the authenticated session, enforce authorization and business rules, apply rate and resource limits, and record an audit event.
Separate read and write capabilities, require approvals for high-impact actions, redact outputs, and use idempotency for mutations. The gateway should return typed errors and avoid exposing raw internal exceptions.
Key Points
- Use an allowlisted tool gateway.
- Enforce identity, authorization, validation, and quotas.
- Audit actions and add approval gates for high impact.
Q36Security
What should an audit trail record for an agent action?
Capture who requested an action, what was authorized, and the outcome.
Answer
Record a correlation ID, authenticated actor, action and target, timestamp, policy decision, approval reference if applicable, tool version, outcome, and relevant before-and-after identifiers. Store enough evidence to reconstruct the event without copying excessive sensitive content.
Protect audit records against unauthorized modification and apply retention policies. Distinguish model-proposed actions from actions actually executed by the application.
Key Points
- Separate proposed actions from executed actions.
- Record actor, authorization, outcome, and correlation IDs.
- Protect logs and minimize sensitive payloads.
Q37Tool protocols and integration
What is the Model Context Protocol (MCP)?
Explain the purpose of a standard interface for tools and context.
Answer
MCP is a protocol for connecting AI applications to external capabilities and context through standardized server-provided primitives such as tools and resources. It can reduce the need for each client to implement a completely different integration for every service.
Using MCP does not automatically make a server trusted. Clients still need to vet servers, manage credentials, restrict capabilities, validate inputs and outputs, and obtain approval for sensitive operations.
Key Points
- MCP standardizes integration patterns.
- MCP does not replace authorization or security review.
- Expose only approved servers and capabilities.
Q38Tool protocols and integration
When would you choose MCP over custom tool integrations?
Compare interoperability with direct, application-specific integrations.
Answer
MCP is useful when several AI clients need a consistent way to access a service or when the ecosystem already provides a suitable server. A custom integration may be simpler when one application needs a small, tightly controlled set of operations.
Compare operational maturity, authentication, authorization, deployment, latency, observability, versioning, and the trustworthiness of the server. A protocol choice does not remove the need to validate capabilities.
Key Points
- Choose based on reuse and operational needs.
- Assess authentication and permission boundaries.
- Keep integration scope narrow either way.
Q39Tool protocols and integration
How do you version tools without breaking an agent?
Use stable schemas, compatibility rules, and staged rollout.
Answer
Treat tool schemas as APIs. Prefer additive optional fields, preserve existing behavior, version breaking changes, and maintain contract tests for model-generated arguments and tool responses.
Roll out changes gradually, monitor validation failures and task success, and keep a rollback path. Update tool descriptions and model instructions alongside schema changes.
Key Points
- Maintain backward compatibility where possible.
- Test both input and output contracts.
- Use staged rollout and rollback.
Q40Reliability
How would you rate-limit agent tool calls?
Apply per-user, per-tool, and global limits to control abuse and cost.
Answer
Apply limits at multiple levels: per user or tenant, per tool, per time window, and global service capacity. Combine request quotas with concurrency limits, token or cost budgets, and limits on repeated actions.
Return a typed rate-limit response with retry guidance when appropriate. A model should not be allowed to bypass a quota by repeatedly changing arguments or delegating to another agent.
Key Points
- Use layered limits and concurrency controls.
- Budget model calls and tool calls separately.
- Make retry behavior bounded and observable.
Q41Evaluation and observability
What metrics would you monitor for an agent in production?
Track quality, tool reliability, safety, latency, and cost.
Answer
Monitor task completion and user correction rates, tool-call success and validation failures, policy denials, approval rates, repeated-call loops, latency percentiles, token usage, cost per successful task, and downstream dependency health.
Segment metrics by agent version, tool, task type, and tenant where appropriate. Avoid optimizing only for completion rate because an agent that takes unsafe shortcuts can appear successful.
Key Points
- Combine outcome, reliability, safety, and cost metrics.
- Segment by version and tool.
- Alert on regressions and abnormal action patterns.
Q42Evaluation and observability
How would you regression-test an agent?
Create repeatable test cases for tool selection, arguments, and final outcomes.
Answer
Build a test suite of representative tasks with mocked tool responses and expected properties: correct tool selection, valid arguments, correct handling of errors, adherence to policy, and an acceptable final result. Include adversarial and edge cases.
Model outputs can vary, so avoid brittle exact-string assertions when semantic checks are more appropriate. Use fixed seeds or deterministic settings when supported, and add production failures to the test set after removing sensitive data.
Syntax
expect(result.status).toBe("completed");
expect(toolCalls).toContainEqual(
expect.objectContaining({ name: "get_order_status" })
);
expect(unauthorizedMutationCount).toBe(0);
Key Points
- Test decisions and side effects, not only wording.
- Mock external systems for repeatability.
- Add regression cases from real failures.
Q43Reliability
What should an agent do when its primary tool is unavailable?
Choose between retrying, approved fallback, partial completion, and escalation.
Answer
Classify the failure first. A transient timeout may justify a bounded retry; a permanent authorization error should not. An approved fallback can be used only if it has equivalent permission and data-quality guarantees.
If the task cannot be completed reliably, report what was and was not completed and offer a safe next step. Do not invent missing data or silently use an untrusted source.
Key Points
- Classify errors before choosing a fallback.
- Do not bypass permissions to recover availability.
- Report partial completion accurately.
Q44Security
How do you minimize sensitive data sent to an LLM?
Limit tool results, redact personal data, and send only task-relevant fields.
Answer
Design tools to return the smallest set of fields needed for the task, filter records by authenticated user and purpose, redact or tokenize sensitive values, and avoid placing secrets in conversation history. Keep raw records in trusted services whenever possible.
Define retention and logging rules for prompts and outputs. Apply tenant isolation and verify that cached results cannot leak data between users.
Key Points
- Minimize data at the source.
- Redact before model calls and logs.
- Protect tenant boundaries and cache keys.
Q45Security
How do you secure an agent that can fetch URLs?
Prevent SSRF, access to internal services, and unsafe redirects.
Answer
Do not let a model send arbitrary URLs directly to a privileged network client. Apply an allowlist where feasible, restrict schemes and ports, resolve and validate destination addresses, block private and link-local ranges, and revalidate each redirect.
Run fetchers in a restricted network environment with egress controls, response-size and timeout limits, and content-type checks. Defend against DNS rebinding and avoid exposing cloud metadata or internal administration endpoints.
Key Points
- Use network-level egress restrictions as well as URL validation.
- Block internal and metadata destinations.
- Limit redirects, response size, and execution time.
Q46Safety and control
How would you design an agent that can make purchases?
Use quote, confirmation, authorization, idempotency, and reconciliation steps.
Answer
Separate product search and quote generation from the purchase operation. Present the exact item, quantity, total price, fees, shipping, and terms to the user, then require an explicit confirmation bound to that quote.
Before purchase, revalidate price and availability, authenticate and authorize the actor, apply spending limits, and use an idempotency key. Persist the transaction state and reconcile uncertain outcomes rather than blindly retrying.
Key Points
- Require confirmation of exact transaction details.
- Revalidate quote and permissions at execution time.
- Use idempotency and reconciliation for uncertain results.
Q47Security
How do you ensure tenant isolation in an enterprise agent?
Prevent one customer's context, tools, or retrieved data from leaking to another.
Answer
Derive tenant identity from authenticated server-side context and pass it through every retrieval and tool call. Enforce tenant filters in the data layer, namespace caches and memory, and avoid letting the model choose or override tenant identifiers.
Test cross-tenant access explicitly, including indirect paths such as summaries, logs, shared caches, delegated agents, and background jobs.
Key Points
- Derive tenant context from trusted authentication.
- Enforce isolation in storage and service layers.
- Test cross-tenant leakage paths.
Q48Evaluation and observability
How would you safely roll out a new agent version?
Use offline evaluation, canary traffic, monitoring, and rollback.
Answer
Run the new version against a regression suite and safety evaluations, then deploy it to a small canary segment. Compare task outcomes, tool errors, policy violations, latency, and cost with the current version.
Expand traffic only when metrics meet defined thresholds. Keep model, prompt, tool schema, and application versions traceable, and maintain a fast rollback path.
Key Points
- Evaluate offline before production.
- Use canaries and explicit promotion thresholds.
- Keep version metadata and rollback capability.
Q49System design
Design an AI customer-support agent that can look up orders and issue refunds.
Propose a safe architecture for read and write actions.
Answer
Use an authenticated API layer, an orchestrator, an LLM, and narrow tools such as search knowledge base, get order status, and request refund. Read tools enforce customer ownership; the refund tool checks eligibility, amount limits, and role permissions.
Require explicit approval for the refund, revalidate order state at execution time, use idempotency, and record an audit trail. Add retrieval grounding, prompt-injection defenses, monitoring, rate limits, and a human escalation path.
Key Points
- Separate read tools from privileged write tools.
- Authorize and validate at the backend.
- Add approval, idempotency, audit, and escalation.
Q50System design
Design a research agent that gathers sources and writes a report.
Cover planning, retrieval, source provenance, synthesis, and verification.
Answer
Define the research question and output schema, then use approved search and retrieval tools to collect sources. Store source identifiers, URLs, timestamps, and relevant excerpts; deduplicate results and keep evidence linked to each claim.
The agent should distinguish sourced facts from inference, flag gaps, and verify important claims against reliable sources. Apply URL-fetching safeguards, content-size limits, source-quality checks, and a final review step before publishing.
Key Points
- Preserve provenance for claims.
- Treat web content as untrusted input.
- Verify key claims and disclose evidence gaps.
Q59Tool calling
How do you make tool execution auditable?
Assign a correlation ID to the agent run and record each proposed call, validation decision, authorization result, executed…
Answer
Assign a correlation ID to the agent run and record each proposed call, validation decision, authorization result, executed operation, outcome, and timing. Redact sensitive payloads and protect audit records from unauthorized modification.
Syntax
run_id → proposed call → policy decision → executed operation → outcome record
Example
Example: distinguish a model's proposed `delete_file` call from a deletion that actually passed authorization and completed.
Key Points
- Record proposals and executions separately.
- Use correlation IDs across services.
- Minimize sensitive payloads in logs.
Q63Workflows and orchestration
How do you make agent workflows resumable?
Use durable checkpoints, explicit task states, idempotent actions, and a recovery policy for each step. Store enough…
Answer
Use durable checkpoints, explicit task states, idempotent actions, and a recovery policy for each step. Store enough structured information to resume without replaying every prior model call, and revalidate data that may have changed while the task was paused.
Syntax
checkpoint → worker interruption → load state → verify external state → continue
Example
Example: before retrying a booking after a timeout, query the booking service to determine whether the first attempt succeeded.
Key Points
- Checkpoint after meaningful transitions.
- Make side effects idempotent or reconcilable.
- Revalidate stale assumptions.
Q64Workflows and orchestration
What is the saga pattern and how can it help agent workflows?
A saga coordinates a sequence of distributed operations using local transactions and compensating actions when a later step…
Answer
A saga coordinates a sequence of distributed operations using local transactions and compensating actions when a later step fails. It can help with workflows that span services, but compensation is not always a perfect reversal and must be explicitly designed.
Syntax
reserve inventory → charge payment → schedule shipment; on failure run defined compensations
Example
Example: if shipment scheduling fails after payment, a controlled compensation may void or refund the payment according to business policy.
Key Points
- Use explicit step and compensation records.
- Compensation is not always a true rollback.
- Require reconciliation and audit for partial completion.
Q67Planning and reasoning
How can you detect whether an agent is making progress?
Track explicit milestones, completed subtasks, changed state, repeated tool-call signatures, and whether new observations…
Answer
Track explicit milestones, completed subtasks, changed state, repeated tool-call signatures, and whether new observations reduce uncertainty. If the same action repeats without new information, stop, change strategy, ask for input, or escalate.
Syntax
step signature + state delta + milestone status → progress check → continue or stop
Example
Example: three identical searches with the same empty result trigger a bounded fallback rather than another identical call.
Key Points
- Define measurable progress signals.
- Detect repeated calls and unchanged state.
- Stop or escalate when progress stalls.
Q68Planning and reasoning
How do you balance agent autonomy with predictability?
Grant autonomy for reversible, low-risk tasks while using deterministic gates for sensitive, costly, or irreversible…
Answer
Grant autonomy for reversible, low-risk tasks while using deterministic gates for sensitive, costly, or irreversible operations. Set clear scopes, step budgets, approval requirements, and observable completion criteria so the agent can adapt without receiving unrestricted authority.
Syntax
risk classification → autonomy level → bounded plan → approvals for high-impact steps
Example
Example: allow an agent to summarize documents automatically but require confirmation before sharing them externally.
Key Points
- Match autonomy to action risk.
- Use approval and policy gates.
- Make actions observable and reversible where possible.
Q71State and memory
How would you isolate memory between users and tenants?
Namespace memory by authenticated identity and tenant, enforce access in the storage layer, and include the same scope in…
Answer
Namespace memory by authenticated identity and tenant, enforce access in the storage layer, and include the same scope in cache keys and retrieval filters. Never let the model choose another user's memory namespace or infer permission from remembered text.
Syntax
authenticated principal → server-derived namespace → scoped read/write → access audit
Example
Example: a shared agent service never retrieves one customer's conversation summary for another customer.
Key Points
- Derive scope from trusted identity.
- Apply isolation to caches and background jobs.
- Test cross-user and cross-tenant access.
Q74Reliability
How do you avoid duplicate side effects when an agent retries after a timeout?
A timeout leaves the remote outcome uncertain. Use an idempotency key and durable operation record, then query the…
Answer
A timeout leaves the remote outcome uncertain. Use an idempotency key and durable operation record, then query the downstream system or reconcile by request ID before issuing a new mutation.
Syntax
submit with idempotency key → timeout → query operation status → retry only if safe
Example
Example: a payment tool uses one stable key per intended payment so retrying does not create a second charge.
Key Points
- A timeout does not prove failure.
- Use idempotency and operation status checks.
- Persist intent and final outcome.
Q75Reliability
What is a circuit breaker and when would an agent need one?
A circuit breaker temporarily stops calls to a failing dependency after a threshold of failures, allowing the dependency to…
Answer
A circuit breaker temporarily stops calls to a failing dependency after a threshold of failures, allowing the dependency to recover and preventing cascading load. It can transition through closed, open, and half-open states while probes test recovery.
Syntax
CLOSED → failures exceed threshold → OPEN → wait → HALF_OPEN probe → CLOSED or OPEN
Example
Example: stop repeatedly calling an unavailable CRM API and return a controlled unavailable result until a probe succeeds.
Key Points
- Prevent cascading failures.
- Use thresholds and recovery probes.
- Expose circuit state in monitoring.
Q76Reliability
How should an agent handle partial success across multiple tools?
Track the outcome of each step and distinguish completed, failed, and unknown operations. Decide whether to continue,…
Answer
Track the outcome of each step and distinguish completed, failed, and unknown operations. Decide whether to continue, compensate, request approval, or report partial completion based on business rules rather than presenting the overall task as fully successful.
Syntax
step A completed + step B failed + step C not run → recovery policy → explicit status
Example
Example: report that a report was generated but email delivery failed, and offer a safe retry for delivery.
Key Points
- Persist per-step status.
- Define compensation or recovery rules.
- Communicate partial completion accurately.
Q78Security
How do you defend against indirect prompt injection in agent workflows?
Indirect prompt injection arrives through content the agent reads, such as webpages, emails, documents, or tool output.…
Answer
Indirect prompt injection arrives through content the agent reads, such as webpages, emails, documents, or tool output. Treat such content as untrusted, isolate it from trusted instructions, restrict tools, validate outputs, and require authorization and approval for sensitive actions.
Syntax
external content → untrusted-data boundary → constrained model decision → policy enforcement
Example
Example: a webpage asks the agent to email confidential files; the email tool still requires explicit user authorization and recipient validation.
Key Points
- Test malicious external content.
- Do not let retrieved text alter authorization.
- Use least privilege and approval gates.
Q79Security
How should browser automation tools be secured for an agent?
Run browser automation with isolated sessions and least-privilege accounts, restrict navigation and downloads, validate…
Answer
Run browser automation with isolated sessions and least-privilege accounts, restrict navigation and downloads, validate destinations, and require confirmation for purchases, submissions, or destructive actions. Protect cookies and session tokens from prompts and logs.
Syntax
user-scoped browser session → destination policy → action validation → confirmation → execution
Example
Example: an agent may draft a form but must show the user the final submission details before sending it.
Key Points
- Isolate sessions and credentials.
- Restrict destinations and downloads.
- Confirm consequential browser actions.
Q80Security
How should an agent handle untrusted code execution requests?
Do not run model-provided code in the application process with broad privileges. If code execution is necessary, use a…
Answer
Do not run model-provided code in the application process with broad privileges. If code execution is necessary, use a sandbox with strict CPU, memory, time, filesystem, and network limits, and treat outputs as untrusted data.
Syntax
code proposal → policy gate → isolated sandbox → resource limits → validated output
Example
Example: a data-analysis agent runs a generated script in a disposable container without access to production credentials.
Key Points
- Sandbox execution separately.
- Disable unnecessary network and filesystem access.
- Validate output and enforce resource limits.
Q82Safety and control
How should an agent handle a user changing their mind mid-task?
Record cancellation or updated intent as a state transition, stop cancellable work, and check whether any side effects have…
Answer
Record cancellation or updated intent as a state transition, stop cancellable work, and check whether any side effects have already occurred. If an action is in flight or irreversible, report its status and follow a defined compensation or reconciliation path.
Syntax
new user instruction → update task state → cancel pending work → reconcile completed actions
Example
Example: cancel a draft email immediately, but if it was already sent, explain that it cannot be unsent and offer a follow-up.
Key Points
- Propagate cancellation where possible.
- Distinguish pending from completed actions.
- Reconcile irreversible side effects.
Q84Evaluation
What is the difference between offline and online agent evaluation?
Offline evaluation runs a fixed dataset or simulation before deployment and supports repeatable comparisons. Online…
Answer
Offline evaluation runs a fixed dataset or simulation before deployment and supports repeatable comparisons. Online evaluation measures behavior in real usage, subject to privacy, safety, and experimentation constraints; it can reveal distribution shifts that offline sets miss.
Syntax
offline regression suite → canary deployment → privacy-safe online metrics → review
Example
Example: validate a new planner offline, then compare canary task success and policy denials before expanding traffic.
Key Points
- Use offline tests before rollout.
- Monitor online drift and regressions.
- Protect users during experiments.
Q85Evaluation
How do you evaluate an agent's safety separately from task success?
Task success measures whether the goal was achieved, while safety evaluation measures whether the agent stayed within…
Answer
Task success measures whether the goal was achieved, while safety evaluation measures whether the agent stayed within policy, respected permissions, avoided data leaks, and handled risky requests correctly. Evaluate them separately because an unsafe shortcut can still produce a successful outcome.
Syntax
task outcome metrics + policy-violation tests + access-control tests + adversarial suite
Example
Example: an agent that retrieves another tenant's record fails safety even if it answers the user's question correctly.
Key Points
- Safety is not implied by success.
- Test unauthorized and adversarial cases.
- Track severity as well as frequency.
Q87Performance and cost
How do you cache agent tool results safely?
Cache only results whose freshness and authorization semantics are understood. Include relevant tenant, user scope, query…
Answer
Cache only results whose freshness and authorization semantics are understood. Include relevant tenant, user scope, query parameters, and data version in the cache key; set a suitable TTL and invalidate entries after mutations or source changes.
Syntax
authorized request → scoped cache key → fresh hit or tool call → TTL/invalidation
Example
Example: cache public documentation search separately from customer-specific order lookups, which require strict user-scoped keys.
Key Points
- Include authorization scope in cache keys.
- Set TTL based on data freshness.
- Invalidate after relevant changes.
Q89Multi-agent systems
How do you prevent multi-agent systems from multiplying costs uncontrollably?
Set global budgets for model calls, tool calls, elapsed time, delegation depth, and parallel workers. Require a clear reason…
Answer
Set global budgets for model calls, tool calls, elapsed time, delegation depth, and parallel workers. Require a clear reason for spawning workers, stop redundant tasks, and track cost and quality per completed user goal.
Syntax
global run budget → worker allocation → per-worker limits → aggregate budget enforcement
Example
Example: cap a research run at three parallel workers and stop further delegation when the evidence threshold is met.
Key Points
- Use global and per-worker budgets.
- Limit recursion and parallelism.
- Measure incremental value of each worker.
Q91Tool protocols and integration
How should an agent handle tool schema changes during a running task?
Pin or record the tool contract version for a run where practical, validate calls against the active schema, and return a…
Answer
Pin or record the tool contract version for a run where practical, validate calls against the active schema, and return a controlled incompatibility error if a tool changes unexpectedly. Deploy compatible changes gradually and ensure long-running jobs can resume safely.
Syntax
run uses schema version N → tool deployment → compatibility check → continue or controlled restart
Example
Example: a removed required field causes a typed failure and safe replanning rather than a malformed mutation.
Key Points
- Version tool contracts.
- Keep changes backward-compatible when possible.
- Handle in-flight task incompatibility explicitly.
Q92System design
Design an AI operations agent that can inspect services and restart a deployment.
Use authenticated read-only observability tools for health checks and logs, plus a separate restart tool with strict service…
Answer
Use authenticated read-only observability tools for health checks and logs, plus a separate restart tool with strict service allowlists, role checks, change-window rules, approval, and audit. The agent should diagnose first, present evidence and impact, then execute only the approved action.
Syntax
authenticate → inspect health/logs → diagnosis + evidence → approval → policy-checked restart → verify health
Example
Example: the agent can recommend a restart but cannot restart a production service without an authorized approval and a post-action health check.
Key Points
- Separate diagnostics from mutations.
- Use allowlists, approvals, and audit.
- Verify service health after the action.
Q93System design
Design an agent for processing invoices with human review.
Use document extraction and validation tools to produce structured invoice fields, compare them with purchase orders and…
Answer
Use document extraction and validation tools to produce structured invoice fields, compare them with purchase orders and business rules, and flag mismatches. The agent can prepare a recommendation, but payment or posting requires the configured approval and finance-system authorization.
Syntax
invoice → extraction → validation/matching → exception queue or approval → authorized posting
Example
Example: route an invoice with a mismatched amount to a reviewer rather than letting the model silently approve it.
Key Points
- Validate extracted fields against trusted records.
- Route exceptions to humans.
- Separate recommendation from payment execution.
Q94System design
How would you design a safe agent for managing email?
Provide scoped tools for searching, drafting, and sending messages, with send permission separated from draft permission.…
Answer
Provide scoped tools for searching, drafting, and sending messages, with send permission separated from draft permission. Validate recipients and attachments, prevent exfiltration of sensitive data, and require confirmation before external sends or bulk actions.
Syntax
search/read → draft → recipient/content checks → user confirmation → send tool → audit
Example
Example: the agent drafts a reply to a selected thread, shows recipients and attachments, then sends only after confirmation.
Key Points
- Separate draft and send capabilities.
- Validate recipients and attachment scope.
- Confirm bulk or external sends.
Q95System design
How would you design an agent that edits files in a repository?
Use a version-controlled workspace and tools for reading files, proposing patches, running tests, and creating a reviewable…
Answer
Use a version-controlled workspace and tools for reading files, proposing patches, running tests, and creating a reviewable change. Restrict paths and commands, avoid exposing secrets, and require human review before merging or deploying changes.
Syntax
read-only inspection → patch proposal → sandbox tests → diff review → authorized commit/merge
Example
Example: an agent can open a pull request with test results but cannot directly deploy to production.
Key Points
- Restrict filesystem paths and commands.
- Test changes in an isolated environment.
- Keep human review before merge/deploy.
Q96System design
How would you design an agent for customer data exports?
Treat export as a sensitive operation. Verify identity and purpose, scope the requested records, apply role and tenant…
Answer
Treat export as a sensitive operation. Verify identity and purpose, scope the requested records, apply role and tenant policies, show the export fields and destination, require approval where policy demands, and audit the final export and delivery.
Syntax
request → authenticate/authorize → scope and minimize → approval → generate securely → audit delivery
Example
Example: reject an export request that tries to include records outside the authenticated tenant.
Key Points
- Apply data minimization and access controls.
- Validate destination and approval.
- Securely expire temporary export files.
Q97System design
How would you design a research-and-action agent with a review step?
Separate information gathering, recommendation, and execution into distinct stages. Store source evidence and proposed…
Answer
Separate information gathering, recommendation, and execution into distinct stages. Store source evidence and proposed action details, present a reviewable summary, then revalidate current conditions and permissions before executing any approved mutation.
Syntax
research → evidence-linked recommendation → human review → revalidation → action → verification
Example
Example: the agent researches a vendor and drafts a purchase recommendation, but procurement approval is required before placing an order.
Key Points
- Separate research from execution.
- Preserve evidence and proposed action details.
- Revalidate after review and verify outcomes.
Q100Coding
How do you test a tool without calling a real external service?
Inject the dependency into the tool implementation and replace it with a mock or fake in unit tests. Verify argument…
Answer
Inject the dependency into the tool implementation and replace it with a mock or fake in unit tests. Verify argument mapping, error handling, authorization behavior, and output normalization; use separate integration tests for the real service contract.
Syntax
tool → injected dependency interface → mock in unit tests; real dependency in integration tests
Example
Example: mock the order client to return a known status and assert the tool maps it into a minimized response.
Key Points
- Use dependency injection.
- Test failures and unauthorized requests.
- Keep integration tests for service contracts.