Termination Conditions

Termination Conditions

Defining when to stop.

Termination Conditions

How does an agent know it is done?

Explicit vs Implicit

  • Implicit: The LLM says "I am done." (Risky. It might lie or be lazy).
  • Explicit: The Tool validates the work.
def check_completion(state):
    # Don't ask the LLM "Are you done?"
    # Ask the filesystem "Does file.txt exist?"
    if os.path.exists("report.pdf"):
        return "END"
    return "continue"

Build graphs where the Exit Condition depends on the Environment (tools), not just the Language Model's opinion.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn