Skip to content

chore: tool debugging - #63

Open
Akatuoro wants to merge 4 commits into
mainfrom
feat/debug-tool-calls
Open

chore: tool debugging#63
Akatuoro wants to merge 4 commits into
mainfrom
feat/debug-tool-calls

Conversation

@Akatuoro

Copy link
Copy Markdown
Contributor

TODO: proper error logging... currently the errors get silently swallowed by the tools themselves or some other middleware

@hyperspace-pr-bot

Copy link
Copy Markdown

Summary

The following content is AI-generated and provides a summary of the pull request:


Add Tool Debug Middleware for Agent Tool Call Logging

Description

This PR introduces a new debug middleware for agent tool calls to improve observability and troubleshoot issues where tool errors were previously silently swallowed.

Changes:

  • lib/agents/middleware/tool-debug.js (new file): Implements a toolDebugMiddleware using LangChain's createMiddleware. It wraps each tool call to log:

    • The tool name and arguments before execution
    • Successful completion or error results after execution
    • Any thrown exceptions
  • lib/agents/middleware/index.js: Integrates the new debug middleware into the middleware pipeline. The middleware is only activated when debug logging is enabled (LOG._debug), ensuring zero overhead in production environments.

Usage:

Enable debug logging for the agents logger (e.g., via CDS log configuration) to activate tool call tracing:

DEBUG=agents

Category

🐛 Bug Fix / 🔧 Chore — Adds debug-level visibility into tool execution to surface previously hidden errors.

Have you...

  • Added relevant entry to the change log?

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.29.47

  • LLM: anthropic--claude-4.6-sonnet
  • Summary Prompt: Default Prompt
  • Output Template: Repository PR Template
  • File Content Strategy: Full file content
  • Event Trigger: pull_request.opened
  • Correlation ID: 2b70d3f0-a156-11f1-9654-64fa7ba4785b

@schiwekM schiwekM changed the title tool debugging chore: tool debugging Aug 27, 2026
@schiwekM
schiwekM marked this pull request as ready for review August 27, 2026 08:07
@schiwekM
schiwekM requested a review from a team as a code owner August 27, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants