diff --git a/README.md b/README.md index 1be4051..378c517 100644 --- a/README.md +++ b/README.md @@ -899,6 +899,10 @@ Each context accumulates a graph trace that documents the path through the flow. | `M`, `S`, `L`, `HOT`, `COLD` | Model category short name | | agent name | Executed agent | | `○` | Completion skipped | +| `⏹` | Completion stopped because the token limit was reached | +| `⛔` | Completion stopped because the content was filtered | +| `🔧` | Completion stopped because the model returned tool calls | +| `❌` | Completion stopped because of an remote error | | `⇉ x/n` | Branch split x of n | | `size↣merged` | Merge size summary | | `→` | Next agent is a `COMPLETION` agent | diff --git a/src/main/java/de/extio/lmlib/agent/BaseAgent.java b/src/main/java/de/extio/lmlib/agent/BaseAgent.java index 5f3667f..450503a 100644 --- a/src/main/java/de/extio/lmlib/agent/BaseAgent.java +++ b/src/main/java/de/extio/lmlib/agent/BaseAgent.java @@ -202,6 +202,23 @@ public interface BaseAgent { split.context().getGraph().add("(" + durationMs + " ms)"); split.context().setLastCompletion(completion); split.context().getRequestStatistic().add(completion); + switch (completion.finishReason()) { + case TOKEN_LIMIT_REACHED: + split.context().getGraph().add("⏹"); + break; + case CONTENT_FILTERED: + split.context().getGraph().add("⛔"); + break; + case TOOL_CALLS: + split.context().getGraph().add("🔧"); + break; + case ERROR: + split.context().getGraph().add("❌"); + continue; + default: + break; + } + if (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) { if (toolCallRounds >= 6) { parseException = new IllegalStateException("Too many tool call rounds");