From 2dae973c628194c12a36178e7866e8b2c7550816 Mon Sep 17 00:00:00 2001 From: Sypherd Date: Fri, 6 Jun 2025 10:44:45 +0100 Subject: [PATCH 1/2] Add snippet about error handling being removed from primary context --- content/factor-09-compact-errors.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/factor-09-compact-errors.md b/content/factor-09-compact-errors.md index 948c927a4..96da7a857 100644 --- a/content/factor-09-compact-errors.md +++ b/content/factor-09-compact-errors.md @@ -78,7 +78,9 @@ Benefits: I'm sure you will find that if you do this TOO much, your agent will start to spin out and might repeat the same error over and over again. -That's where [factor 8 - own your control flow](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-08-own-your-control-flow.md) and [factor 3 - own your context building](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-03-own-your-context-window.md) come in - you don't need to just put the raw error back on, you can completely restructure how it's represented, remove previous events from the context window, or whatever deterministic thing you find works to get an agent back on track. +That's where [factor 8 - own your control flow](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-08-own-your-control-flow.md) and [factor 3 - own your context building](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-03-own-your-context-window.md) come in - you don't need to just put the raw error back on, you can completely restructure how it's represented, remove previous events from the context window, or whatever deterministic thing you find works to get an agent back on track. + +Along with the last point, it is also important to consider when error handling calls should be abstracted away from the primary control flow and context window. For example, if a tool call fails and the agent retries twice before getting something that works, the erroneous outputs and error handling messages can often simply be replaced by the final successful output. This can help keep context usage down and reduce the risk of the agent getting distracted from the main goal. But the number one way to prevent error spin-outs is to embrace [factor 10 - small, focused agents](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-10-small-focused-agents.md). From a64208d89125e5162ba2379e3d13ae7bb6ad6e83 Mon Sep 17 00:00:00 2001 From: Sypherd Date: Tue, 15 Jul 2025 11:54:53 +0100 Subject: [PATCH 2/2] Combine suggestion with prior paragraph --- content/factor-09-compact-errors.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/factor-09-compact-errors.md b/content/factor-09-compact-errors.md index 96da7a857..87550ea34 100644 --- a/content/factor-09-compact-errors.md +++ b/content/factor-09-compact-errors.md @@ -78,9 +78,7 @@ Benefits: I'm sure you will find that if you do this TOO much, your agent will start to spin out and might repeat the same error over and over again. -That's where [factor 8 - own your control flow](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-08-own-your-control-flow.md) and [factor 3 - own your context building](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-03-own-your-context-window.md) come in - you don't need to just put the raw error back on, you can completely restructure how it's represented, remove previous events from the context window, or whatever deterministic thing you find works to get an agent back on track. - -Along with the last point, it is also important to consider when error handling calls should be abstracted away from the primary control flow and context window. For example, if a tool call fails and the agent retries twice before getting something that works, the erroneous outputs and error handling messages can often simply be replaced by the final successful output. This can help keep context usage down and reduce the risk of the agent getting distracted from the main goal. +That's where [factor 8 - own your control flow](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-08-own-your-control-flow.md) and [factor 3 - own your context building](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-03-own-your-context-window.md) come in - you don't need to just put the raw error back on, you can completely restructure how it's represented, remove previous events from the context window, or whatever deterministic thing you find works to get an agent back on track. Often, error handling calls can be completely removed from the primary control flow and context window. This can help keep context usage down and reduce the risk of the agent getting distracted from the main goal. But the number one way to prevent error spin-outs is to embrace [factor 10 - small, focused agents](https://github.com/humanlayer/12-factor-agents/blob/main/content/factor-10-small-focused-agents.md).