You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/08-Plugins/01-agent.md
+210-1Lines changed: 210 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -284,6 +284,216 @@ Each item in `modes` defines a user-selectable preset in the chat UI. The select
284
284
285
285
The plugin adds a chat surface to the admin UI, keeps session history per admin user, and shows a mode picker when `modes` are configured.
286
286
287
+
## Debugging agent turns
288
+
289
+
Agent debug traces are optional and are intended for auditability and debugging. When enabled, they let you reconstruct why an agent produced a response or made a change by storing the full execution sequence for the turn: LLM steps, tool calls, tool inputs and outputs, token usage, and cache information.
290
+
291
+
By default, only the user prompt and agent response are persisted. Full debug traces are not stored unless you configure a `debugField`, because they can be large and may significantly increase database size.
If you use SQLite with Prisma, store the same field as text:
400
+
401
+
```prisma title="./schema.prisma"
402
+
model turns {
403
+
id String @id
404
+
session_id String
405
+
created_at DateTime
406
+
prompt String?
407
+
response String?
408
+
debug String? //diff-add
409
+
}
410
+
```
411
+
412
+
AdminForth should still define this resource column as `AdminForthDataTypes.JSON`; the SQLite connector serializes it into the text column and parses it back for the renderer.
The `debugField` value must match the turns resource column name. You can use another column name, but then use the same name in the resource, database schema, and `debugField`.
debugSequences.value.reduce((sum, sequence) => sum + sequence.toolCalls.length, 0),
490
+
);
491
+
const totalCachedTokens = computed(() =>
492
+
debugSequences.value.reduce((sum, sequence) => sum + sequence.cachedTokens, 0),
493
+
);
494
+
</script>
495
+
```
496
+
287
497
# Using with self-hosted models
288
498
289
499
`CompletionAdapterOpenAIResponses` when works with agent plugin, under the hood uses the LangChain internal proxy called `OpenAIChat` (in LangChain they call it "provider"). This proxy is capable with a fresh versions of OpenAI-compatible Responses APIs, for example [self-hosted latest versions of vLLM installations](https://devforth.io/insights/self-hosted-gpt-real-response-time-token-throughput-and-cost-on-l4-l40s-and-h100-for-gpt-oss-20b/)
@@ -793,4 +1003,3 @@ services:
793
1003
If Cloudflare returns a 403 response with `cf-mitigated: challenge` for `<baseURL>/adminapi/v1/agent/speech-response`, the request was blocked before it reached AdminForth. Create a WAF or bot rule exception for authenticated requests to this endpoint, because browser `fetch` calls with `multipart/form-data` cannot complete an HTML challenge page.
0 commit comments