Claude Code (Custom)

Use Claude Code for AI-powered analysis and troubleshooting

Overview

This node integrates with Claude Code, an AI-powered tool, to send prompts and receive responses for analysis and troubleshooting. It is useful for scenarios where users want to leverage AI models to generate insights, code analysis, or conversational responses based on a given prompt. For example, it can be used to query AI models for code review, debugging assistance, or generating text based on user input.

Use Case Examples

  1. Sending a code snippet as a prompt to get AI-generated suggestions or fixes.
  2. Using the node to interact with different Claude models (Sonnet or Opus) for varied AI responses.
  3. Configuring maximum conversation turns and timeout to control interaction length and response time.

Properties

Name Meaning
Prompt The prompt to send to Claude Code, which is the main input for the AI model to process and respond to.
Model The Claude AI model to use for the query, either 'Sonnet' or 'Opus', which may differ in capabilities or response style.
Max Turns Maximum number of conversation turns allowed in the interaction with Claude Code.
Timeout (seconds) Maximum time in seconds to wait for a response from Claude Code before timing out.
Output Format Format of the output returned by the node, which can be plain text, messages, or the full response object.

Output

JSON

  • result - The main response text or data returned from Claude Code.
  • duration - The time in milliseconds taken to get the response from Claude Code.
  • model - The Claude model used for the query.
  • prompt - (Only in full response) The prompt that was sent to Claude Code.
  • maxTurns - (Only in full response) The maximum conversation turns configured for the query.

Dependencies

  • Requires the 'claude' CLI tool to be installed and accessible in the system PATH.

Troubleshooting

  • If the node fails with an error indicating the 'claude' CLI could not be spawned, ensure that the 'claude' command line tool is installed and available in the system PATH environment variable.
  • Timeout errors may occur if the response from Claude Code takes longer than the configured timeout; increase the timeout parameter if needed.
  • Errors with exit codes from the 'claude' CLI indicate issues with the prompt or model parameters; verify the inputs are correct and supported.

Discussion