anthropics / anthropics/claude-agent-sdk-python

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

Open
#814 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.1k
Forks
1.3k
Avg merge
2d 31m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.