runlayer-hooks-sdk 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,128 @@
1
+ Metadata-Version: 2.4
2
+ Name: runlayer-hooks-sdk
3
+ Version: 0.1.0
4
+ Summary: Runlayer Hooks SDK for Python agent runtimes
5
+ Project-URL: Homepage, https://runlayer.com
6
+ Project-URL: Documentation, https://docs.runlayer.com/
7
+ Author-email: Runlayer <engineering@runlayer.com>
8
+ License: Apache-2.0
9
+ Keywords: agent,llm,mcp,runlayer,security
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: httpx==0.28.1
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Runlayer Hooks Python SDK
23
+
24
+ Python SDK companion to `@runlayer/hooks-sdk`.
25
+
26
+ ## Configure
27
+
28
+ ```sh
29
+ export RUNLAYER_BASE_URL="https://your-runlayer-instance.com"
30
+ export RUNLAYER_API_KEY="rl_..."
31
+ ```
32
+
33
+ Agent account auth is also supported:
34
+
35
+ ```sh
36
+ export RUNLAYER_BASE_URL="https://your-runlayer-instance.com"
37
+ export RUNLAYER_AGENT_CLIENT_ID="client_..."
38
+ export RUNLAYER_AGENT_CLIENT_SECRET="..."
39
+ ```
40
+
41
+ Optional OBO subject fields:
42
+
43
+ ```sh
44
+ export RUNLAYER_AGENT_SUBJECT_TOKEN="user@example.com"
45
+ export RUNLAYER_AGENT_SUBJECT_TOKEN_TYPE="urn:runlayer:token-type:user-email"
46
+ ```
47
+
48
+ Optional runtime controls:
49
+
50
+ | Variable | Purpose |
51
+ | --- | --- |
52
+ | `RUNLAYER_HOOK_TIMEOUT_MS` | Hook request timeout. Defaults to `10000`. |
53
+ | `RUNLAYER_HOOK_MAX_TOOL_OUTPUT_BYTES` | Maximum serialized tool output sent to Runlayer. Defaults to `65536`. |
54
+ | `RUNLAYER_HOOK_ENFORCEMENT_FAILURE_MODE` | Defaults to `closed`; set to `open` only if tool calls should continue when Runlayer is unreachable. |
55
+ | `RUNLAYER_ALLOW_INSECURE_TRANSPORT=1` | Allow non-HTTPS `RUNLAYER_BASE_URL` for local development. |
56
+
57
+ ## Usage
58
+
59
+ ```python
60
+ from runlayer_sdk import RunlayerClient
61
+
62
+ runlayer = RunlayerClient.from_env(client_version="my-agent/1.0.0")
63
+
64
+
65
+ def run_local_tool(tool_input: dict[str, object]) -> str:
66
+ return "tool output"
67
+
68
+
69
+ output = runlayer.run_tool(
70
+ execute=run_local_tool,
71
+ session_id="session-id",
72
+ tool_input={"command": "cat README.md"},
73
+ tool_name="Bash",
74
+ tool_type="shell",
75
+ )
76
+ ```
77
+
78
+ Use `tool_enforcement` to skip Runlayer-owned MCP tools or proxy URLs:
79
+
80
+ ```python
81
+ runlayer = RunlayerClient.from_env(
82
+ tool_enforcement={
83
+ "ignored_mcp_server_names": ["github-preview"],
84
+ "skip_runlayer_mcp_proxy_urls": True,
85
+ }
86
+ )
87
+ ```
88
+
89
+ `RunlayerClient` exposes:
90
+
91
+ - `emit_event`
92
+ - `before_tool`
93
+ - `after_tool`
94
+ - `run_tool`
95
+ - `should_enforce_tool`
96
+
97
+ The package also exports `send_runlayer_preflight`.
98
+
99
+ ## Framework tool adapters
100
+
101
+ Dependency-free adapters wrap common tool dictionary shapes:
102
+
103
+ - `with_runlayer_vercel_ai_tool`
104
+ - `with_runlayer_vercel_ai_tools`
105
+ - `with_runlayer_openai_agents_tool`
106
+ - `with_runlayer_google_adk_tool`
107
+ - `run_runlayer_adapter_tool`
108
+
109
+ ## Claude Agent SDK hooks
110
+
111
+ Use the adapter helpers when a Python agent runtime wants the same Claude Agent
112
+ SDK hook output shapes as the Hooks TypeScript SDK:
113
+
114
+ ```python
115
+ from runlayer_sdk import RunlayerClient, create_claude_agent_sdk_hooks
116
+
117
+ runlayer = RunlayerClient.from_env()
118
+ hooks = create_claude_agent_sdk_hooks(runlayer, include_stop=False)
119
+ ```
120
+
121
+ The adapter exports:
122
+
123
+ - `create_claude_agent_sdk_hooks`
124
+ - `emit_claude_agent_sdk_transcript_stop`
125
+ - `claude_agent_sdk_assistant_message_to_transcript_line`
126
+ - `tool_type_from_name`
127
+
128
+ TypeScript-style camelCase aliases are also available for SDK parity.
@@ -0,0 +1,14 @@
1
+ runlayer_sdk/__init__.py,sha256=TJC4rQbOJ7gv1M5d5b9lNshCbqBNq0OrbDBp1BfiJ1E,4738
2
+ runlayer_sdk/claude_agent_sdk.py,sha256=if6MvzhQQu9VMM4x0niyGpQT7_9HCzHXTbAU_RvfSVg,14816
3
+ runlayer_sdk/client.py,sha256=WqzT-UJTnboOzA5LsxpIuJsiyPbP8wzPbWXMx5clCvw,35536
4
+ runlayer_sdk/google_adk.py,sha256=_pUR8ttalFxyRfLCJ7hRmfxjsaFfZ8BwEdDeqMsreEE,4445
5
+ runlayer_sdk/hook_transport.py,sha256=iRZ7ZkTtTzgb9wlBETWw9ET3R2RfCmazlFBkqNxdkR4,3656
6
+ runlayer_sdk/openai_agents_sdk.py,sha256=pSXRODEByUHG8O-OsWr_vZsxAMt9dauCByLPowIxGo8,4749
7
+ runlayer_sdk/preflight.py,sha256=JsuKwtKZ03MP4snmcgvK1VCnghfUZOmZSLkcR4HX8Kk,1968
8
+ runlayer_sdk/tool_adapter.py,sha256=Ze6i_7WldUzyEvIGJqA1Byzm0xTxYxz9FY_XdvNDdR4,9217
9
+ runlayer_sdk/tool_enforcement.py,sha256=vQs0VEcW5_OP4AA_xOvWcZNczPyY77FEPyGYJfzxkl0,7578
10
+ runlayer_sdk/types.py,sha256=6uyp7C6iqMxbifQUKjzdpJSG8ZhDWxMTkqlvJKj1UOo,4571
11
+ runlayer_sdk/vercel_ai_sdk.py,sha256=BMCA7rGxUcHBsqtI4gCa4WX2jzjQMDgj1ERBcA7dV5c,4209
12
+ runlayer_hooks_sdk-0.1.0.dist-info/METADATA,sha256=-9JzoVIdyulAVPCRKH7rwTPtQBXRfIm02JyDUhlVTQg,3610
13
+ runlayer_hooks_sdk-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ runlayer_hooks_sdk-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,158 @@
1
+ """Runlayer Hooks Python SDK."""
2
+
3
+ from runlayer_sdk.client import RunlayerClient, RunlayerHookClient
4
+ from runlayer_sdk.claude_agent_sdk import (
5
+ ClaudeAgentSdkHooksOptions,
6
+ ClaudeAgentSdkTranscriptStopOptions,
7
+ claudeAgentSdkAssistantMessageToTranscriptLine,
8
+ claude_agent_sdk_assistant_message_to_transcript_line,
9
+ createClaudeAgentSdkHooks,
10
+ create_claude_agent_sdk_hooks,
11
+ emitClaudeAgentSdkTranscriptStop,
12
+ emit_claude_agent_sdk_transcript_stop,
13
+ toolTypeFromName,
14
+ tool_type_from_name,
15
+ )
16
+ from runlayer_sdk.types import (
17
+ AgentAccountOptions,
18
+ AfterToolOptions,
19
+ AfterToolResult,
20
+ AgentSubjectTokenType,
21
+ BeforeToolOptions,
22
+ BeforeToolResult,
23
+ EnforceMcpSourceOptions,
24
+ FetchLike,
25
+ FetchResponse,
26
+ HookEventName,
27
+ JsonObject,
28
+ RunlayerAgentAccountOptions,
29
+ RunlayerBlockedError,
30
+ RunlayerClientEnvOptions,
31
+ RunlayerClientOptions,
32
+ RunlayerEnforcementFailureMode,
33
+ RunlayerEnforcementUnavailableError,
34
+ RunlayerToolContext,
35
+ RunlayerToolEnforcementOptions,
36
+ RunlayerToolEnforcementPredicate,
37
+ RunToolOptions,
38
+ )
39
+ from runlayer_sdk.preflight import (
40
+ PreflightOptions,
41
+ PreflightResult,
42
+ sendRunlayerPreflight,
43
+ send_runlayer_preflight,
44
+ )
45
+ from runlayer_sdk.google_adk import (
46
+ GoogleAdkFunctionToolOptions,
47
+ GoogleAdkToolContext,
48
+ RunlayerGoogleAdkToolAdapterOptions,
49
+ withRunlayerGoogleAdkTool,
50
+ with_runlayer_google_adk_tool,
51
+ )
52
+ from runlayer_sdk.openai_agents_sdk import (
53
+ OpenAIAgentsFunctionToolOptions,
54
+ OpenAIAgentsToolCallDetails,
55
+ RunlayerOpenAIAgentsToolAdapterOptions,
56
+ withRunlayerOpenAIAgentsTool,
57
+ with_runlayer_openai_agents_tool,
58
+ )
59
+ from runlayer_sdk.tool_adapter import (
60
+ RunlayerAdapterMetadataResolver,
61
+ RunlayerAdapterRunOptions,
62
+ RunlayerAdapterToolExecute,
63
+ RunlayerAdapterToolExecution,
64
+ RunlayerToolAdapterOptions,
65
+ runRunlayerAdapterToolAsync,
66
+ runRunlayerAdapterTool,
67
+ run_runlayer_adapter_tool_async,
68
+ run_runlayer_adapter_tool,
69
+ )
70
+ from runlayer_sdk.tool_enforcement import (
71
+ isRunlayerMcpProxyUrl,
72
+ is_runlayer_mcp_proxy_url,
73
+ mcpServerNameFromToolName,
74
+ mcp_server_name_from_tool_name,
75
+ shouldEnforceTool,
76
+ should_enforce_tool,
77
+ )
78
+ from runlayer_sdk.vercel_ai_sdk import (
79
+ VercelAiTool,
80
+ VercelAiToolExecutionOptions,
81
+ VercelAiToolSet,
82
+ withRunlayerVercelAiTool,
83
+ withRunlayerVercelAiTools,
84
+ with_runlayer_vercel_ai_tool,
85
+ with_runlayer_vercel_ai_tools,
86
+ )
87
+
88
+ __all__ = [
89
+ "AgentAccountOptions",
90
+ "AfterToolOptions",
91
+ "AfterToolResult",
92
+ "AgentSubjectTokenType",
93
+ "BeforeToolOptions",
94
+ "BeforeToolResult",
95
+ "ClaudeAgentSdkHooksOptions",
96
+ "ClaudeAgentSdkTranscriptStopOptions",
97
+ "EnforceMcpSourceOptions",
98
+ "FetchLike",
99
+ "FetchResponse",
100
+ "GoogleAdkFunctionToolOptions",
101
+ "GoogleAdkToolContext",
102
+ "HookEventName",
103
+ "JsonObject",
104
+ "OpenAIAgentsFunctionToolOptions",
105
+ "OpenAIAgentsToolCallDetails",
106
+ "PreflightOptions",
107
+ "PreflightResult",
108
+ "RunlayerAdapterMetadataResolver",
109
+ "RunlayerAdapterRunOptions",
110
+ "RunlayerAdapterToolExecute",
111
+ "RunlayerAdapterToolExecution",
112
+ "RunToolOptions",
113
+ "RunlayerAgentAccountOptions",
114
+ "RunlayerBlockedError",
115
+ "RunlayerClient",
116
+ "RunlayerClientEnvOptions",
117
+ "RunlayerClientOptions",
118
+ "RunlayerEnforcementFailureMode",
119
+ "RunlayerEnforcementUnavailableError",
120
+ "RunlayerGoogleAdkToolAdapterOptions",
121
+ "RunlayerHookClient",
122
+ "RunlayerOpenAIAgentsToolAdapterOptions",
123
+ "RunlayerToolAdapterOptions",
124
+ "RunlayerToolContext",
125
+ "RunlayerToolEnforcementOptions",
126
+ "RunlayerToolEnforcementPredicate",
127
+ "VercelAiTool",
128
+ "VercelAiToolExecutionOptions",
129
+ "VercelAiToolSet",
130
+ "claudeAgentSdkAssistantMessageToTranscriptLine",
131
+ "claude_agent_sdk_assistant_message_to_transcript_line",
132
+ "createClaudeAgentSdkHooks",
133
+ "create_claude_agent_sdk_hooks",
134
+ "emitClaudeAgentSdkTranscriptStop",
135
+ "emit_claude_agent_sdk_transcript_stop",
136
+ "isRunlayerMcpProxyUrl",
137
+ "is_runlayer_mcp_proxy_url",
138
+ "mcpServerNameFromToolName",
139
+ "mcp_server_name_from_tool_name",
140
+ "runRunlayerAdapterToolAsync",
141
+ "runRunlayerAdapterTool",
142
+ "run_runlayer_adapter_tool_async",
143
+ "run_runlayer_adapter_tool",
144
+ "sendRunlayerPreflight",
145
+ "send_runlayer_preflight",
146
+ "shouldEnforceTool",
147
+ "should_enforce_tool",
148
+ "toolTypeFromName",
149
+ "tool_type_from_name",
150
+ "withRunlayerGoogleAdkTool",
151
+ "withRunlayerOpenAIAgentsTool",
152
+ "withRunlayerVercelAiTool",
153
+ "withRunlayerVercelAiTools",
154
+ "with_runlayer_google_adk_tool",
155
+ "with_runlayer_openai_agents_tool",
156
+ "with_runlayer_vercel_ai_tool",
157
+ "with_runlayer_vercel_ai_tools",
158
+ ]