Security
Every side effect an agent can produce — writing files, running bash, pushing
git — flows through a permission policy. Start from an ask or deny
fallback, then list the patterns that should be allow-ed, deny-ed, or sent
to the ask path. To keep a human in the loop, add a confirmation policy:
ask decisions pause on a confirmation_required event so your application
(or a person) can approve or reject each call. Use this whenever an agent runs
against a real repository.
Add a security provider
A DefaultSecurityProvider enables input taint tracking and output sanitisation,
screening tool I/O independently of the permission policy. Pass one through
securityProvider (Node), security_provider (Python), or set Go
SessionOptions.DefaultSecurity to true; omit it to disable security.
Notes
defaultDecisionis the fallback for any pattern not matched byallow/deny/ask(one ofallow,deny, orask). Preferaskfor real repositories and open up only what automation needs.- A
confirmationPolicywithenabled: trueis what turnsaskdecisions into a pausingconfirmation_requiredevent. Resolve each one withsession.confirmToolUse(toolId, approved, reason?); if no answer arrives withindefaultTimeoutMs,timeoutAction(reject) decides the outcome. - Keep release and publish actions (
bash(git push*),bash(npm publish*)) on theaskordenypath unless automation owns the final step. - Direct host calls such as
session.tool(),session.bash(), andsession.git()are privileged host operations initiated by your application code. Authorize them in the host before calling the SDK; the permission policy above gates model-selected tool calls insidesend,run, andstream.
A runnable confirmation loop ships at
sdk/node/examples/streaming/hitl_confirmation_loop.ts and
sdk/python/examples/hitl_confirmation_loop.py.