anthropics / anthropics/claude-agent-sdk-python

Claude Code SDK permission system is a complete mess

Offen
#1,220 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
documentation enhancement
Vorherrschende Sprache
Python
Sterne
8.1k
Forks
1.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

I am trying to create an agent that will change configurations in the background - and I am seeting permission layer on top of permission layer on top of ... - and eventually - at times when it was activated in the background - it still does not help - Claude SDK Stops and wait for permission to do config edits.

This is what Claude is suggesting as a solution: (After I tried like 10 solutions with Claude Code guidance and failed)

self._options = ClaudeCodeOptions(
cwd=str(activation_root),
permission_mode="bypassPermissions",
system_prompt=self.AUTONOMOUS_SYSTEM_PROMPT,
mcp_servers=mcp_servers,
settings=project_settings, # now only carries `permissions.deny`
env=env,
can_use_tool=self._auto_resolve, # see below — without this, any ask-rule
# hit or requiresUserInteraction MCP
# tool call just hangs forever
)

async def _auto_resolve(self, tool_name, input_data, context):
# This is the thing that actually makes it "fully" autonomous.
# bypassPermissions can't skip ask-rules / AskUserQuestion / MCP tools
# marked requiresUserInteraction — they always fall through to this
# callback. If you don't supply one, those calls just stall.
return PermissionResultAllow()

{
"permissions": {
"deny": [
"Bash(rm -rf /*)",
"Bash(rm -rf ~*)",
"Read(//etc/shadow)",
"Read(~/.ssh/**)",
"Edit(~/.ssh/**)"
]
}
}

Really?
Can someone take it seriously?
And let SDK Do SDK stuff? I expect complete sereration from SDK activation and whatever Claude code is looking at when I activate it manually

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.