lockstock-integrations 1.0.0__py3-none-any.whl → 1.0.1__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.
- {lockstock_integrations-1.0.0.dist-info → lockstock_integrations-1.0.1.dist-info}/METADATA +1 -1
- {lockstock_integrations-1.0.0.dist-info → lockstock_integrations-1.0.1.dist-info}/RECORD +4 -4
- lockstock_openai/guardrails.py +46 -0
- {lockstock_integrations-1.0.0.dist-info → lockstock_integrations-1.0.1.dist-info}/WHEEL +0 -0
|
@@ -9,8 +9,8 @@ lockstock_langgraph/__init__.py,sha256=7fBIYNCQygvUvG7IQOVY042sNNmu4UwkJoy0VLQn4
|
|
|
9
9
|
lockstock_langgraph/checkpointer.py,sha256=XJ2c_92OSBq4aNpOT112nTy3yI3stFcSCb8OTx04nos,6317
|
|
10
10
|
lockstock_langgraph/middleware.py,sha256=ZSwoxdkn3cC6aIBnMgd1jYGHYKa1yQXRwnts3Ds4sfQ,9174
|
|
11
11
|
lockstock_openai/__init__.py,sha256=Pc4phRUJEqrnREggyGJnc1HDKa7puVAR6-G9WZ4dtXM,402
|
|
12
|
-
lockstock_openai/guardrails.py,sha256=
|
|
12
|
+
lockstock_openai/guardrails.py,sha256=10wYzpR900-41A0eacC2dyUpgy-6yLSJRTOZydjk_c8,7119
|
|
13
13
|
lockstock_openai/tracing.py,sha256=VQWzG0y6t8q5rJZFbbP-bi9tsV0KaUqqH4Kr9-vr_e8,6025
|
|
14
|
-
lockstock_integrations-1.0.
|
|
15
|
-
lockstock_integrations-1.0.
|
|
16
|
-
lockstock_integrations-1.0.
|
|
14
|
+
lockstock_integrations-1.0.1.dist-info/METADATA,sha256=AiOMxN-VM6v3z6LAq74MkrkppjbOQt_ceLhNdxekviE,5629
|
|
15
|
+
lockstock_integrations-1.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
16
|
+
lockstock_integrations-1.0.1.dist-info/RECORD,,
|
lockstock_openai/guardrails.py
CHANGED
|
@@ -68,6 +68,52 @@ class LockStockGuardrail:
|
|
|
68
68
|
self.agent_id = agent_id
|
|
69
69
|
self.block_on_failure = block_on_failure
|
|
70
70
|
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_liberty(
|
|
73
|
+
cls,
|
|
74
|
+
agent_id: str,
|
|
75
|
+
socket_path: str = "/var/run/lockstock-guard/guard.sock",
|
|
76
|
+
endpoint: str = "https://lockstock-api-i9kp.onrender.com",
|
|
77
|
+
block_on_failure: bool = True
|
|
78
|
+
):
|
|
79
|
+
"""
|
|
80
|
+
Create guardrail by reading secret from Liberty Guard daemon.
|
|
81
|
+
|
|
82
|
+
This is the recommended method for enterprise deployments where secrets
|
|
83
|
+
are hardware-bound and managed by the lockstock-guard daemon.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
agent_id: The agent's unique identifier
|
|
87
|
+
socket_path: Path to Liberty Guard Unix socket
|
|
88
|
+
endpoint: LockStock API endpoint
|
|
89
|
+
block_on_failure: If True, block execution on auth failure
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
LockStockGuardrail instance with secret loaded from Guard daemon
|
|
93
|
+
|
|
94
|
+
Example:
|
|
95
|
+
>>> guardrail = LockStockGuardrail.from_liberty("agent_abc123")
|
|
96
|
+
>>> agent = Agent(guardrails=[guardrail])
|
|
97
|
+
"""
|
|
98
|
+
import json
|
|
99
|
+
from lockstock_guard.client import LibertyClient
|
|
100
|
+
|
|
101
|
+
# Retrieve secret from Guard daemon
|
|
102
|
+
guard_client = LibertyClient(socket_path=socket_path)
|
|
103
|
+
try:
|
|
104
|
+
secret_data = json.loads(guard_client.get(agent_id))
|
|
105
|
+
secret = secret_data["value"]
|
|
106
|
+
finally:
|
|
107
|
+
guard_client.close()
|
|
108
|
+
|
|
109
|
+
# Create guardrail with retrieved secret
|
|
110
|
+
return cls(
|
|
111
|
+
agent_id=agent_id,
|
|
112
|
+
secret=secret,
|
|
113
|
+
endpoint=endpoint,
|
|
114
|
+
block_on_failure=block_on_failure
|
|
115
|
+
)
|
|
116
|
+
|
|
71
117
|
async def validate(
|
|
72
118
|
self,
|
|
73
119
|
agent: Any,
|
|
File without changes
|