The Deska blog
Agent Observability: Logging What the Model Did
Master agent observability by logging model actions, hidden thoughts, and tool calls. Learn how to debug AI agents using trace logs and real-time monitoring.
· 10 min read
The shift from static code to autonomous agents introduces a visibility crisis for developers. In traditional software, tracing a bug involves following a deterministic stack trace. In the world of Large Language Models (LLMs), errors are often non-deterministic, latent, or buried inside hidden reasoning steps. Effective agent observability requires logging what the model did at every stage of the execution, from the initial prompt to the final tool call. Without this granularity, developers are left guessing why an agent hallucinated a file path or failed to complete a recursive loops.
The Anatomy of Agent Execution
To build a reliable observability stack, one must understand how an agent processes a task. Unlike a simple chat completion, an agentic workflow involves a cycle of reasoning, acting, and observing. Each turn in this cycle generates data that is vital for debugging.
- Thought process: The internal chain of thought or reasoning steps the model takes before deciding on an action.
- Tool invocations: The specific function calls, including arguments and schemas, sent to external environments.
- Environment feedback: The raw output from a terminal, a browser, or a file system returned to the model.
- State transitions: How the agent memory or context window changes after each interaction.
Traditional logging often misses these intermediate steps. Simply logging the final output is insufficient because the error usually occurs four steps prior during a failed tool execution.
Trace Logs vs. Application Logs
General application logs tell you that a service is running. Trace logs for agents tell you why a specific decision was made. When choosing a method for agent observability, developers must distinguish between these two layers.
| Log Type | Data Points | Primary Use Case |
|---|---|---|
| Application | Memory usage, Latency, Errors | Infrastructure health |
| Trace | Prompt versions, Tool args | Logic debugging |
| Feedback | Human corrections, Success | Model fine-tuning |
Tracing identifies where the chain broke. If an agent loops infinitely, the trace log reveals if it is repeating the same thought or if it is receiving inconsistent feedback from a terminal. Tools that provide a local-first approach to these logs are often preferred for security, as agent traces can contain sensitive source code or proprietary business logic.
Implementing Observability in Development
The best time to implement observability is during the initial setup of the developer environment. Instead of relying on cloud consoles that might delay log updates, developers often benefit from watching agent behavior in real-time.
A common pattern is to run multiple agents side-by-side to compare their reasoning. For example, using coding agents like Claude Code and Codex CLI simultaneously allows you to see how different models approach the same debugging task. If one succeeds and the other fails, the logs will highlight the divergence in their tool usage strategies.
Effective observability also requires a workspace that can handle high-density information. When an agent executes a command, the developer needs to see the terminal output, the updated code, and the reasoning logs at once. An infinite canvas setup facilitates this by allowing panels to be placed anywhere without the constraints of a traditional tabbed interface. This spatial organization makes it easier to spot correlations between a model's log entry and a side effect in the file system.
Challenges with Hidden Reasoning
Many modern models use hidden reasoning tokens. While these improve performance, they create a black box for the developer. Observability strategies must include methods to capture these thoughts when the API allows it. If the model reasoning is hidden, developers should rely on verbose logging of the "Observation" phase.
For instance, if an agent fails to edit a file, the log should capture the exact diff it attempted. By using code-git-files tracking, developers can see the delta between what the agent thought it did and what actually landed on the disk.
Observability in Different Environments
The requirements for logging change based on where the agent is running.
- Local Development: High-frequency logs, frequent interruptions, and manual overrides.
- Staging/CI: Automated evaluation of logs against expected outcomes.
- Mobile/Remote: The need to monitor work from your phone through secure relays to check if a long-running agent task finished correctly.
In a mobile context, observability is less about deep debugging and more about status checks. A mobile app that pairs directly with the desktop allows you to view agent threads and logs without exposing ports to the internet. This maintains the local-first integrity of the data while providing the flexibility of remote monitoring.
Using Deska for Agent Monitoring
Deska provides a specialized environment for running and observing AI agents. Because it is a desktop app for Mac, Windows, and Linux, it keeps all your sensitive data and storage local.
The workspace allows you to run panels for terminals and the Monaco code editor side by side. When you use one of the integrated agents, their actions are visible in real-time. You can use Ask Deska to drive the workspace, asking the assistant to open logs or check the status of specific agent threads.
One of the strengths of this approach is the ability to zoom out on the canvas to see the entire history of an agent interaction. By placing different browser widgets and notes next to the agent terminal, you create a visual trace of the project evolution. This reduces the cognitive load of tracking what the model did over a long session.
Effective Logging Strategies
To maximize the utility of your logs, follow these practices:
- Capture Raw Payloads: Always log the exact JSON sent to and from the model.
- Timestamp Everything: Agentic loops can be fast; microsecond precision helps order concurrent tool calls.
- Version Your Prompts: Log the system prompt version used for every session to identify regressions.
- Metadata Tagging: Tag logs with the specific workspace or project ID for easier filtering later.
By centralizing these logs in a tool that supports both voice commands and chat, developers can interact with their observability data naturally. Instead of grepping through text files, you can ask the workspace assistant to find the last failed tool call.
FAQ
How to debug AI agents?
Debugging agents requires capturing the full trace of reasoning, tool calls, and environment responses. You should use a side-by-side view to compare what the agent intended to do against the actual result in the terminal or code editor.
What is the best tool for agent observability?
The best tool depends on your privacy needs. For local development, a local-first workspace that runs agents as panels allows you to keep logs on your machine while providing a high-density canvas for viewing the execution history.
Why do AI agents get stuck in loops?
Agents loop when the feedback from the environment does not change their internal state or when the reasoning model fails to recognize it has already tried an action. Detailed logging of tool outputs is necessary to identify and break these infinite loops.
Start Building Smarter Agents
Better observability leads to faster iterations and more resilient AI integrations. By focusing on detailed logging and spatial organization of your development environment, you can move from guessing to knowing exactly how your models behave. Explore the possibilities of a multi-agent canvas and download the app to begin building with total visibility.