Claude Code icon

Claude Code

Use Claude Code SDK to execute AI-powered coding tasks with customizable tool support

Overview

This node integrates with the Claude Code AI SDK to perform AI-powered coding tasks through conversational interactions. It allows users to send prompts or instructions to Claude Code, which can generate code snippets, analyze projects, or assist with programming-related queries. The node supports starting new conversations or continuing previous ones, enabling iterative development and refinement.

Common scenarios include:

  • Generating code functions or scripts based on natural language prompts.
  • Automating code review or refactoring suggestions.
  • Running AI-assisted project analysis within a specified directory.
  • Using built-in tools like file editing, web search, or command execution to enhance coding workflows.

For example, you might prompt the node with "Create a Python function to parse CSV files" and receive a structured response containing the generated code, messages exchanged, and usage metrics.

Properties

Name Meaning
Prompt The instruction or question sent to Claude Code. Supports expressions to dynamically use data from previous nodes. Example: "Create a Python function to parse CSV files"
Model Selects the Claude model to use:
- Sonnet: Fast and efficient for most tasks
- Opus: More capable for complex tasks
Max Turns Maximum number of conversation turns (back-and-forth exchanges) allowed in the session.
Timeout Maximum time in seconds to wait for the AI completion before aborting the operation.
Project Path Directory path where Claude Code should run, allowing it to access files and execute commands in that location. If empty, uses the current working directory. Example: /home/user/projects/my-app
Output Format Determines the format of the output data:
- Structured: Returns an object with messages, summary, result, and metrics
- Messages: Raw array of all messages exchanged
- Text: Only final result text
Allowed Tools Built-in tools Claude Code is permitted to use during execution. Options include: Bash, Edit, Exit Plan Mode, Glob, Grep, LS, MultiEdit, Notebook Edit/Read, Read, Task, Todo Write, Web Fetch/Search, Write
Additional Options Collection of optional settings:
- System Prompt: Extra context or instructions for Claude Code
- Require Permissions: Whether tool use requires explicit permission
- Debug Mode: Enable debug logging

Output

The node outputs JSON data structured according to the selected Output Format:

  • Structured:
    An object containing:

    • messages: Array of all exchanged messages (user, assistant, system).
    • summary: Counts of user messages, assistant messages, tool uses, presence of results, and available tools.
    • result: The final result text or error message.
    • metrics: Performance data such as duration in milliseconds, number of turns, cost in USD, and usage details.
    • success: Boolean indicating if the operation succeeded.
  • Messages:
    A raw array of all messages exchanged during the conversation, including types and content.

  • Text:
    Only the final result text string, along with metadata fields like success status, duration, and cost.

If the node were to output binary data (not indicated here), it would typically represent files or code artifacts generated by Claude Code.

Dependencies

  • Requires an API key credential for authenticating with the Claude Code service.
  • Uses the official Claude Code SDK (@anthropic-ai/claude-code) for communication.
  • Node configuration may require setting appropriate timeout values and specifying the working directory for project-related operations.
  • Debug mode can be enabled for detailed logging during execution.

Troubleshooting

  • Empty Prompt Error: The node throws an error if the prompt is empty or only whitespace. Ensure the prompt property is set with meaningful instructions.
  • Timeout Errors: If the operation exceeds the configured timeout, an abort error occurs. Increase the timeout value in seconds under Additional Options if needed.
  • Permission Issues: When requiring permissions for tool use, some operations may fail if not explicitly allowed. Adjust the "Require Permissions" option accordingly.
  • API or Network Failures: General execution errors may occur due to network issues or invalid API credentials. Verify connectivity and authentication setup.
  • Debugging: Enable debug mode to get console logs showing prompt snippets, model selection, allowed tools, message types received, and timing information to help diagnose problems.

Links and References

Discussion