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 and receive responses that can include code generation, file edits, command execution, and more. The node supports continuing previous conversations, enabling multi-turn dialogues for complex coding workflows.
Common scenarios where this node is beneficial include:
- Automating code generation based on natural language prompts.
- Iteratively refining code by continuing a conversation with the AI.
- Running AI-assisted project management tasks such as searching files, editing code, or managing todos within a specified project directory.
- Using built-in tools like bash commands, file operations, and web searches to augment AI capabilities.
Practical example:
- A user sends a prompt to create a Python function to parse CSV files.
- The node returns generated code and optionally executes file edits or commands in the project directory.
- The user continues the conversation to refine the function or add error handling.
Properties
| Name | Meaning |
|---|---|
| Prompt | The instruction or query sent to Claude Code. Supports expressions to dynamically use data from previous nodes. |
| 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 back-and-forth conversation turns allowed during the interaction. |
| Timeout | Maximum time (in seconds) to wait for the AI response before aborting the operation. |
| Project Path | Directory path where Claude Code runs, allowing access to project files and commands. If empty, uses current working directory. |
| Output Format | Format of the output data: ⢠Structured ā Returns an object with messages, summary, result, and metrics. ⢠Messages ā Returns raw array of all exchanged messages. ⢠Text ā Returns only the 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 extra settings: ⢠System Prompt ā Additional context or instructions for Claude Code. ⢠Require Permissions ā Whether tool usage requires explicit permission. ⢠Debug Mode ā Enables 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.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 including duration (ms), number of turns, cost, and usage statistics.success: Boolean indicating if the operation succeeded.
Messages: Raw array of all messages exchanged during the conversation, including user inputs, assistant replies, and tool usage events.
Text: Only the final result text from the AI, along with success status, duration, and cost metadata.
If the AI uses any binary data (not evident in this code), it would be summarized accordingly, but this node primarily deals with textual and structured JSON data.
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 project directory paths.
- No other external dependencies are indicated.
Troubleshooting
- Empty Prompt Error: The node throws an error if the prompt is empty or whitespace. Ensure the "Prompt" property is set and not blank.
- Timeouts: If the operation times out (default 300 seconds), an error indicates the timeout occurred. Increase the timeout value in the node settings if needed.
- Permission Issues: If "Require Permissions" is enabled, ensure that the necessary permissions for tool usage are granted; otherwise, the node may fail when attempting to use certain tools.
- Debugging: Enable "Debug Mode" to get detailed console logs about the execution flow, including received messages and tool usage, which helps diagnose issues.
- Invalid Project Path: Setting an incorrect or inaccessible project path may cause failures when Claude Code tries to access files or run commands.
- API Errors: Network or authentication errors will surface as execution errors. Verify API credentials and network connectivity.