Claude Agent SDK
Install
Integration
from claude_agent_sdk import ClaudeAgentOptions, query
from scopebound import ScopeboundSDK
from scopebound.adapters.claude_agent import enforce_claude
sb = ScopeboundSDK()
options = ClaudeAgentOptions(
hooks=enforce_claude(sb, role="invoice-processor")
)
async for message in query("Process pending invoices", options=options):
print(message)
enforce_claude() returns a hooks dict with PreToolUse wired to the Scopebound enforcement hook.
Using ScopeboundHook directly
from scopebound.adapters.claude_agent import ScopeboundHook
hook = ScopeboundHook(sb, role="invoice-processor")
options = ClaudeAgentOptions(
hooks={"PreToolUse": hook.pre_tool_use}
)
Deny behaviour
On deny, the hook raises PermissionError — the Claude Agent SDK surfaces this to the agent as a tool error, allowing graceful handling.