Skip to main content
Agent commands. Your AI agent uses this node in workflows. You don’t configure it directly.
Experimental. This node is not extensively tested and may have unexpected behavior. Use with caution in production workflows.
The claude-code node runs agentic tasks using Claude Code’s capabilities. It can read files, write content, execute shell commands, and iterate on complex problems - useful for development, research, analysis, or any task needing file access and multi-step reasoning.
This node requires Claude Code CLI authentication or an Anthropic API key.

Parameters

Prompt parameters

ParameterTypeRequiredDefaultDescription
promptstrYes-The prompt to send to Claude (max 10,000 chars)
output_schemadictNo-JSON schema for structured output

Execution parameters

ParameterTypeRequiredDefaultDescription
cwdstrNoCurrent dirWorking directory for Claude
modelstrNoclaude-sonnet-4-5Claude model to use
allowed_toolslistNoAll toolsPermitted tools
max_turnsintNo50Maximum conversation turns (1-100)
max_thinking_tokensintNo8000Reasoning budget (1000-100000)
timeoutintNo300Execution timeout in seconds (30-3600)
system_promptstrNo-Custom system instructions
resumestrNo-Session ID to resume a previous conversation
sandboxdictNo-Sandbox configuration for command isolation

Sandbox configuration

The sandbox parameter controls command execution isolation. See the Claude Agent SDK sandbox documentation for full details.
KeyTypeDescription
enabledboolEnable sandbox mode
autoAllowBashIfSandboxedboolAuto-allow bash when sandboxed
excludedCommandslistCommands that bypass sandbox (e.g., ["docker"])
allowUnsandboxedCommandsboolAllow model to request unsandboxed execution
networkdictNetwork settings (allowLocalBinding, allowUnixSockets)

Output

KeyTypeDescription
resultstr/dictResponse text or parsed schema dict
_claude_metadatadictExecution metadata (cost, duration, turns)
_schema_errorstrJSON parse error (only if schema provided and parsing failed)

Metadata structure

{
  "total_cost_usd": 0.0234,
  "duration_ms": 3450,
  "session_id": "abc123",
  "usage": {
    "input_tokens": 1500,
    "output_tokens": 450,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}

Authentication

Structured output

Use output_schema to get structured JSON responses:
### review

Review code for security issues and return structured results.

- type: claude-code
- prompt: Review this code for security issues: ${code.content}

```yaml output_schema
risk_level:
  type: str
  description: high, medium, or low
issues:
  type: list
  description: List of security issues found
score:
  type: int
  description: Security score 1-10
```
The response is automatically parsed and available as a dict:
${review.result.risk_level}  → "medium"
${review.result.issues}      → ["SQL injection risk", "Missing input validation"]
${review.result.score}       → 6

Schema field types

TypeDescription
strText string
intInteger number
boolBoolean value
listArray/list
dictObject/dictionary

Examples

Code generation

### generate

Write a Python function to calculate Fibonacci numbers.

- type: claude-code
- prompt: Write a Python function to calculate Fibonacci numbers
- max_turns: 1

Code review with structured output

### read

Read the authentication source code.

- type: read-file
- file_path: src/auth.py

### review

Review the authentication code and return structured findings.

- type: claude-code
- prompt: Review this authentication code: ${read.content}

```yaml output_schema
issues:
  type: list
  description: Problems found
suggestions:
  type: list
  description: Improvements
approved:
  type: bool
  description: Ready for production
```

File modification with sandbox

### refactor

Refactor the User class to use dataclasses.

- type: claude-code
- prompt: Refactor the User class to use dataclasses
- cwd: /path/to/project
- allowed_tools: ["Read", "Write", "Edit"]

```yaml sandbox
enabled: true
autoAllowBashIfSandboxed: true
excludedCommands:
  - docker
```

Tool permissions

Control what Claude can do with allowed_tools:
ToolCapability
ReadRead files
WriteCreate new files
EditModify existing files
BashExecute shell commands
TaskSpawn subagents
GlobFind files by pattern
GrepSearch file contents
LSList directory contents
WebFetchFetch web content
WebSearchSearch the web
For read-only analysis, use ["Read", "Glob", "Grep", "LS"]. For full capability, leave unset (default allows all tools).
See the Claude Agent SDK documentation for the complete list of available tools and options.

Limitations

  • Restricted directories: Cannot use /, /etc, /usr, /bin, /sbin, /lib, /sys, /proc as working directory
  • Timeout: 5 minutes (300 seconds) default, configurable up to 1 hour
  • Cost: More expensive than simple LLM calls - use for tasks that need file access and iteration

Error handling

ErrorCauseSolution
CLI not foundClaude Code not installednpm install -g @anthropic-ai/claude-code
Connection errorAuth issueRun claude auth login or set API key
TimeoutTask too complexIncrease timeout or simplify prompt
Rate limitToo many requestsWait and retry
The node retries failures automatically (2 attempts, conservative for expensive API).