agentauthlayer 0.1.2__tar.gz → 0.1.3__tar.gz

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 (40) hide show
  1. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/PKG-INFO +29 -2
  2. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/README.md +28 -1
  3. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/cli.py +48 -2
  4. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agentauthlayer.egg-info/PKG-INFO +29 -2
  5. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/pyproject.toml +1 -1
  6. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/__init__.py +0 -0
  7. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/__main__.py +0 -0
  8. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/agents.py +0 -0
  9. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/audit.py +0 -0
  10. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/auth.py +0 -0
  11. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/client.py +0 -0
  12. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/context.py +0 -0
  13. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/core.py +0 -0
  14. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/credentials.py +0 -0
  15. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/delegation.py +0 -0
  16. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/exceptions.py +0 -0
  17. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/models.py +0 -0
  18. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/policy.py +0 -0
  19. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/policy_service.py +0 -0
  20. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/principals.py +0 -0
  21. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/registry.py +0 -0
  22. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/session.py +0 -0
  23. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/storage.py +0 -0
  24. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/tokens.py +0 -0
  25. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agent_auth/users.py +0 -0
  26. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agentauthlayer.egg-info/SOURCES.txt +0 -0
  27. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agentauthlayer.egg-info/dependency_links.txt +0 -0
  28. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agentauthlayer.egg-info/entry_points.txt +0 -0
  29. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agentauthlayer.egg-info/requires.txt +0 -0
  30. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/agentauthlayer.egg-info/top_level.txt +0 -0
  31. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/setup.cfg +0 -0
  32. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_agent_auth_library.py +0 -0
  33. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_auth_flow.py +0 -0
  34. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_core_first_boundary.py +0 -0
  35. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_health.py +0 -0
  36. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_iam_policy.py +0 -0
  37. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_project_flow.py +0 -0
  38. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_sqlite_repos.py +0 -0
  39. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_storage.py +0 -0
  40. {agentauthlayer-0.1.2 → agentauthlayer-0.1.3}/tests/test_tool_registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentauthlayer
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Library-first authentication and authorization SDK for AI agents
5
5
  Author: Vaibhav Ahluwalia
6
6
  License: MIT
@@ -39,7 +39,23 @@ pip install agentauthlayer
39
39
 
40
40
  ## Quickstart
41
41
 
42
- ### 1. Log in once
42
+ ### 1. First-time developer setup
43
+
44
+ For a fresh self-hosted deployment, complete the control plane setup before using `agentauth login`.
45
+
46
+ 1. Start your Agent Auth deployment.
47
+ 2. Open the UI in your browser.
48
+ 3. Create the first super admin password.
49
+ 4. Create your first project.
50
+ 5. Then log in from the CLI.
51
+
52
+ Open the UI with:
53
+
54
+ ```bash
55
+ agentauth ui --base-url http://127.0.0.1:8002
56
+ ```
57
+
58
+ Then log in once:
43
59
 
44
60
  ```bash
45
61
  agentauth login --base-url http://127.0.0.1:8002
@@ -55,6 +71,8 @@ agentauth logout
55
71
  agentauth ui
56
72
  ```
57
73
 
74
+ If the deployment has not been initialized yet, `agentauth login` will tell you to finish setup in the UI first.
75
+
58
76
  ### 2. Define tools and agents in code
59
77
 
60
78
  ```python
@@ -111,6 +129,15 @@ export AGENT_AUTH_URL=http://127.0.0.1:8002
111
129
  export AGENT_AUTH_TOKEN=YOUR_ADMIN_OR_SERVICE_TOKEN
112
130
  ```
113
131
 
132
+ `AGENT_AUTH_TOKEN` is typically a bearer token, often represented as a long JWT string.
133
+
134
+ Recommended usage:
135
+ - use `agentauth login` for local human developer workflows
136
+ - use `AGENT_AUTH_TOKEN` for CI, automation, or service-driven execution
137
+
138
+ If an env token expires, requests will fail until you replace it or log in again.
139
+ Avoid committing tokens into source control or long-lived shared `.env` files.
140
+
114
141
  Resolution order used by `AuthAPIClient()`:
115
142
  1. explicit constructor arguments
116
143
  2. environment variables
@@ -19,7 +19,23 @@ pip install agentauthlayer
19
19
 
20
20
  ## Quickstart
21
21
 
22
- ### 1. Log in once
22
+ ### 1. First-time developer setup
23
+
24
+ For a fresh self-hosted deployment, complete the control plane setup before using `agentauth login`.
25
+
26
+ 1. Start your Agent Auth deployment.
27
+ 2. Open the UI in your browser.
28
+ 3. Create the first super admin password.
29
+ 4. Create your first project.
30
+ 5. Then log in from the CLI.
31
+
32
+ Open the UI with:
33
+
34
+ ```bash
35
+ agentauth ui --base-url http://127.0.0.1:8002
36
+ ```
37
+
38
+ Then log in once:
23
39
 
24
40
  ```bash
25
41
  agentauth login --base-url http://127.0.0.1:8002
@@ -35,6 +51,8 @@ agentauth logout
35
51
  agentauth ui
36
52
  ```
37
53
 
54
+ If the deployment has not been initialized yet, `agentauth login` will tell you to finish setup in the UI first.
55
+
38
56
  ### 2. Define tools and agents in code
39
57
 
40
58
  ```python
@@ -91,6 +109,15 @@ export AGENT_AUTH_URL=http://127.0.0.1:8002
91
109
  export AGENT_AUTH_TOKEN=YOUR_ADMIN_OR_SERVICE_TOKEN
92
110
  ```
93
111
 
112
+ `AGENT_AUTH_TOKEN` is typically a bearer token, often represented as a long JWT string.
113
+
114
+ Recommended usage:
115
+ - use `agentauth login` for local human developer workflows
116
+ - use `AGENT_AUTH_TOKEN` for CI, automation, or service-driven execution
117
+
118
+ If an env token expires, requests will fail until you replace it or log in again.
119
+ Avoid committing tokens into source control or long-lived shared `.env` files.
120
+
94
121
  Resolution order used by `AuthAPIClient()`:
95
122
  1. explicit constructor arguments
96
123
  2. environment variables
@@ -14,10 +14,48 @@ from agent_auth.credentials import clear_credentials, load_credentials, save_cre
14
14
  from agent_auth.registry import clear_registries, list_registered_agents, list_registered_tools
15
15
 
16
16
 
17
+ def _response_detail(response: requests.Response) -> str:
18
+ try:
19
+ payload = response.json()
20
+ if isinstance(payload, dict) and payload.get('detail'):
21
+ return str(payload['detail'])
22
+ except Exception:
23
+ pass
24
+ return response.text.strip() or f'Request failed with status {response.status_code}'
25
+
26
+
27
+ def _bootstrap_status(base_url: str) -> bool | None:
28
+ try:
29
+ response = requests.get(f"{base_url}/bootstrap/status", timeout=10)
30
+ except requests.RequestException:
31
+ return None
32
+ if not response.ok:
33
+ return None
34
+ try:
35
+ payload = response.json()
36
+ return bool(payload.get('is_setup'))
37
+ except Exception:
38
+ return None
39
+
40
+
17
41
  def login_command(args) -> int:
42
+ base_url = (args.base_url or 'http://127.0.0.1:8002').rstrip('/')
43
+ setup_status = _bootstrap_status(base_url)
44
+
45
+ if setup_status is False:
46
+ print(
47
+ '\nThis Agent Auth deployment has not been initialized yet.\n'
48
+ 'First-time developer setup:\n'
49
+ f' 1. Open the UI: {base_url}\n'
50
+ ' 2. Create the first super admin password\n'
51
+ ' 3. Create your first project\n'
52
+ ' 4. Run agentauth login again\n',
53
+ file=sys.stderr,
54
+ )
55
+ return 1
56
+
18
57
  email = args.email or input('Email: ').strip()
19
58
  password = args.password or getpass.getpass('Password: ')
20
- base_url = (args.base_url or 'http://127.0.0.1:8002').rstrip('/')
21
59
 
22
60
  response = requests.post(
23
61
  f"{base_url}/users/login",
@@ -25,7 +63,15 @@ def login_command(args) -> int:
25
63
  timeout=30,
26
64
  )
27
65
  if not response.ok:
28
- print(response.text, file=sys.stderr)
66
+ detail = _response_detail(response)
67
+ if response.status_code == 401 and setup_status is not True:
68
+ print(
69
+ f"{detail}\n\n"
70
+ 'If this is your first time using this deployment, initialize it first in the UI, then try logging in again.',
71
+ file=sys.stderr,
72
+ )
73
+ else:
74
+ print(detail, file=sys.stderr)
29
75
  return 1
30
76
 
31
77
  payload = response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentauthlayer
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Library-first authentication and authorization SDK for AI agents
5
5
  Author: Vaibhav Ahluwalia
6
6
  License: MIT
@@ -39,7 +39,23 @@ pip install agentauthlayer
39
39
 
40
40
  ## Quickstart
41
41
 
42
- ### 1. Log in once
42
+ ### 1. First-time developer setup
43
+
44
+ For a fresh self-hosted deployment, complete the control plane setup before using `agentauth login`.
45
+
46
+ 1. Start your Agent Auth deployment.
47
+ 2. Open the UI in your browser.
48
+ 3. Create the first super admin password.
49
+ 4. Create your first project.
50
+ 5. Then log in from the CLI.
51
+
52
+ Open the UI with:
53
+
54
+ ```bash
55
+ agentauth ui --base-url http://127.0.0.1:8002
56
+ ```
57
+
58
+ Then log in once:
43
59
 
44
60
  ```bash
45
61
  agentauth login --base-url http://127.0.0.1:8002
@@ -55,6 +71,8 @@ agentauth logout
55
71
  agentauth ui
56
72
  ```
57
73
 
74
+ If the deployment has not been initialized yet, `agentauth login` will tell you to finish setup in the UI first.
75
+
58
76
  ### 2. Define tools and agents in code
59
77
 
60
78
  ```python
@@ -111,6 +129,15 @@ export AGENT_AUTH_URL=http://127.0.0.1:8002
111
129
  export AGENT_AUTH_TOKEN=YOUR_ADMIN_OR_SERVICE_TOKEN
112
130
  ```
113
131
 
132
+ `AGENT_AUTH_TOKEN` is typically a bearer token, often represented as a long JWT string.
133
+
134
+ Recommended usage:
135
+ - use `agentauth login` for local human developer workflows
136
+ - use `AGENT_AUTH_TOKEN` for CI, automation, or service-driven execution
137
+
138
+ If an env token expires, requests will fail until you replace it or log in again.
139
+ Avoid committing tokens into source control or long-lived shared `.env` files.
140
+
114
141
  Resolution order used by `AuthAPIClient()`:
115
142
  1. explicit constructor arguments
116
143
  2. environment variables
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agentauthlayer"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  description = "Library-first authentication and authorization SDK for AI agents"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes