[Feature Request] Agent V2: Support viewing execution logs (tool calls, intermediate reasoning steps)
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
## 1. Is this request related to a challenge you're experiencing? Tell me about your story.
When using **Agent V2** (Agents app type) in Dify 1.17.x, there is **no way to view execution logs**. The log detail panel only shows conversation ID, messages, and feedback controls — but does not expose any per-message trace details such as:
- Tool calls (which tools were invoked, with what parameters, and what they returned)
- Intermediate reasoning steps (the agent's thought process between tool calls)
- Token usage and latency per step
- Error traces for failed tool calls
A log icon does appear when hovering over a message in the Logs page, but clicking it does nothing — no dialog opens, no error is shown. (This specific UI bug is tracked in #40761.)
This makes **debugging Agent behavior extremely difficult**. When an Agent produces unexpected results, there is no way to inspect which tool was called, what data it returned, or where the reasoning went wrong. For production use cases — especially when agents call custom plugins or external APIs — this lack of observability is a significant blocker.
**What's needed:** Agent V2 should support viewing execution logs with at least the same level of detail as the legacy Agent app type, including:
1. **Per-message agent traces** — tool name, input parameters, output/return value, and status for each tool invocation
2. **Intermediate reasoning steps** — the agent's chain of thought between tool calls (Visible Thought / ReAct traces)
3. **Per-step metrics** — token usage, latency, and timestamps for each agent iteration
4. **Error details** — when a tool call fails, the error message and stack trace should be visible in the log
## 2. Additional context or comments
- **Backend already records the data:** PR #38592 added per-call tool thought recording on the backend side. The data exists — it's just not surfaced in the Agent V2 log UI.
- **PR #39858 introduced the gap:** This PR explicitly removed `showPromptLog` and the shared `MessageLogModal`/`AgentLogModal` dialogs from the Agent V2 log view, replacing them with a dedicated side panel (`AgentLogDetailPanel`). However, the side panel only maps query/answer pairs with basic metadata (latency, tokens, time) via `formatAgentLogMessages` — it does not wire up `agent_thoughts` or tool-call trace data.
- **Feature parity with legacy Agent:** The legacy Agent app type had full execution log viewing support via `MessageLogModal`/`AgentLogModal`, showing tool calls, intermediate steps, and per-iteration details. Agent V2 should achieve feature parity.
- **Related issue:** #40761 covers the specific UI bug where the log icon is visible but non-functional (clicking it either does nothing or leaks a stale `showPromptLogModal` state to the Studio page). This feature request is broader — it asks for proper execution log viewing support in Agent V2, regardless of the icon behavior.
**Environment:**
- Dify version: 1.17.x
- Deployment: Self Hosted (Docker)
## 3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
Contributor guide
Research direction
Start with the AgentLogDetailPanel and formatAgentLogMessages introduced around PR #39858, then compare the legacy MessageLogModal and AgentLogModal behavior. Trace how backend agent_thoughts and tool-call data from PR #38592 reaches the Agent V2 log view. Done means logs expose tool inputs and outputs, reasoning steps, per-step metrics, and tool errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, frontend, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100