Skip to content

fix: accept dict as options in query() and ClaudeSDKClient#656

Open
Bortlesboat wants to merge 1 commit intoanthropics:mainfrom
Bortlesboat:fix/query-dict-options
Open

fix: accept dict as options in query() and ClaudeSDKClient#656
Bortlesboat wants to merge 1 commit intoanthropics:mainfrom
Bortlesboat:fix/query-dict-options

Conversation

@Bortlesboat
Copy link
Copy Markdown
Contributor

Summary

  • Coerce dict to ClaudeAgentOptions via ** unpacking in both query() and ClaudeSDKClient.__init__()
  • Update type hints to ClaudeAgentOptions | dict[str, Any] | None

Passing a plain dict raises AttributeError: 'dict' object has no attribute 'can_use_tool' because process_query accesses dataclass attributes on it.

Fixes #446

Passing a plain dict as options raises AttributeError because
the code accesses dataclass attributes on it. Coerce dicts to
ClaudeAgentOptions via **unpacking so both entry points accept
the same input shapes.

Fixes anthropics#446
@Bortlesboat
Copy link
Copy Markdown
Contributor Author

Quick follow-up from my side: I’m treating review-required PRs as top priority this week. If you want any specific changes, rebase, or split, I can turn them around quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude agent sdk query cannot pass dict to options

1 participant