anthropics / anthropics/claude-agent-sdk-python

ClaudeAgentOptions.effort typings are outdated, and CLI validation failures are surfaced as opaque ProcessError

Đang mở
#834 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
8.1k
Fork
1.3k
Merge trung bình
2 ngày 31 phút
Pull request đã merge (30 ngày)
1

Mô tả

## Summary

`ClaudeAgentOptions.effort` in the Python SDK does not include `"xhigh"` in its type definition, even though current Claude Code CLI versions support it.

In addition, when the SDK is used with a Claude Code CLI version that does not support a newer `--effort` value, the failure is surfaced only as a generic `ProcessError` with:

> Command failed with exit code 1
> Error output: Check stderr output for details

This makes debugging unnecessarily difficult.

## Why this matters

There are currently two separate issues:

1. **Outdated Python type definitions**
- `ClaudeAgentOptions.effort` is typed as:
- `Literal["low", "medium", "high", "max"] | None`
- but current Claude Code CLI help includes:
- `low, medium, high, xhigh, max`

2. **Poor error surfacing**
- the SDK forwards `--effort ` directly to the CLI
- if the installed CLI is older and rejects that value, the SDK raises only a generic `ProcessError`
- the actual stderr reason is not included in the exception text

This creates a confusing failure mode:
- newer effort values appear unsupported from the Python types
- and if users try them anyway, failures are hard to diagnose

## Affected version

Observed with:

- `claude-agent-sdk==0.1.61`

## Relevant code locations

### Outdated type definition

In `claude_agent_sdk/types.py`:

```python
effort: Literal["low", "medium", "high", "max"] | None = None

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.