anthropics / anthropics/claude-agent-sdk-python

Inconsistent behavior of disable-model-invocation: true between Claude Code and Agent SDK

未關閉
#814 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
8.1k
分支
1.3k
平均合併
2 天 31 分鐘
30 天內合併 PR
1

描述

I have observed a discrepancy in how `disable-model-invocation: true` is handled in custom Skills slash command. When using the same command configuration in the Claude Code, it executes as expected. However, when triggering the same command via the Claude Agent SDK, the command fails to invoke or produces no result.

It appears the SDK enforces the `disable-model-invocation` flag strictly, preventing the agent from triggering the skill, whereas Claude Code seems to have an alternative execution path for these commands.

**Environment:**
- SDK Version: 0.1.58
- OS: macOS 26.1
- Python version: 3.12.9

**Reproduction Steps:**
1. Create a custom skill file (e.g., `.claude/skills/test-cmd/SKILL.md`).
2. Add the following YAML frontmatter:
```yaml
---
disable-model-invocation: true
---
# Content here
```
3. Attempt to call this skill via the SDK using the `query` method.
4. Observe that the command does not execute or returns an error/no result, whereas running `/test-cmd` in Claude Code works correctly.

**Expected Behavior:**
The SDK should handle commands with `disable-model-invocation: true` consistently with Claude Code, or there should be a supported way to trigger these commands via the SDK without model invocation interference.

**Actual Behavior:**
The command is effectively disabled or ignored in the SDK context.

Thanks for helping.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。