governed 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.
Files changed (48) hide show
  1. governed/__init__.py +337 -0
  2. governed/agent.py +1089 -0
  3. governed/bootstrap.py +436 -0
  4. governed/cli.py +144 -0
  5. governed/config.py +266 -0
  6. governed/contracts.py +229 -0
  7. governed/llm/__init__.py +49 -0
  8. governed/llm/anthropic_client.py +127 -0
  9. governed/llm/base.py +103 -0
  10. governed/llm/config.py +31 -0
  11. governed/llm/factory.py +100 -0
  12. governed/llm/gemini_client.py +154 -0
  13. governed/llm/openai_client.py +122 -0
  14. governed/llm/policy.py +58 -0
  15. governed/llm/scripted.py +51 -0
  16. governed/memory/__init__.py +52 -0
  17. governed/memory/optimizer.py +631 -0
  18. governed/memory/session.py +235 -0
  19. governed/memory/store.py +71 -0
  20. governed/memory/transcript.py +137 -0
  21. governed/observability/__init__.py +89 -0
  22. governed/observability/audit.py +201 -0
  23. governed/observability/decision_ledger.py +461 -0
  24. governed/observability/events.py +97 -0
  25. governed/observability/exporters.py +95 -0
  26. governed/observability/logger.py +349 -0
  27. governed/observability/telemetry.py +438 -0
  28. governed/prompts/__init__.py +21 -0
  29. governed/prompts/system.py +154 -0
  30. governed/security/__init__.py +86 -0
  31. governed/security/content_safety.py +333 -0
  32. governed/security/guardrails.py +1408 -0
  33. governed/security/policy.py +139 -0
  34. governed/skills/__init__.py +21 -0
  35. governed/skills/loader.py +230 -0
  36. governed/tools/__init__.py +181 -0
  37. governed/tools/base.py +244 -0
  38. governed/tools/code_execution.py +339 -0
  39. governed/tools/control.py +179 -0
  40. governed/tools/data_analysis.py +182 -0
  41. governed/tools/errors.py +90 -0
  42. governed/tools/filesystem.py +145 -0
  43. governed/tools/registry.py +170 -0
  44. governed-0.1.0.dist-info/METADATA +1608 -0
  45. governed-0.1.0.dist-info/RECORD +48 -0
  46. governed-0.1.0.dist-info/WHEEL +4 -0
  47. governed-0.1.0.dist-info/entry_points.txt +2 -0
  48. governed-0.1.0.dist-info/licenses/LICENSE +202 -0
governed/__init__.py ADDED
@@ -0,0 +1,337 @@
1
+ """governed -- a small, explicit framework for goal-directed LLM agents.
2
+
3
+ Quickstart::
4
+
5
+ from governed import Agent, AgentConfig
6
+ from governed.llm import AnthropicClient
7
+
8
+ agent = Agent(AgentConfig(
9
+ llm=AnthropicClient(model="claude-sonnet-5"),
10
+ workspace="./workspace",
11
+ trace_path="./traces/run.jsonl",
12
+ ))
13
+ result = agent.run("Profile data/sales.csv and name the top 3 regions by revenue.")
14
+ print(result.status, result.confidence)
15
+ print(result.answer)
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ from .agent import Agent, BudgetExceeded, Cancelled, RunResult
21
+ from .config import (
22
+ AgentConfig,
23
+ ApprovalPolicy,
24
+ Budget,
25
+ FeatureToggleConfig,
26
+ ObservabilityConfig,
27
+ auto_approve,
28
+ cli_approve,
29
+ deny_all,
30
+ )
31
+ from .contracts import ContractViolation, Evaluation, Phase, Plan, PlanStep
32
+ from .llm import (
33
+ LLMClient,
34
+ LLMConfig,
35
+ LLMResponse,
36
+ Message,
37
+ ProviderPolicy,
38
+ ProviderPolicyViolation,
39
+ ScriptedClient,
40
+ ToolCall,
41
+ Usage,
42
+ register_provider,
43
+ resolve_llm,
44
+ )
45
+ from .memory import (
46
+ PRICING,
47
+ PRICING_AS_OF,
48
+ CallCost,
49
+ CircuitBreaker,
50
+ CircuitBreakerConfig,
51
+ CircuitOpen,
52
+ CompactionConfig,
53
+ CostConfig,
54
+ CostLedger,
55
+ InMemoryStore,
56
+ JSONFileStore,
57
+ ModelPricing,
58
+ RecursiveCompactor,
59
+ SessionState,
60
+ StateStore,
61
+ compaction_for,
62
+ resolve_pricing,
63
+ )
64
+ from .observability import (
65
+ GENESIS_HASH,
66
+ AuditReport,
67
+ ConsoleSink,
68
+ DecisionLedger,
69
+ DecisionLedgerConfig,
70
+ DecisionLedgerSink,
71
+ DecisionLedgerStore,
72
+ DecisionRecord,
73
+ Event,
74
+ EventType,
75
+ HttpDecisionLedgerSink,
76
+ HttpEventSink,
77
+ HttpTransport,
78
+ InMemoryDecisionLedger,
79
+ IterationSummary,
80
+ JSONLDecisionLedger,
81
+ JSONLSink,
82
+ LLMCallStats,
83
+ LoggingSink,
84
+ OTelDecisionLedgerSink,
85
+ OTelEventSink,
86
+ SafetyStats,
87
+ SessionTiming,
88
+ TamperDetected,
89
+ TelemetryCollector,
90
+ ToolCallStats,
91
+ TraceLogger,
92
+ build_audit_report,
93
+ default_http_transport,
94
+ export_decisions,
95
+ otlp_kv,
96
+ otlp_log_record,
97
+ otlp_resource_logs,
98
+ otlp_value,
99
+ read_trace,
100
+ trace_to_markdown,
101
+ verify_chain,
102
+ )
103
+ from .security import (
104
+ AllowTierApprover,
105
+ ApprovalDecision,
106
+ ApprovalRequest,
107
+ Approver,
108
+ CategoryPolicy,
109
+ ContentSafetyScanner,
110
+ DenyAllApprover,
111
+ DestructiveCommandScanner,
112
+ Finding,
113
+ Gateway,
114
+ GovernancePolicy,
115
+ GovernanceViolation,
116
+ GuardedRegistry,
117
+ GuardrailConfig,
118
+ InjectionScanner,
119
+ KeywordSafetyProvider,
120
+ LLMSafetyProvider,
121
+ PIIScanner,
122
+ RiskPolicy,
123
+ RiskTier,
124
+ SafetyProvider,
125
+ SafetyVerdict,
126
+ SecretExfiltrationScanner,
127
+ SelfModificationGuard,
128
+ SemanticInjectionScanner,
129
+ Severity,
130
+ TerminalApprover,
131
+ WebhookApprover,
132
+ )
133
+ from .skills import (
134
+ Skill,
135
+ SkillConfig,
136
+ SkillLibrary,
137
+ SkillSource,
138
+ register_skill_source,
139
+ registered_skill_sources,
140
+ resolve_skills,
141
+ )
142
+ from .tools import (
143
+ BUILTIN_TOOLS,
144
+ BackendTimeout,
145
+ BackendUnavailable,
146
+ CodeExecutionTool,
147
+ DataAnalysisTool,
148
+ DockerCodeExecutionBackend,
149
+ ExecResult,
150
+ ExecutionBackend,
151
+ FileSystemTool,
152
+ LoadSkillTool,
153
+ ScratchpadTool,
154
+ SubmitTool,
155
+ SubprocessBackend,
156
+ Tool,
157
+ ToolConfig,
158
+ ToolContext,
159
+ ToolError,
160
+ ToolErrorCode,
161
+ ToolExecutionError,
162
+ ToolFactory,
163
+ ToolRegistry,
164
+ ToolResult,
165
+ ToolSafety,
166
+ ToolSpec,
167
+ default_tools,
168
+ register_tool,
169
+ registered_tool_names,
170
+ resolve_tools,
171
+ )
172
+
173
+ __version__ = "0.1.0"
174
+
175
+ __all__ = [
176
+ "__version__",
177
+ # core
178
+ "Agent",
179
+ "AgentConfig",
180
+ "RunResult",
181
+ "Budget",
182
+ "BudgetExceeded",
183
+ "Cancelled",
184
+ "ApprovalPolicy",
185
+ "auto_approve",
186
+ "cli_approve",
187
+ "deny_all",
188
+ "ObservabilityConfig",
189
+ "FeatureToggleConfig",
190
+ # contracts
191
+ "Phase",
192
+ "Plan",
193
+ "PlanStep",
194
+ "Evaluation",
195
+ "ContractViolation",
196
+ # llm
197
+ "LLMClient",
198
+ "LLMConfig",
199
+ "LLMResponse",
200
+ "Message",
201
+ "ToolCall",
202
+ "Usage",
203
+ "ScriptedClient",
204
+ "register_provider",
205
+ "resolve_llm",
206
+ "ProviderPolicy",
207
+ "ProviderPolicyViolation",
208
+ # tools
209
+ "Tool",
210
+ "ToolConfig",
211
+ "ToolContext",
212
+ "ToolResult",
213
+ "ToolSpec",
214
+ "ToolSafety",
215
+ "ToolError",
216
+ "ToolErrorCode",
217
+ "ToolExecutionError",
218
+ "ToolRegistry",
219
+ "ToolFactory",
220
+ "default_tools",
221
+ "resolve_tools",
222
+ "register_tool",
223
+ "registered_tool_names",
224
+ "BUILTIN_TOOLS",
225
+ "FileSystemTool",
226
+ "CodeExecutionTool",
227
+ "ExecutionBackend",
228
+ "SubprocessBackend",
229
+ "DockerCodeExecutionBackend",
230
+ "ExecResult",
231
+ "BackendTimeout",
232
+ "BackendUnavailable",
233
+ "DataAnalysisTool",
234
+ "SubmitTool",
235
+ "ScratchpadTool",
236
+ "LoadSkillTool",
237
+ # memory
238
+ "SessionState",
239
+ "StateStore",
240
+ "InMemoryStore",
241
+ "JSONFileStore",
242
+ "CompactionConfig",
243
+ "RecursiveCompactor",
244
+ "compaction_for",
245
+ # cost + circuit breaker
246
+ "CostLedger",
247
+ "CostConfig",
248
+ "CallCost",
249
+ "ModelPricing",
250
+ "PRICING",
251
+ "PRICING_AS_OF",
252
+ "resolve_pricing",
253
+ "CircuitBreaker",
254
+ "CircuitBreakerConfig",
255
+ "CircuitOpen",
256
+ # guardrails
257
+ "GuardrailConfig",
258
+ "Gateway",
259
+ "GuardedRegistry",
260
+ "RiskTier",
261
+ "RiskPolicy",
262
+ "Severity",
263
+ "Finding",
264
+ "InjectionScanner",
265
+ "SecretExfiltrationScanner",
266
+ "PIIScanner",
267
+ "DestructiveCommandScanner",
268
+ "SelfModificationGuard",
269
+ "SemanticInjectionScanner",
270
+ "Approver",
271
+ "ApprovalRequest",
272
+ "ApprovalDecision",
273
+ "TerminalApprover",
274
+ "WebhookApprover",
275
+ "AllowTierApprover",
276
+ "DenyAllApprover",
277
+ # governance
278
+ "GovernancePolicy",
279
+ "GovernanceViolation",
280
+ # content safety (Responsible AI execution layer)
281
+ "ContentSafetyScanner",
282
+ "SafetyProvider",
283
+ "SafetyVerdict",
284
+ "CategoryPolicy",
285
+ "KeywordSafetyProvider",
286
+ "LLMSafetyProvider",
287
+ # observability
288
+ "Event",
289
+ "EventType",
290
+ "TraceLogger",
291
+ "ConsoleSink",
292
+ "JSONLSink",
293
+ "LoggingSink",
294
+ "read_trace",
295
+ "trace_to_markdown",
296
+ "AuditReport",
297
+ "IterationSummary",
298
+ "build_audit_report",
299
+ # decision ledger
300
+ "GENESIS_HASH",
301
+ "DecisionLedger",
302
+ "DecisionLedgerConfig",
303
+ "DecisionLedgerSink",
304
+ "DecisionLedgerStore",
305
+ "DecisionRecord",
306
+ "HttpDecisionLedgerSink",
307
+ "InMemoryDecisionLedger",
308
+ "JSONLDecisionLedger",
309
+ "OTelDecisionLedgerSink",
310
+ "TamperDetected",
311
+ "export_decisions",
312
+ "verify_chain",
313
+ # monitoring / event-trace exporters (Splunk, Datadog, New Relic,
314
+ # Dynatrace via HTTP; any OTel-compatible backend via OTLP/HTTP)
315
+ "HttpEventSink",
316
+ "OTelEventSink",
317
+ "HttpTransport",
318
+ "default_http_transport",
319
+ "otlp_kv",
320
+ "otlp_log_record",
321
+ "otlp_resource_logs",
322
+ "otlp_value",
323
+ # telemetry
324
+ "TelemetryCollector",
325
+ "LLMCallStats",
326
+ "ToolCallStats",
327
+ "SessionTiming",
328
+ "SafetyStats",
329
+ # skills
330
+ "Skill",
331
+ "SkillConfig",
332
+ "SkillLibrary",
333
+ "SkillSource",
334
+ "resolve_skills",
335
+ "register_skill_source",
336
+ "registered_skill_sources",
337
+ ]