agent-authorizer 0.14.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 (175) hide show
  1. agent_authorizer/__init__.py +123 -0
  2. agent_authorizer/__main__.py +5 -0
  3. agent_authorizer/_api.py +606 -0
  4. agent_authorizer/_audit.py +76 -0
  5. agent_authorizer/_checks.py +258 -0
  6. agent_authorizer/_context.py +178 -0
  7. agent_authorizer/_default.py +39 -0
  8. agent_authorizer/_entitlements.py +344 -0
  9. agent_authorizer/_fence.py +161 -0
  10. agent_authorizer/_gateway.py +146 -0
  11. agent_authorizer/_mcp_endpoint.py +386 -0
  12. agent_authorizer/_page/__init__.py +17 -0
  13. agent_authorizer/_page/index.html +55 -0
  14. agent_authorizer/_page/watch.css +277 -0
  15. agent_authorizer/_page/watch.js +531 -0
  16. agent_authorizer/_permissions.py +63 -0
  17. agent_authorizer/_record.py +167 -0
  18. agent_authorizer/_rules.py +224 -0
  19. agent_authorizer/_runs.py +91 -0
  20. agent_authorizer/_session.py +311 -0
  21. agent_authorizer/_toolkit.py +1003 -0
  22. agent_authorizer/_untrusted.py +77 -0
  23. agent_authorizer/_version.py +1 -0
  24. agent_authorizer/_walk.py +48 -0
  25. agent_authorizer/_watch.py +290 -0
  26. agent_authorizer/_wire.py +557 -0
  27. agent_authorizer/authx/__init__.py +6 -0
  28. agent_authorizer/authx/awscreds.py +295 -0
  29. agent_authorizer/authx/awsquery.py +252 -0
  30. agent_authorizer/authx/google.py +89 -0
  31. agent_authorizer/authx/jwt.py +359 -0
  32. agent_authorizer/authx/oauth2.py +180 -0
  33. agent_authorizer/authx/sigv4.py +290 -0
  34. agent_authorizer/authx/sts.py +177 -0
  35. agent_authorizer/authx/token.py +137 -0
  36. agent_authorizer/authx/util.py +446 -0
  37. agent_authorizer/authx/xmlutil.py +92 -0
  38. agent_authorizer/claude_agent_sdk.py +187 -0
  39. agent_authorizer/cli.py +698 -0
  40. agent_authorizer/core/__init__.py +0 -0
  41. agent_authorizer/core/cache.py +413 -0
  42. agent_authorizer/core/catalog.py +237 -0
  43. agent_authorizer/core/config.py +705 -0
  44. agent_authorizer/core/context.py +233 -0
  45. agent_authorizer/core/decision.py +210 -0
  46. agent_authorizer/core/declog.py +113 -0
  47. agent_authorizer/core/duration.py +144 -0
  48. agent_authorizer/core/engine.py +460 -0
  49. agent_authorizer/core/errors.py +185 -0
  50. agent_authorizer/core/evidence.py +324 -0
  51. agent_authorizer/core/integration.py +585 -0
  52. agent_authorizer/core/jsonx.py +135 -0
  53. agent_authorizer/core/log.py +188 -0
  54. agent_authorizer/core/oidc.py +297 -0
  55. agent_authorizer/core/routes.py +601 -0
  56. agent_authorizer/core/secret.py +146 -0
  57. agent_authorizer/core/template.py +126 -0
  58. agent_authorizer/crewai.py +208 -0
  59. agent_authorizer/google_adk.py +229 -0
  60. agent_authorizer/integrations/__init__.py +47 -0
  61. agent_authorizer/integrations/_googleapis.py +257 -0
  62. agent_authorizer/integrations/argocd/__init__.py +399 -0
  63. agent_authorizer/integrations/argocd/actions.py +186 -0
  64. agent_authorizer/integrations/argocd/rbac/__init__.py +452 -0
  65. agent_authorizer/integrations/argocd/rbac/builtin.py +69 -0
  66. agent_authorizer/integrations/argocd/rbac/glob.py +213 -0
  67. agent_authorizer/integrations/argocd/rbac/re2.py +595 -0
  68. agent_authorizer/integrations/argocd/routes.py +564 -0
  69. agent_authorizer/integrations/aws/__init__.py +9 -0
  70. agent_authorizer/integrations/aws/actions.py +138 -0
  71. agent_authorizer/integrations/aws/aws.py +786 -0
  72. agent_authorizer/integrations/aws/eks.py +164 -0
  73. agent_authorizer/integrations/aws/identity.py +490 -0
  74. agent_authorizer/integrations/aws/routes.py +1421 -0
  75. agent_authorizer/integrations/azure/__init__.py +9 -0
  76. agent_authorizer/integrations/azure/actions.py +230 -0
  77. agent_authorizer/integrations/azure/azure.py +741 -0
  78. agent_authorizer/integrations/azure/routes.py +339 -0
  79. agent_authorizer/integrations/bitbucket/__init__.py +168 -0
  80. agent_authorizer/integrations/bitbucket/actions.py +259 -0
  81. agent_authorizer/integrations/bitbucket/cloud.py +429 -0
  82. agent_authorizer/integrations/bitbucket/common.py +108 -0
  83. agent_authorizer/integrations/bitbucket/datacenter.py +469 -0
  84. agent_authorizer/integrations/bitbucket/routes.py +557 -0
  85. agent_authorizer/integrations/confluence/__init__.py +11 -0
  86. agent_authorizer/integrations/confluence/actions.py +97 -0
  87. agent_authorizer/integrations/confluence/confluence.py +413 -0
  88. agent_authorizer/integrations/confluence/routes.py +314 -0
  89. agent_authorizer/integrations/databricks/__init__.py +9 -0
  90. agent_authorizer/integrations/databricks/actions.py +417 -0
  91. agent_authorizer/integrations/databricks/databricks.py +657 -0
  92. agent_authorizer/integrations/databricks/routes.py +525 -0
  93. agent_authorizer/integrations/datadog/__init__.py +9 -0
  94. agent_authorizer/integrations/datadog/actions.py +167 -0
  95. agent_authorizer/integrations/datadog/datadog.py +471 -0
  96. agent_authorizer/integrations/datadog/routes.py +664 -0
  97. agent_authorizer/integrations/fake.py +155 -0
  98. agent_authorizer/integrations/github/__init__.py +10 -0
  99. agent_authorizer/integrations/github/actions.py +210 -0
  100. agent_authorizer/integrations/github/github.py +1133 -0
  101. agent_authorizer/integrations/github/identity.py +553 -0
  102. agent_authorizer/integrations/github/routes.py +477 -0
  103. agent_authorizer/integrations/gitlab/__init__.py +925 -0
  104. agent_authorizer/integrations/gitlab/actions.py +222 -0
  105. agent_authorizer/integrations/gitlab/routes.py +700 -0
  106. agent_authorizer/integrations/googlecloud/__init__.py +10 -0
  107. agent_authorizer/integrations/googlecloud/actions.py +307 -0
  108. agent_authorizer/integrations/googlecloud/googlecloud.py +533 -0
  109. agent_authorizer/integrations/googlecloud/routes.py +1018 -0
  110. agent_authorizer/integrations/googleworkspace/__init__.py +10 -0
  111. agent_authorizer/integrations/googleworkspace/actions.py +83 -0
  112. agent_authorizer/integrations/googleworkspace/googleworkspace.py +880 -0
  113. agent_authorizer/integrations/googleworkspace/routes.py +654 -0
  114. agent_authorizer/integrations/jira/__init__.py +27 -0
  115. agent_authorizer/integrations/jira/actions.py +114 -0
  116. agent_authorizer/integrations/jira/jira.py +454 -0
  117. agent_authorizer/integrations/jira/routes.py +169 -0
  118. agent_authorizer/integrations/jira/site.py +219 -0
  119. agent_authorizer/integrations/kubernetes/__init__.py +503 -0
  120. agent_authorizer/integrations/kubernetes/actions.py +197 -0
  121. agent_authorizer/integrations/kubernetes/routes.py +127 -0
  122. agent_authorizer/integrations/linear/__init__.py +10 -0
  123. agent_authorizer/integrations/linear/actions.py +115 -0
  124. agent_authorizer/integrations/linear/linear.py +663 -0
  125. agent_authorizer/integrations/linear/routes.py +282 -0
  126. agent_authorizer/integrations/microsoft365/__init__.py +10 -0
  127. agent_authorizer/integrations/microsoft365/actions.py +136 -0
  128. agent_authorizer/integrations/microsoft365/microsoft365.py +1034 -0
  129. agent_authorizer/integrations/microsoft365/routes.py +866 -0
  130. agent_authorizer/integrations/okta/__init__.py +10 -0
  131. agent_authorizer/integrations/okta/okta.py +210 -0
  132. agent_authorizer/integrations/okta/routes.py +31 -0
  133. agent_authorizer/integrations/pagerduty/__init__.py +9 -0
  134. agent_authorizer/integrations/pagerduty/actions.py +140 -0
  135. agent_authorizer/integrations/pagerduty/pagerduty.py +440 -0
  136. agent_authorizer/integrations/pagerduty/routes.py +636 -0
  137. agent_authorizer/integrations/salesforce/__init__.py +13 -0
  138. agent_authorizer/integrations/salesforce/actions.py +158 -0
  139. agent_authorizer/integrations/salesforce/routes.py +405 -0
  140. agent_authorizer/integrations/salesforce/salesforce.py +1310 -0
  141. agent_authorizer/integrations/salesforce/soql.py +493 -0
  142. agent_authorizer/integrations/slack/__init__.py +10 -0
  143. agent_authorizer/integrations/slack/actions.py +84 -0
  144. agent_authorizer/integrations/slack/routes.py +269 -0
  145. agent_authorizer/integrations/slack/slack.py +967 -0
  146. agent_authorizer/integrations/snowflake/__init__.py +12 -0
  147. agent_authorizer/integrations/snowflake/actions.py +172 -0
  148. agent_authorizer/integrations/snowflake/routes.py +637 -0
  149. agent_authorizer/integrations/snowflake/snowflake.py +685 -0
  150. agent_authorizer/integrations/snowflake/sql.py +101 -0
  151. agent_authorizer/integrations/vault/__init__.py +9 -0
  152. agent_authorizer/integrations/vault/actions.py +157 -0
  153. agent_authorizer/integrations/vault/policy.py +817 -0
  154. agent_authorizer/integrations/vault/routes.py +374 -0
  155. agent_authorizer/integrations/vault/vault.py +834 -0
  156. agent_authorizer/integrations/zendesk/__init__.py +9 -0
  157. agent_authorizer/integrations/zendesk/actions.py +90 -0
  158. agent_authorizer/integrations/zendesk/routes.py +470 -0
  159. agent_authorizer/integrations/zendesk/zendesk.py +798 -0
  160. agent_authorizer/langchain.py +237 -0
  161. agent_authorizer/llamaindex.py +186 -0
  162. agent_authorizer/mcp.py +99 -0
  163. agent_authorizer/net/__init__.py +0 -0
  164. agent_authorizer/net/httpx.py +1404 -0
  165. agent_authorizer/openai_agents.py +198 -0
  166. agent_authorizer/otel.py +93 -0
  167. agent_authorizer/py.typed +0 -0
  168. agent_authorizer/pydantic_ai.py +202 -0
  169. agent_authorizer/server.py +664 -0
  170. agent_authorizer/strands.py +148 -0
  171. agent_authorizer-0.14.0.dist-info/METADATA +575 -0
  172. agent_authorizer-0.14.0.dist-info/RECORD +175 -0
  173. agent_authorizer-0.14.0.dist-info/WHEEL +4 -0
  174. agent_authorizer-0.14.0.dist-info/entry_points.txt +2 -0
  175. agent_authorizer-0.14.0.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,123 @@
1
+ """agent-authorizer: authorizes what an AI agent does against the permissions of the user it acts for.
2
+
3
+ import agent_authorizer
4
+ from agent_authorizer import Session, AgentAuthorizer, permission_check
5
+
6
+ tp = AgentAuthorizer.from_config("agent-authorizer.yaml") # permission checks, live
7
+ agent_authorizer.configure(credentials={"github-bot": token})
8
+
9
+ @agent_authorizer.tool(effect="write", scope={"repo": "acme/gitops-*"}, credential="github-bot",
10
+ authorize=permission_check(tp, "github-acme", "pr.create", "repo:{repo}"))
11
+ def open_pr(repo: str, title: str, *, credential: str) -> str: ...
12
+
13
+ with Session("dana@example.com").active():
14
+ agent.run(prompt)
15
+
16
+ ``tool`` declares a tool and runs the checks around every call;
17
+ ``Toolkit`` holds a separate set of settings when one program needs two.
18
+ ``AgentAuthorizer`` answers "may this user do this?" by asking the system that owns
19
+ the resource, in-process or against an agent-authorizer server; ``guarded`` and the
20
+ framework adapters use it on their own.
21
+ """
22
+
23
+ from agent_authorizer._api import (
24
+ ALLOW,
25
+ DENY,
26
+ UNKNOWN,
27
+ AgentAuthorizer,
28
+ Decision,
29
+ GroupsSource,
30
+ PermissionDenied,
31
+ UserSource,
32
+ current,
33
+ guarded,
34
+ )
35
+ from agent_authorizer._audit import AuditEvent, AuditSink, log_audit
36
+ from agent_authorizer._checks import ScopeRule, Validator
37
+ from agent_authorizer._context import ObservedAction, as_agent, as_user, current_call
38
+ from agent_authorizer._default import configure, default_toolkit, secured_tool, tool
39
+ from agent_authorizer._entitlements import ActionRecorder, Entitlement, Entitlements, ToolEntitlements
40
+ from agent_authorizer._fence import FENCE_END, FENCE_START, Fenced, fence, neutralize
41
+ from agent_authorizer._permissions import permission_check
42
+ from agent_authorizer._session import GROUPS_HEADER, KEY_HEADER, SESSION_HEADER, TOKEN_HEADER, USER_HEADER, Session, current_session, session_from_header
43
+ from agent_authorizer._toolkit import (
44
+ EFFECTS,
45
+ AuthDecision,
46
+ Authorizer,
47
+ Call,
48
+ CredentialSource,
49
+ Effect,
50
+ ToolError,
51
+ Toolkit,
52
+ ToolRefused,
53
+ ToolSpec,
54
+ spec_of,
55
+ )
56
+ from agent_authorizer._version import __version__
57
+ from agent_authorizer._watch import Watch, watch
58
+ from agent_authorizer._wire import ActionRefused
59
+ from agent_authorizer._wire import install as intercept
60
+ from agent_authorizer.core.secret import env, file, literal
61
+
62
+ __all__ = [
63
+ "ALLOW",
64
+ "DENY",
65
+ "EFFECTS",
66
+ "FENCE_END",
67
+ "FENCE_START",
68
+ "GROUPS_HEADER",
69
+ "KEY_HEADER",
70
+ "SESSION_HEADER",
71
+ "TOKEN_HEADER",
72
+ "UNKNOWN",
73
+ "USER_HEADER",
74
+ "ActionRecorder",
75
+ "ActionRefused",
76
+ "AgentAuthorizer",
77
+ "AuditEvent",
78
+ "AuditSink",
79
+ "AuthDecision",
80
+ "Authorizer",
81
+ "Call",
82
+ "CredentialSource",
83
+ "Decision",
84
+ "Effect",
85
+ "Entitlement",
86
+ "Entitlements",
87
+ "Fenced",
88
+ "GroupsSource",
89
+ "ObservedAction",
90
+ "PermissionDenied",
91
+ "ScopeRule",
92
+ "Session",
93
+ "ToolEntitlements",
94
+ "ToolError",
95
+ "ToolRefused",
96
+ "ToolSpec",
97
+ "Toolkit",
98
+ "UserSource",
99
+ "Validator",
100
+ "Watch",
101
+ "__version__",
102
+ "as_agent",
103
+ "as_user",
104
+ "configure",
105
+ "current",
106
+ "current_call",
107
+ "current_session",
108
+ "default_toolkit",
109
+ "env",
110
+ "fence",
111
+ "file",
112
+ "guarded",
113
+ "intercept",
114
+ "literal",
115
+ "log_audit",
116
+ "neutralize",
117
+ "permission_check",
118
+ "secured_tool",
119
+ "session_from_header",
120
+ "spec_of",
121
+ "tool",
122
+ "watch",
123
+ ]
@@ -0,0 +1,5 @@
1
+ """``python -m agent_authorizer``: the agent-authorizer command, for when its script is not on PATH."""
2
+
3
+ from agent_authorizer.cli import main
4
+
5
+ main()