anlyon 0.1.0__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 (57) hide show
  1. anlyon-0.1.0/.gitignore +35 -0
  2. anlyon-0.1.0/LICENSE +21 -0
  3. anlyon-0.1.0/PKG-INFO +134 -0
  4. anlyon-0.1.0/README.md +100 -0
  5. anlyon-0.1.0/pyproject.toml +65 -0
  6. anlyon-0.1.0/src/anlyon/__init__.py +51 -0
  7. anlyon-0.1.0/src/anlyon/client.py +538 -0
  8. anlyon-0.1.0/src/anlyon/config.py +24 -0
  9. anlyon-0.1.0/src/anlyon/errors.py +181 -0
  10. anlyon-0.1.0/src/anlyon/http.py +498 -0
  11. anlyon-0.1.0/src/anlyon/integrations/__init__.py +11 -0
  12. anlyon-0.1.0/src/anlyon/integrations/openai_agents.py +168 -0
  13. anlyon-0.1.0/src/anlyon/py.typed +0 -0
  14. anlyon-0.1.0/src/anlyon/receiver.py +103 -0
  15. anlyon-0.1.0/src/anlyon/resources/__init__.py +87 -0
  16. anlyon-0.1.0/src/anlyon/resources/actions.py +372 -0
  17. anlyon-0.1.0/src/anlyon/resources/analytics.py +298 -0
  18. anlyon-0.1.0/src/anlyon/resources/approvals.py +383 -0
  19. anlyon-0.1.0/src/anlyon/resources/base.py +131 -0
  20. anlyon-0.1.0/src/anlyon/resources/billing.py +68 -0
  21. anlyon-0.1.0/src/anlyon/resources/budgets.py +100 -0
  22. anlyon-0.1.0/src/anlyon/resources/cache.py +212 -0
  23. anlyon-0.1.0/src/anlyon/resources/connect.py +495 -0
  24. anlyon-0.1.0/src/anlyon/resources/context.py +98 -0
  25. anlyon-0.1.0/src/anlyon/resources/dlq.py +66 -0
  26. anlyon-0.1.0/src/anlyon/resources/environment.py +87 -0
  27. anlyon-0.1.0/src/anlyon/resources/events.py +355 -0
  28. anlyon-0.1.0/src/anlyon/resources/files.py +228 -0
  29. anlyon-0.1.0/src/anlyon/resources/flow_control.py +161 -0
  30. anlyon-0.1.0/src/anlyon/resources/integrations.py +117 -0
  31. anlyon-0.1.0/src/anlyon/resources/logs.py +95 -0
  32. anlyon-0.1.0/src/anlyon/resources/memory.py +642 -0
  33. anlyon-0.1.0/src/anlyon/resources/messages.py +245 -0
  34. anlyon-0.1.0/src/anlyon/resources/notifications.py +96 -0
  35. anlyon-0.1.0/src/anlyon/resources/queues.py +104 -0
  36. anlyon-0.1.0/src/anlyon/resources/runs.py +303 -0
  37. anlyon-0.1.0/src/anlyon/resources/schedules.py +155 -0
  38. anlyon-0.1.0/src/anlyon/resources/secrets.py +72 -0
  39. anlyon-0.1.0/src/anlyon/resources/sessions.py +295 -0
  40. anlyon-0.1.0/src/anlyon/resources/url_groups.py +169 -0
  41. anlyon-0.1.0/src/anlyon/resources/workflows.py +359 -0
  42. anlyon-0.1.0/src/anlyon/response.py +81 -0
  43. anlyon-0.1.0/tests/test_agent.py +508 -0
  44. anlyon-0.1.0/tests/test_cache.py +143 -0
  45. anlyon-0.1.0/tests/test_connect.py +234 -0
  46. anlyon-0.1.0/tests/test_contract_parity.py +242 -0
  47. anlyon-0.1.0/tests/test_events.py +211 -0
  48. anlyon-0.1.0/tests/test_files.py +168 -0
  49. anlyon-0.1.0/tests/test_idempotency.py +100 -0
  50. anlyon-0.1.0/tests/test_memory.py +217 -0
  51. anlyon-0.1.0/tests/test_messages.py +66 -0
  52. anlyon-0.1.0/tests/test_openai_agents_session.py +198 -0
  53. anlyon-0.1.0/tests/test_receiver.py +78 -0
  54. anlyon-0.1.0/tests/test_retry_and_jobs.py +145 -0
  55. anlyon-0.1.0/tests/test_runs.py +129 -0
  56. anlyon-0.1.0/tests/test_stream.py +71 -0
  57. anlyon-0.1.0/tests/test_workflows.py +303 -0
@@ -0,0 +1,35 @@
1
+ node_modules/
2
+ # pnpm puts its content-addressable store beside the project when HOME is
3
+ # on a different filesystem, which is what happens inside a container. It is
4
+ # ~2GB and ~100k files, and .dockerignore already excludes it from builds --
5
+ # this keeps it out of commits too.
6
+ .pnpm-store/
7
+ dist/
8
+ build/
9
+ .next/
10
+ coverage/
11
+ *.tsbuildinfo
12
+
13
+ # Python
14
+ __pycache__/
15
+ *.egg-info/
16
+ .venv/
17
+ .mypy_cache/
18
+ .pytest_cache/
19
+ .ruff_cache/
20
+
21
+ # Env
22
+ .env
23
+ .env.*
24
+ !.env.example
25
+ skills-lock.json
26
+
27
+ # Local MCP / tool overrides (may contain secrets never commit)
28
+ *.local.json
29
+ .mcp.local.json
30
+
31
+ # Local agent tooling config, not part of the build.
32
+ .commandcode/
33
+
34
+ # Redis snapshot left behind by a locally-run redis-server.
35
+ dump.rdb
anlyon-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anlyon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
anlyon-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.5
2
+ Name: anlyon
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for Anlyon — the trust and control plane for AI agents: approvals, budgets, audit trails and an environment kill switch
5
+ Project-URL: Homepage, https://anlyon.com
6
+ Project-URL: Documentation, https://docs.anlyon.com
7
+ Project-URL: Repository, https://github.com/AnlyonHQ/anlyon-platform
8
+ Project-URL: Issues, https://github.com/AnlyonHQ/anlyon-platform/issues
9
+ Project-URL: Changelog, https://docs.anlyon.com/changelog
10
+ Author-email: Anlyon <support@anlyon.com>
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: agent-governance,ai-agents,ai-safety,anlyon,approvals,audit-log,guardrails,human-in-the-loop,memory,message-queue,observability,rag,sdk,vector-search,webhook
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: httpx>=0.27
25
+ Requires-Dist: pydantic>=2.5
26
+ Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
27
+ Provides-Extra: dev
28
+ Requires-Dist: mypy>=1.10; extra == 'dev'
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
30
+ Requires-Dist: pytest>=8.0; extra == 'dev'
31
+ Requires-Dist: respx>=0.21; extra == 'dev'
32
+ Requires-Dist: ruff>=0.16.4; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Anlyon Python SDK
36
+
37
+ Official Python SDK for [Anlyon](https://anlyon.com) AI backend primitives.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install anlyon
43
+ ```
44
+
45
+ ## Quick start
46
+
47
+ ```python
48
+ from anlyon import Client
49
+
50
+ client = Client(api_key="anlyon_live_xxx") # or set ANLYON_API_KEY
51
+
52
+ # Store a memory
53
+ client.memory.remember(content="The customer prefers email over phone.")
54
+
55
+ # Recall by meaning successful calls expose the canonical response envelope
56
+ result = client.memory.recall(query="how should we contact this customer?")
57
+ for r in result.data["results"]:
58
+ print(r["score"], r["content"])
59
+
60
+ client.close()
61
+ ```
62
+
63
+ ## Async
64
+
65
+ ```python
66
+ import asyncio
67
+ from anlyon import AsyncClient
68
+
69
+ async def main():
70
+ async with AsyncClient(api_key="anlyon_live_xxx") as client:
71
+ await client.memory.remember(content="The customer prefers email.")
72
+ result = await client.memory.recall(query="contact preference?")
73
+ print(result.data["results"])
74
+
75
+ asyncio.run(main())
76
+ ```
77
+
78
+ ## Configuration
79
+
80
+ ```python
81
+ from anlyon import Client, RetryConfig
82
+
83
+ client = Client(
84
+ api_key="anlyon_live_xxx", # falls back to ANLYON_API_KEY
85
+ base_url="http://localhost:4000", # falls back to ANLYON_BASE_URL
86
+ timeout=10.0,
87
+ retry=RetryConfig(max_attempts=5),
88
+ )
89
+ ```
90
+
91
+ ## Resources
92
+
93
+ - `client.memory` remember, remember_many, recall, forget, ingest, upload_file, summarize, consolidate, jobs, collections
94
+ - `client.messages` publish, publish_batch, list, get, cancel
95
+ - `client.queues`, `client.schedules`, `client.url_groups`, `client.dlq` durable delivery controls
96
+ - `client.workflows` create, list, get, update, delete, trigger, list_runs, get_run, list_run_steps, cancel_run, notify
97
+ - `client.events` publish, list, get, topics CRUD, subscriptions
98
+ - `client.files` upload, presign, download, list, get, delete
99
+ - `client.cache` lookup, store, list, get, delete, flush (semantic cache)
100
+ - `client.sessions`, `client.context` persistent conversations and token-budgeted context
101
+ - `client.secrets`, `client.actions`, `client.approvals`, `client.budgets` agent tools and controls
102
+ - `client.analytics`, `client.logs` usage, delivery analytics, redacted execution history, exports
103
+ - `client.billing`, `client.notifications` provider-safe billing state and notification preferences
104
+ - `client.flow_control`, `client.integrations` rate/concurrency controls and Slack/Discord delivery
105
+
106
+ Write operations accept an `idempotency_key` so automatic retries can never double-write:
107
+
108
+ ```python
109
+ client.memory.remember(content="...", idempotency_key="user-123-pref")
110
+ client.messages.publish(url="https://example.com/hook", idempotency_key="order-456")
111
+ ```
112
+
113
+ ## Error handling
114
+
115
+ Successful calls return `ApiResponse` with `success`, `data`, `pagination`,
116
+ `stats`, and `request_id`, matching the HTTP contract and TypeScript SDK.
117
+ For compatibility with the 0.1 release, indexing, iteration, `get()`, `len()`,
118
+ and equality delegate to `response.data`; new code should use
119
+ `response.data` explicitly. The legacy shortcut is deprecated for removal in
120
+ the next major release.
121
+
122
+ Failed requests raise typed exceptions (never return an error envelope):
123
+
124
+ ```python
125
+ from anlyon import Client, NotFoundError, RateLimitError
126
+
127
+ client = Client(api_key="anlyon_live_xxx")
128
+ try:
129
+ client.memory.get("mem_missing")
130
+ except NotFoundError:
131
+ print("Not found")
132
+ except RateLimitError as e:
133
+ print(f"Rate limited, retry after {e.retry_after}s")
134
+ ```
anlyon-0.1.0/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Anlyon Python SDK
2
+
3
+ Official Python SDK for [Anlyon](https://anlyon.com) AI backend primitives.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install anlyon
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```python
14
+ from anlyon import Client
15
+
16
+ client = Client(api_key="anlyon_live_xxx") # or set ANLYON_API_KEY
17
+
18
+ # Store a memory
19
+ client.memory.remember(content="The customer prefers email over phone.")
20
+
21
+ # Recall by meaning successful calls expose the canonical response envelope
22
+ result = client.memory.recall(query="how should we contact this customer?")
23
+ for r in result.data["results"]:
24
+ print(r["score"], r["content"])
25
+
26
+ client.close()
27
+ ```
28
+
29
+ ## Async
30
+
31
+ ```python
32
+ import asyncio
33
+ from anlyon import AsyncClient
34
+
35
+ async def main():
36
+ async with AsyncClient(api_key="anlyon_live_xxx") as client:
37
+ await client.memory.remember(content="The customer prefers email.")
38
+ result = await client.memory.recall(query="contact preference?")
39
+ print(result.data["results"])
40
+
41
+ asyncio.run(main())
42
+ ```
43
+
44
+ ## Configuration
45
+
46
+ ```python
47
+ from anlyon import Client, RetryConfig
48
+
49
+ client = Client(
50
+ api_key="anlyon_live_xxx", # falls back to ANLYON_API_KEY
51
+ base_url="http://localhost:4000", # falls back to ANLYON_BASE_URL
52
+ timeout=10.0,
53
+ retry=RetryConfig(max_attempts=5),
54
+ )
55
+ ```
56
+
57
+ ## Resources
58
+
59
+ - `client.memory` remember, remember_many, recall, forget, ingest, upload_file, summarize, consolidate, jobs, collections
60
+ - `client.messages` publish, publish_batch, list, get, cancel
61
+ - `client.queues`, `client.schedules`, `client.url_groups`, `client.dlq` durable delivery controls
62
+ - `client.workflows` create, list, get, update, delete, trigger, list_runs, get_run, list_run_steps, cancel_run, notify
63
+ - `client.events` publish, list, get, topics CRUD, subscriptions
64
+ - `client.files` upload, presign, download, list, get, delete
65
+ - `client.cache` lookup, store, list, get, delete, flush (semantic cache)
66
+ - `client.sessions`, `client.context` persistent conversations and token-budgeted context
67
+ - `client.secrets`, `client.actions`, `client.approvals`, `client.budgets` agent tools and controls
68
+ - `client.analytics`, `client.logs` usage, delivery analytics, redacted execution history, exports
69
+ - `client.billing`, `client.notifications` provider-safe billing state and notification preferences
70
+ - `client.flow_control`, `client.integrations` rate/concurrency controls and Slack/Discord delivery
71
+
72
+ Write operations accept an `idempotency_key` so automatic retries can never double-write:
73
+
74
+ ```python
75
+ client.memory.remember(content="...", idempotency_key="user-123-pref")
76
+ client.messages.publish(url="https://example.com/hook", idempotency_key="order-456")
77
+ ```
78
+
79
+ ## Error handling
80
+
81
+ Successful calls return `ApiResponse` with `success`, `data`, `pagination`,
82
+ `stats`, and `request_id`, matching the HTTP contract and TypeScript SDK.
83
+ For compatibility with the 0.1 release, indexing, iteration, `get()`, `len()`,
84
+ and equality delegate to `response.data`; new code should use
85
+ `response.data` explicitly. The legacy shortcut is deprecated for removal in
86
+ the next major release.
87
+
88
+ Failed requests raise typed exceptions (never return an error envelope):
89
+
90
+ ```python
91
+ from anlyon import Client, NotFoundError, RateLimitError
92
+
93
+ client = Client(api_key="anlyon_live_xxx")
94
+ try:
95
+ client.memory.get("mem_missing")
96
+ except NotFoundError:
97
+ print("Not found")
98
+ except RateLimitError as e:
99
+ print(f"Rate limited, retry after {e.retry_after}s")
100
+ ```
@@ -0,0 +1,65 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "anlyon"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for Anlyon — the trust and control plane for AI agents: approvals, budgets, audit trails and an environment kill switch"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "Anlyon", email = "support@anlyon.com" }]
13
+ keywords = [
14
+ "anlyon", "ai-agents", "agent-governance", "human-in-the-loop", "approvals",
15
+ "audit-log", "guardrails", "ai-safety", "observability", "memory",
16
+ "vector-search", "rag", "message-queue", "webhook", "sdk",
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Typing :: Typed",
28
+ ]
29
+ dependencies = [
30
+ "httpx>=0.27",
31
+ "pydantic>=2.5",
32
+ "typing-extensions>=4.0;python_version<'3.11'",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "pytest>=8.0",
38
+ "pytest-asyncio>=0.23",
39
+ "respx>=0.21",
40
+ "ruff>=0.16.4",
41
+ "mypy>=1.10",
42
+ ]
43
+
44
+ [project.urls]
45
+ Homepage = "https://anlyon.com"
46
+ Documentation = "https://docs.anlyon.com"
47
+ Repository = "https://github.com/AnlyonHQ/anlyon-platform"
48
+ Issues = "https://github.com/AnlyonHQ/anlyon-platform/issues"
49
+ Changelog = "https://docs.anlyon.com/changelog"
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/anlyon"]
53
+
54
+ [tool.pytest.ini_options]
55
+ asyncio_mode = "auto"
56
+ testpaths = ["tests"]
57
+
58
+ [tool.ruff]
59
+ target-version = "py310"
60
+ line-length = 100
61
+
62
+ [tool.mypy]
63
+ python_version = "3.10"
64
+ strict = true
65
+ warn_unused_ignores = true
@@ -0,0 +1,51 @@
1
+ """
2
+ Anlyon Python SDK AI backend primitives (Memory, Queues, Workflows, Events, Files, Semantic Cache).
3
+
4
+ from anlyon import Client
5
+
6
+ client = Client(api_key="anlyon_live_xxx")
7
+ client.memory.remember(content="The customer prefers email.")
8
+ result = client.memory.recall(query="how to contact the customer?")
9
+ client.close()
10
+ """
11
+
12
+ from .client import AsyncClient, Client
13
+ from .config import AnlyonClientConfig, RetryConfig
14
+ from .errors import (
15
+ AnlyonError,
16
+ ApprovalDeniedError,
17
+ ApprovalPendingError,
18
+ AuthenticationError,
19
+ FeatureNotAvailableError,
20
+ NetworkError,
21
+ NotFoundError,
22
+ QuotaExceededError,
23
+ RateLimitError,
24
+ TimeoutError,
25
+ ValidationError,
26
+ )
27
+ from .receiver import Receiver, SignatureVerificationError
28
+ from .response import ApiResponse
29
+
30
+ __version__ = "0.1.0"
31
+
32
+ __all__ = [
33
+ "AnlyonClientConfig",
34
+ "AnlyonError",
35
+ "ApiResponse",
36
+ "ApprovalDeniedError",
37
+ "ApprovalPendingError",
38
+ "AsyncClient",
39
+ "AuthenticationError",
40
+ "Client",
41
+ "FeatureNotAvailableError",
42
+ "NetworkError",
43
+ "NotFoundError",
44
+ "QuotaExceededError",
45
+ "RateLimitError",
46
+ "Receiver",
47
+ "RetryConfig",
48
+ "SignatureVerificationError",
49
+ "TimeoutError",
50
+ "ValidationError",
51
+ ]