Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Prompt, context, harness, loop, and graph engineering address different failure modes in an LLM-assisted code repair. The distinction is practical: a prompt states the task, context supplies the information needed now, a harness gives the model real tools and verification, a loop uses failures to guide bounded retries, and a graph coordinates work and its dependencies. These are overlapping design questions, not necessarily separate products.

Consider a duration parser that turns 250ms into 250.0 instead of 0.25. Following that bug from request to workflow makes clear what each layer contributes—and what it cannot prove on its own.

Start by defining what the parser must do

The broken function looks plausible but strips characters rather than interpreting a unit:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
def parse_duration(value: str) -> float:
    return float(value.strip().rstrip("ms"))

In Python, rstrip("ms") removes any trailing characters that belong to the set {"m", "s"}; it does not recognize the suffix ms as a unit. As a result, 250ms becomes 250.0, and 2m becomes 2.0. The unit information has been discarded without converting the quantity.

#1 Best Overall
Five Star Spiral Notebook + Study App, 1 Subject, Graph Ruled Paper, 8-1/2" x 11", 100 Sheets, Fights Ink Bleed, Water Resistant Cover, Black (73679)
  • Ideal for graphing, charts and engineering projects.
  • 1-subject notebook. 100 double-sided, graph ruled sheets. 4 squares per inch.
  • Sheets measure 8-1/2 in. x 11 in. when torn out. Overall notebook size is 11 in. x 9-3/4 in. Tough pockets help prevent tears and hold 8-1/2 in. x 11 in. loose sheets.
  • High-grade paper fights ink bleed. Perforated pages for easy tear out. Front cover is water-resistant to help protect your notes all year.
  • Spiral Lock wire helps prevent snags on clothes and backpacks. Made with SFI approved paper. Recyclable - remove reinforcement tape on pocket and recycle the rest.

Before asking a model to repair the code, specify the contract. For this example, choose these application rules:

  • Accept a non-negative number written as digits, optionally followed by a decimal point and more digits, then exactly one of ms, s, or m.
  • Ignore whitespace before and after the whole input, but not between the number and unit.
  • Return the duration in seconds as a float.
  • Raise TypeError for non-string inputs and ValueError for malformed strings.

That contract makes 250ms equal to 0.25, 1.5s equal to 1.5, and 2m equal to 120.0. It rejects 5ss, -1s, +1s, 1e3s, 2 m, 2M, .5s, and 5.s. These are choices for this example, not a universal duration standard; an application may need a different grammar or range.

A contract-led implementation

A full-string match makes the accepted grammar explicit and prevents a valid-looking prefix from hiding extra characters:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import re

_DURATION = re.compile(r"([0-9]+(?:.[0-9]+)?)(ms|s|m)")
_FACTORS = {"ms": 0.001, "s": 1.0, "m": 60.0}

def parse_duration(value: str) -> float:
    if not isinstance(value, str):
        raise TypeError("duration must be a string")

    match = _DURATION.fullmatch(value.strip())
    if match is None:
        raise ValueError("duration must be a number followed by ms, s, or m")

    amount = float(match.group(1))
    unit = match.group(2)
    return amount * _FACTORS[unit]

The return annotation does not enforce the input type at runtime, so the explicit type check matters. The regular expression and fullmatch enforce the chosen syntax; the factor table performs the conversion. If an application also needs to reject extremely large values or guarantee a finite result, that should be added as a separate, explicit range rule.

Rank #2
Mead Spiral Notebook, 1 Subject, Graph Ruled Paper, 7-1/2" x 10-1/2", 100 Sheets, Black (05676AA5)
  • 1 subject notebook comes with 100 graph ruled, double-sided sheets with 5 squares per inch
  • Sheets measure 7-1/2" x 10-1/2" when torn out with an overall size of 8" x 10-1/2". Perforation easily tears out with clean edges.
  • Graph ruling is ideal for plotting graphs, drawing curves and more. Notebook is 3-hole punched to store in your favorite binder.
  • Covers are coated for durability and have writable label on front cover. Available in Black.
  • Assembled in U.S.A. with U.S. and foreign parts

What each engineering layer changes

The five labels are useful because they point to different levers. In a small repair, one person or one agent may handle all of them sequentially; the labels describe responsibilities, not a required stack of products.

Layer Question it answers Evidence or control it adds
Prompt What should be changed, and what constraints apply? Task instructions tied to the contract
Context What information is needed for this attempt? Current source, scope, contract, and verification state
Harness What can the model actually access or execute? Scoped tools and results from real tool execution
Loop How should a failed candidate be corrected? Concrete failure feedback, retry bounds, and stop conditions
Graph Which work depends on which other work? Explicit transitions and coordination against shared state

Prompt engineering: make the request testable

“Fix the timeout parser” gives a model a goal but leaves critical choices open: which units are supported, what the output unit is, whether signs or scientific notation are valid, and how malformed input should fail. Three happy-path examples can still leave the model free to accept inputs the application intends to reject.

A stronger prompt states the contract, compatibility boundaries, and expected response. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Repair parse_duration in the existing file.

Follow this contract exactly:
- Input must be a string.
- After trimming outer whitespace, accept only digits with an optional
  decimal fraction, immediately followed by ms, s, or m.
- Return seconds as a float.
- Raise TypeError for non-strings and ValueError for malformed strings.
- Preserve the public function name and signature.

Examples: 250ms -> 0.25, 1.5s -> 1.5, 2m -> 120.0.
Reject: 5ss, -1s, +1s, 1e3s, 2 m, 2M, .5s, and 5.s.
Make the smallest necessary change and report the files changed.
Do not claim tests passed unless you ran them.

This narrows interpretation; it does not demonstrate correctness. OpenAI’s prompt-engineering guidance recommends evaluating behavior with tests as prompts or model versions change. For code repair, the contract should therefore become executable checks rather than remain only prose.

Rank #3
Mead Spiral Notebook, 1 Subject, Graph Ruled Paper, 7-1/2" x 10-1/2", 100 Sheets, Green (05676AC5)
  • 1 subject notebook comes with 100 graph ruled, double-sided sheets with 5 squares per inch
  • Sheets measure 7-1/2" x 10-1/2" when torn out with an overall size of 8" x 10-1/2". Perforation easily tears out with clean edges.
  • Graph ruling is ideal for plotting graphs, drawing curves and more. Notebook is 3-hole punched to store in your favorite binder.
  • Covers are coated for durability and have writable label on front cover. Available in Green.
  • Assembled in U.S.A. with U.S. and foreign parts

Context engineering: preserve the state that matters now

Prompt wording says what to do. Context engineering selects and maintains the information the model needs to do it correctly on the current candidate. For this parser, useful context includes the accepted grammar, current implementation, allowed edit scope, and the latest verification result.

If the repair is handed to another attempt, carry forward a compact record with:

  • The contract and relevant source files.
  • The identity of the candidate, such as a commit identifier or content fingerprint.
  • Files changed and the last verification command or procedure actually executed.
  • The observed result, including failing cases, unresolved issues, and remaining retry budget.

A summary is not a substitute for the underlying evidence. Distinguish observed facts—such as a test output—from a proposed fix or a claim that work is complete. When source changes, earlier test results may no longer describe the current candidate; handoff records should make clear which version was checked.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Harness engineering: give tools real capabilities

A harness is the runtime around the model: it can route tool calls, limit file access, and invoke a test runner. OpenAI’s description of harness engineering emphasizes making capabilities and relevant system information legible to agents and organizing work into smaller stages such as design, coding, review, and testing.

Rank #4
Five Star Spiral Notebook + Study App, 1 Subject, Graph Ruled Paper, 8-1/2" x 11", 100 Sheets, Fights Ink Bleed, Water Resistant Cover, Tidewater Blue (06190AA4)
  • LASTS ALL YEAR. GUARANTEED!* Water resistant covers protect your notes all year.
  • High-quality paper resists ink bleed** so notes stay clear and legible. Notebook has 100 graph ruled sheets, 4 squares per inch.
  • Includes storage pocket to hold loose sheets from the notebook. Patented, reinforced storage pocket helps prevent tears.***
  • Spiral Lock wire prevents coil snags so it won’t get caught on your clothes or backpack. The Neat Sheet perforated pages easily tear out with clean edges.
  • Perforated sheets measure 11" x 8-1/2" when torn out. Overall size of 11" x 9 1/8". Available in Teal.

For this repair, a practical harness might allow edits only in the intended module, expose the relevant tests, and run those tests through an actual tool. The distinction between a requested action and an executed action is essential: a model saying “the tests pass” is not test evidence unless the harness ran them and captured the result. Anthropic’s Managed Agents harness is one example discussed in this area, but the general principle does not depend on any particular service.

Loop engineering: make retries bounded and evidence-driven

A repair loop turns a failed check into the next attempt’s input. Suppose the first candidate converts units correctly but accepts 1e3s, contrary to the contract. Useful feedback names the observed counterexample and expected result: the parser must raise ValueError for 1e3s. “Try harder” supplies neither diagnosis nor a testable requirement.

A controller for the loop should define when work stops before it begins:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Set a maximum retry count or time budget.
  • Stop if the candidate and failure are unchanged across attempts.
  • Pass the current failure output and contract to the next attempt.
  • Escalate unresolved or ambiguous failures rather than reporting success.

Model self-review can suggest a likely correction, but it does not replace external verification. A loop is useful only when its feedback reflects checks that actually ran.

Best Value
SUNEE Spiral Notebook, 1-Subject, Graph Ruled Paper, 8" x 10-1/2", 100 Sheets per Notebook, 3-Hole Punched Paper, Water Resistant Cover, Spiral Grid Notebooks for Work, Home, School, Writing, Black
  • SUNEE 1 SUBJECT NOTEBOOK: Single subject spiral notebook with 100 sheets/200 Pages of graph paper, you'll have plenty of space for notes and assignments. Get the best value with our graph paper notebook and stay organized.
  • GRAPH NOTEBOOK: Each 8" x 10-1/2" grid notebook features 100 double-sided sheets with red margin lines and is 3-hole punched, easily transfer to your favorite binder. It's the ideal grid paper notebook for all your academic and professional needs.
  • 3-HOLE PUNCHED DESIGN: Designed with 3-hole punched graph paper, this math notebook integrates seamlessly into standard binders; Perfect for who need to keep their notes organized in one place, notebook grid clutter in your study or work area.
  • CLEAN TEAR-OUT: Micro-perforated pages ensure a neat tear-out, leaving you with 10 1/2" x 7 1/2" sheets. Accommodates double-sided writing. Sunee graph paper spiral notebook offers premium quality at an affordable price. A graphing notebook is perfect for students, teachers, and professionals.
  • DURABLE & FUNCTIONAL DESIGN: Water-resistant plastic cover provides extra protection, making this spiral graph paper notebook ideal for on-the-go, frequent transfers in and out of backpacks, briefcases, and vehicles. The double-sided pockets are great for storing loose papers and handouts, making this one subject graph spiral notebook a practical choice for students and professionals.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Graph engineering: coordinate work against one candidate

Here, graph engineering means an executable workflow in which nodes represent work and edges define permitted transitions. It is not the same thing as a retrieval knowledge graph. A retrieval system could provide information to a node in an execution graph, but the two graphs solve different problems.

For the parser repair, a small workflow can use six nodes:

Node Role
implement Create a candidate that follows the contract.
verify Run executable checks against the candidate.
review Inspect the change for contract gaps or unintended edits.
join Confirm both results apply to the same candidate before proceeding.
repair Use failures to create a new candidate, which invalidates prior approvals.
human Pause for a decision when the workflow is blocked or a requirement is unclear.

verify and review can run concurrently if neither edits the candidate. Their results must be joined against the same frozen version. If repair changes the code, old verification and review results no longer authorize the new version; both checks need to run again. A candidate fingerprint or immutable revision identifier lets the workflow enforce that rule instead of relying on a summary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The repair edge creates a cycle, so the graph needs the same retry limit and repeated-failure detection as any other loop. LangGraph is one framework for defining stateful, multi-step workflows. LangChain’s reference describes graph nodes broadly: “A node can be deterministic code, a single LLM call, a tool call, or a full agent with its own internal loop.” A graph therefore does not mean every step needs to be an autonomous agent.

When to add another layer

Choose the smallest workflow that satisfies the actual requirements. Each added mechanism brings operational work—more calls and latency, test execution, persistent state, scheduling, recovery paths, and maintenance. The available descriptions establish these as design costs, not a measured cost or performance comparison.

  • Begin with a clear contract, appropriately scoped editing, and executable verification.
  • Add a bounded repair loop when failed candidates need repeated correction from specific test or review feedback.
  • Add graph orchestration when independent checks, branching work, or resumable handoffs create a real coordination need.
  • Keep the work sequential when one agent or person can perform it reliably and there is no meaningful dependency to coordinate.

The practical distinction is what you change when the system fails: the request, the information available, the runtime capabilities, the feedback cycle, or the coordination model. Pick the layer that addresses the observed failure rather than adding orchestration for its own sake.

Quick Recap

Bestseller No. 1
Five Star Spiral Notebook + Study App, 1 Subject, Graph Ruled Paper, 8-1/2' x 11', 100 Sheets, Fights Ink Bleed, Water Resistant Cover, Black (73679)
Five Star Spiral Notebook + Study App, 1 Subject, Graph Ruled Paper, 8-1/2" x 11", 100 Sheets, Fights Ink Bleed, Water Resistant Cover, Black (73679)
Ideal for graphing, charts and engineering projects.; 1-subject notebook. 100 double-sided, graph ruled sheets. 4 squares per inch.
$6.00
Bestseller No. 2
Mead Spiral Notebook, 1 Subject, Graph Ruled Paper, 7-1/2' x 10-1/2', 100 Sheets, Black (05676AA5)
Mead Spiral Notebook, 1 Subject, Graph Ruled Paper, 7-1/2" x 10-1/2", 100 Sheets, Black (05676AA5)
1 subject notebook comes with 100 graph ruled, double-sided sheets with 5 squares per inch
Bestseller No. 3
Mead Spiral Notebook, 1 Subject, Graph Ruled Paper, 7-1/2' x 10-1/2', 100 Sheets, Green (05676AC5)
Mead Spiral Notebook, 1 Subject, Graph Ruled Paper, 7-1/2" x 10-1/2", 100 Sheets, Green (05676AC5)
1 subject notebook comes with 100 graph ruled, double-sided sheets with 5 squares per inch
$5.00

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.