Skip to main content

Execute Claude - Standardized Claude Agent Execution Script

===========================================================

Executes tasks using Anthropic Claude (via Claude Code Task tool).

Usage: echo '{"task_id": "TASK-001", ...}' | python execute_claude.py

Input (stdin): JSON task specification Output (stdout): JSON execution result Exit Codes: 0 - Success 1 - Execution error 2 - Configuration error 3 - Task specification error

Copyright (c) 2025 AZ1.AI INC. All rights reserved. Developer: Hal Casteel, CEO/CTO Email: 1@az1.ai

File: execute_claude.py

Functions

read_task_from_stdin()

Read task specification from stdin.

validate_task_spec(task)

Validate task specification has required fields.

generate_task_tool_command(task)

Generate Task tool command for Claude Code.

execute_claude_interactive(task)

Execute task using Claude Code (interactive mode).

execute_claude_api(task)

Execute task using Claude API (direct API mode).

main()

Main execution entry point.

Usage

python execute_claude.py