Trace-Based Code Snippet Curation for Reliable LLM Agents

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Large language model (LLM) agents often require manual supervision to filter extraneous data and may produce incorrect results due to unreliable sequences of steps or code snippets that appear correct but are actually incorrect, especially in complex network troubleshooting and monitoring tasks.

Innovation Solution

A method for automatically curating reusable code snippets by storing function traces from past agent runs, determining acceptable groupings, and adding them to a database for LLM agents, combining automated generation with expert review to improve speed and reliability.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If LLM agents generate code snippets autonomously, then productivity is improved, but reliability deteriorates due to incorrect code snippets that appear correct

Engineering Contradiction:
Improvecode generation speedVSAvoidcode correctness
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent introduces an intermediary validation system consisting of a code interpreter and execution environment that acts as a mediator between the LLM agent's code generation and the actual task execution. This intermediary automatically evaluates generated code snippets for correctness, handles exceptions, and provides feedback to filter out incorrect code before it reaches production use, thereby maintaining high productivity while improving reliability through automated quality control.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If manual supervision is applied to filter extraneous data, then reliability is improved, but productivity deteriorates due to time-consuming review processes

Engineering Contradiction:
Improvedata filtering accuracyVSAvoidprocessing speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent implements a self-service automated validation system where the code interpreter and execution environment independently evaluate and filter code snippets without requiring manual human review. The system automatically executes code in a controlled environment, catches exceptions, and determines correctness, enabling the filtering process to serve itself rather than relying on external human supervision, thus maintaining high reliability while preserving processing speed.

Inventive Principle:
Principle #25Self-service

3Adaptability or versatility

If complex sequences of steps are used to handle network tasks, then functionality is improved, but reliability deteriorates due to unreliable step sequences

Engineering Contradiction:
Improvetask handling capabilityVSAvoidstep sequence reliability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent implements a feedback mechanism where the code interpreter evaluates the output of each step in the sequence and provides feedback to determine whether to proceed to the next step or retry/modify the current step. The execution environment monitors the state after each code execution and feeds this information back into the decision-making process, creating a closed-loop system that handles complex task sequences with improved reliability by dynamically adjusting based on actual execution results rather than blindly following predetermined step sequences.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS20250272070A1Automatic curation of reusable code snippets for LLM agents
Publication Date: 2025.08.28 CISCO TECHNOLOGY INC
  • US20250272070A1 patent drawing
  • US20250272070A1 patent drawing
  • US20250272070A1 patent drawing

AI summary

In one embodiment, a method herein may comprise: storing code-based functions in a database that is accessible to large language model agents for coding, wherein the code-based functions are associated with traces each relating to a respective question and a respective list of sequential code-based functions used to answer the respective question by a past agent run; determining one or more sequential groupings of the code-based functions that are candidates for corresponding reduction into a merged function; determining whether the merged function is acceptable; and adding, responsive to the merged function being acceptable, the merged function to the database of the code-based functions that are accessible to the large language model agents for coding.