Skip to content
Surface: Runtime PythonStability: Public StableMaturity: StableSource

plugin_kit_ai_runtime

Generated via pydoc-markdown.

Table of Contents

  • plugin_kit_ai_runtime
    • JSONMap
    • ClaudeHandler
    • CodexHandler
    • CLAUDE_STABLE_HOOKS
    • CLAUDE_EXTENDED_HOOKS
    • allow
    • continue_
    • ClaudeApp
      • __init__
      • on
      • on_stop
      • on_pre_tool_use
      • on_user_prompt_submit
      • run
    • CodexApp
      • __init__
      • on_notify
      • run

plugin_kit_ai_runtime

Official Python runtime helpers for plugin-kit-ai executable plugins.

JSONMap

JSON-shaped payload used by the Python runtime helpers.

ClaudeHandler

Handler signature for Claude hooks that return a JSON object or None.

CodexHandler

Handler signature for Codex events that return an exit code or None.

CLAUDE_STABLE_HOOKS

Stable Claude hook names supported by the public Python runtime lane.

CLAUDE_EXTENDED_HOOKS

Extended Claude hook names exposed by the beta Python runtime lane.

allow

python
def allow() -> JSONMap

Return the empty JSON object expected by Claude for an allow response.

continue_

python
def continue_() -> int

Return exit code 0 for Codex handlers that want normal continuation.

ClaudeApp Objects

python
class ClaudeApp()

Minimal Claude hook app that dispatches supported hook names to handlers.

__init__

python
def __init__(allowed_hooks: Iterable[str], usage: str)

Create a Claude runtime app.

Arguments:

  • allowed_hooks - Hook names that this binary accepts on argv.
  • usage - Usage string printed when the invocation is invalid.

on

python
def on(hook_name: str) -> Callable[[ClaudeHandler], ClaudeHandler]

Return a decorator that registers a handler for hook_name.

on_stop

python
def on_stop(handler: ClaudeHandler) -> ClaudeHandler

Register a handler for the Stop hook.

on_pre_tool_use

python
def on_pre_tool_use(handler: ClaudeHandler) -> ClaudeHandler

Register a handler for the PreToolUse hook.

on_user_prompt_submit

python
def on_user_prompt_submit(handler: ClaudeHandler) -> ClaudeHandler

Register a handler for the UserPromptSubmit hook.

run

python
def run() -> int

Dispatch the current process invocation and return the exit code.

CodexApp Objects

python
class CodexApp()

Minimal Codex app that dispatches the notify event to a handler.

__init__

python
def __init__()

Create a Codex runtime app with no registered notify handler.

on_notify

python
def on_notify(handler: CodexHandler) -> CodexHandler

Register a handler for the Codex notify event.

run

python
def run() -> int

Dispatch the current process invocation and return the exit code.

Public docs for plugin authors and integrators.