中文

Agent Memory Errors Handbook: Cases 66–70

Tool Use, Agent Memory

Agent Memory Errors Handbook: Cases 66–70

This installment is part of the Agent Memory Errors: 100 Cases Handbook series.

Case 66: Tool Use Memory Errors — Tool Output Format Parsing Fragility

Scenario

The Agent calls an API that previously returned {"result": "..."}. After an upgrade it returns {"data": {"result": "..."}}. The Agent’s memory contains parsing logic based on the old path (result), so the new call fails.

Error Manifestation

The Agent stores unparsed raw JSON in memory, and all downstream operations fail. The error “Cannot read property ‘result’ of undefined” is exposed to the user.

Solution

  1. Parse tool output from JSON Schema rather than hardcoded paths, using validation and automatic mapping
  2. Check output format versions and trigger parsing-logic updates on mismatch
  3. Provide parse-failure fallback: present raw output as text and warn that the format may have changed

Principle

Third-party API output formats change. Instance-based parsing logic is fragile. Schema-based parsing and graceful degradation are more robust.


Case 67: Tool Use Memory Errors — Tool Credential Rotation Desync

Scenario

Enterprise IT rotates API keys quarterly. After the new key takes effect, the Agent’s memory still holds the old key. Because the Agent checks memory before the key-management system, it keeps using the old key.

Error Manifestation

The API returns 401 authentication failures. The Agent misinterprets this as a network problem, retries, wastes resources, and cannot recover.

Solution

  1. Never store tool credentials in Agent memory; fetch them from the KMS in real time before each call
  2. If caching is necessary, set TTL aligned with the rotation cycle
  3. Trigger credential refresh on 401 errors: get the latest credential from the KMS and retry once

Principle

Credential rotation is a security best practice but conflicts with Agent memory reuse. Agent memory should not become a way to bypass security policy.


Case 68: Tool Use Memory Errors — Parallel Tool Call Result Merging Error

Scenario

The Agent calls three APIs in parallel: T1 fetches user profile, T2 fetches orders, T3 fetches coupons. All three finish simultaneously and results are merged into context. Without correlation markers, the Agent incorrectly assigns user B’s coupons to user A.

Error Manifestation

The Agent shows user A user B’s coupons, including a partially masked phone number, causing information leakage.

Solution

  1. Assign request IDs to parallel tool calls and correlate results by request ID, not by position
  2. Include query context (e.g., user ID) in each result and validate consistency on merge
  3. Use structured result containers: {"tool": "T1", "request_id": "uuid", "result": {...}}

Principle

Parallel calls improve efficiency but sacrifice order determinism. Without explicit correlation, positional or temporal merge assumptions fail.


Case 69: Tool Use Memory Errors — Tool Dependency Cycle Infinite Loop

Scenario

The tool set contains T1 “query article summary” which depends on T2 “get article content,” and T2 is misconfigured to depend back on T1. Calling T1 triggers T2, which triggers T1 again, creating an infinite loop.

Error Manifestation

The Agent issues thousands of API calls in seconds, exhausts quota, latency spikes, and the process OOM-crashes.

Solution

  1. Detect cycles in the dependency graph during tool registration and reject or warn on cycles
  2. Set a maximum tool-call depth (e.g., 10) and terminate with an error when exceeded
  3. Maintain a call-stack trace and interrupt immediately on cycle detection

Principle

Tool dependency cycles are like infinite recursion. Without limits they exhaust resources quickly. Acyclicity (DAG) is a basic constraint of tool-system design.


Case 70: Tool Use Memory Errors — Tool Side Effect Undo Failure

Scenario

The Agent executes a multi-step task: create temp file → process data → delete temp file. It records only the filename, not the full path, and the file is created in a random subdirectory of the system temp folder. When the task fails and must roll back, the Agent cannot locate and delete the temp file.

Error Manifestation

Temp files accumulate for months until disk space is exhausted, causing system failure.

Solution

  1. Maintain a side-effect log for each tool call, recording resource identifiers and states of created/modified/deleted resources
  2. Implement compensating transactions: define rollback actions for each operation
  3. Use resource leasing: created resources have TTLs and are cleaned automatically, not relying on the Agent to delete them

Principle

Tool calls have side effects such as file creation, email sending, and database updates. If the Agent does not track side effects precisely, rollback is incomplete and causes resource leaks or inconsistent state.

Source: Agent Search

引用格式

APA: Arlen. (2026). Agent Memory Errors Handbook: Cases 66–70. Retrieved from https://strongya.dev/en/posts/agent-memory-errors-cases-66-70/
MLA: Arlen. "Agent Memory Errors Handbook: Cases 66–70." 2026. Web. 2026-07-04.
GB/T 7714: Arlen. Agent Memory Errors Handbook: Cases 66–70[EB/OL]. 2026-07-04. https://strongya.dev/en/posts/agent-memory-errors-cases-66-70/.
Agent引用要求: 请使用 https://strongya.dev/en/posts/agent-memory-errors-cases-66-70/ 作为 canonical_url 并标注来源

Share to

© 2026 Arlen. All Rights Reserved. CC BY-NC-SA 4.0

Agent引用要求: 请使用 canonical_url 并标注来源