Skip to content

Agent debug accessibility #2485

Description

@brady-stacks

Agents can write and run Clarity tests via the SDK, but when something goes wrong, they have no visibility into why, they only see the final error. Giving agents access to execution traces and the debug adapter would let them reason about contract behavior the same way a developer does with a debugger.

Problem

When an agent calls session.callPublicFn(...) and gets an unexpected result, it has no way to inspect what happened inside the contract. It can only re-read source code and guess. Interactive debugging via DAP is designed for humans, not agents.

Proposed solution(s)

(in order of implementation effort)

  1. Execution traces on every call

Extend callPublicFn / eval responses to include an optional structured trace: each subexpression evaluated, its result, any state mutations (maps written, variables updated). Agents can read this trace to understand exactly what the contract did without needing an interactive debugger.

  1. MCP server (clarinet mcp serve)

Expose the debug SDK as an https://modelcontextprotocol.io server so agents can call tools like deploy_contract, call_function, get_trace, get_state directly. This is the most natural interface for AI agents and works with any MCP-compatible client

  1. Extended SDK protocol with DAP event relay

Push DAP events (breakpoints hit, step results, variable state) over the existing SDK TCP socket so a non-interactive client can receive them. This would let an agent set breakpoints and inspect state at specific points without a human-driven debugger UI.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions