iagenify 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.
- iagenify-0.1.0/.gitignore +47 -0
- iagenify-0.1.0/CHANGELOG.md +18 -0
- iagenify-0.1.0/LICENSE +204 -0
- iagenify-0.1.0/PKG-INFO +188 -0
- iagenify-0.1.0/README.md +164 -0
- iagenify-0.1.0/pyproject.toml +38 -0
- iagenify-0.1.0/src/iagenify/__init__.py +113 -0
- iagenify-0.1.0/src/iagenify/client.py +229 -0
- iagenify-0.1.0/src/iagenify/errors.py +31 -0
- iagenify-0.1.0/src/iagenify/prompt.py +103 -0
- iagenify-0.1.0/src/iagenify/resources.py +1823 -0
- iagenify-0.1.0/src/iagenify/service_tools.py +1057 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Secrets and machine-specific configuration. Keep the documented .env.example files.
|
|
2
|
+
.env
|
|
3
|
+
.env.local
|
|
4
|
+
.env.access
|
|
5
|
+
.env.backup-*
|
|
6
|
+
.env.*.local
|
|
7
|
+
|
|
8
|
+
# Dependencies and framework build output.
|
|
9
|
+
**/node_modules/
|
|
10
|
+
**/.next/
|
|
11
|
+
**/.next-*/
|
|
12
|
+
**/.next_*/
|
|
13
|
+
**/out/
|
|
14
|
+
**/dist/
|
|
15
|
+
**/dist-*/
|
|
16
|
+
**/.wrangler/
|
|
17
|
+
**/coverage/
|
|
18
|
+
**/__pycache__/
|
|
19
|
+
**/.pytest_cache/
|
|
20
|
+
|
|
21
|
+
# Runtime data, uploads, local databases, logs and editor files.
|
|
22
|
+
data/files/
|
|
23
|
+
cloud/objects/
|
|
24
|
+
api/settings.yml
|
|
25
|
+
**/uploads/
|
|
26
|
+
*.log
|
|
27
|
+
*.log.err
|
|
28
|
+
**/.wrangler-deploy.err
|
|
29
|
+
.DS_Store
|
|
30
|
+
Thumbs.db
|
|
31
|
+
|
|
32
|
+
# Local backups, temporary exports and generated release bundles.
|
|
33
|
+
/auth-release.tar.gz
|
|
34
|
+
/api/src/invoices/*.pdf
|
|
35
|
+
/pay/backup-*.sql
|
|
36
|
+
**/scripts/livraisons.json
|
|
37
|
+
/developers/.localization/
|
|
38
|
+
/deliverables/
|
|
39
|
+
/tmp/
|
|
40
|
+
/internships/documents_stages/
|
|
41
|
+
/desktop/release/
|
|
42
|
+
|
|
43
|
+
# Private credentials and generated certificates.
|
|
44
|
+
*.pem
|
|
45
|
+
*.key
|
|
46
|
+
*.p12
|
|
47
|
+
*.pfx
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
- Initial Python package and PyPI metadata.
|
|
6
|
+
- Synchronous HTTP client, API-key exchange, refresh sessions, typed errors, and file-backed session storage.
|
|
7
|
+
- Resource clients for auth, keys, models, memory, files, storage, Cloud, search, fetch, convert, agents, workflows, domains, mail, hosts, compute, and MCP.
|
|
8
|
+
- Python workspace files and a Python-native local agent loop with permission callbacks, workspace and service tools, web search/fetch, image inputs, custom tools, and MCP injection.
|
|
9
|
+
- Durable local agent session journals, session reopening, checkpoint snapshots, rewind, conversation history, and billable context compaction.
|
|
10
|
+
- Python exports for prompt parsing, token-count parsing, storage slugs, schema sanitizing, MCP tool declarations, and media option metadata.
|
|
11
|
+
- Agent tool declaration helpers for documents, storage, and media; media declarations do not invent standalone API endpoints.
|
|
12
|
+
- The seven platform-service agent tools of the JavaScript engine: `deploy`, `mail`, `send_mail`, `domain`, `cloud`, `document`, `generate`, with guard checks before any permission prompt.
|
|
13
|
+
- JavaScript permission rules: `send`, `publish` and `money` asked on every call in every mode; "always" scoped to one storage or one domain; `bash` "always" saved to the shared `~/.iagenify/permissions.json`; `permission` and `permission_result` events.
|
|
14
|
+
- P82: `Mailbox.send(bcc=..., attachments=[...])`, nodemailer-shaped, 25 MB in all; `encode_attachments` exported.
|
|
15
|
+
- Not yet in Python: the server-side session record for cross-device reopening, and the `iagenify_docs` / `mcp` management tools.
|
|
16
|
+
- JavaScript parity found while writing the documentation's Python examples: `agent.usage`; `run(edit=n)` now rewinds before sending (the argument was accepted and ignored); `api.mcp.get(name, refresh=True)`; `api.mcp.for_agent([])` answers `[]` without a request; `api.tools.all` lists the service tools too.
|
|
17
|
+
- Fixed: a computer storage that is not this machine had this machine's files (`files` is now `None` there, as JavaScript refuses it); the server agent's `write_document` in `update`/`append` mode crashed on a missing attribute.
|
|
18
|
+
|
iagenify-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Copyright 2026 IaGenify LLC
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
38
|
+
Object form, made available under the License, as indicated by a
|
|
39
|
+
copyright notice that is included in or attached to the work
|
|
40
|
+
(an example is provided in the Appendix below).
|
|
41
|
+
|
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
43
|
+
form, that is based on (or derived from) the Work and for which the
|
|
44
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
45
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
46
|
+
of this License, Derivative Works shall not include works that remain
|
|
47
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
48
|
+
the Work and Derivative Works thereof.
|
|
49
|
+
|
|
50
|
+
"Contribution" shall mean any work of authorship, including
|
|
51
|
+
the original version of the Work and any modifications or additions
|
|
52
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
53
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
54
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
55
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
56
|
+
means any form of electronic, verbal, or written communication sent
|
|
57
|
+
to the Licensor or its representatives, including but not limited to
|
|
58
|
+
communication on electronic mailing lists, source code control systems,
|
|
59
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
60
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
61
|
+
excluding communication that is conspicuously marked or otherwise
|
|
62
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
65
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
66
|
+
subsequently incorporated within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent claims licensable
|
|
81
|
+
by such Contributor that are necessarily infringed by their
|
|
82
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
83
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
84
|
+
institute patent litigation against any entity (including a
|
|
85
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
86
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
87
|
+
or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate
|
|
89
|
+
as of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or
|
|
97
|
+
Derivative Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, then any Derivative Works that You distribute must
|
|
110
|
+
include a readable copy of the attribution notices contained
|
|
111
|
+
within such NOTICE file, excluding those notices that do not
|
|
112
|
+
pertain to any part of the Derivative Works, in at least one
|
|
113
|
+
of the following places: within a NOTICE text file distributed
|
|
114
|
+
as part of the Derivative Works; within the Source form or
|
|
115
|
+
documentation, if provided along with the Derivative Works; or,
|
|
116
|
+
within a display generated by the Derivative Works, if and
|
|
117
|
+
wherever such third-party notices normally appear. The contents
|
|
118
|
+
of the NOTICE file are for informational purposes only and
|
|
119
|
+
do not modify the License. You may add Your own attribution
|
|
120
|
+
notices within Derivative Works that You distribute, alongside
|
|
121
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as modifying the License.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright statement to Your modifications and
|
|
126
|
+
may provide additional or different license terms and conditions
|
|
127
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
128
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
129
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
130
|
+
the conditions stated in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
|
204
|
+
|
iagenify-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: iagenify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the IaGenify AI platform
|
|
5
|
+
Project-URL: Homepage, https://iagenify.com
|
|
6
|
+
Project-URL: Documentation, https://developers.iagenify.com/sdk/python
|
|
7
|
+
Author-email: IaGenify LLC <contact@iagenify.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,ai,iagenify,llm,workflows
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: httpx<1,>=0.27
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# IaGenify Python SDK
|
|
26
|
+
|
|
27
|
+
The official Python client for the IaGenify API. It follows the JavaScript SDK's resource layout and uses familiar Python keyword arguments:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
import os
|
|
31
|
+
from iagenify import IaGenify
|
|
32
|
+
|
|
33
|
+
api = IaGenify(api_key=os.environ["IAGENIFY_API_KEY"])
|
|
34
|
+
|
|
35
|
+
assistant = api.models.create(
|
|
36
|
+
model="gemini-3.5-flash",
|
|
37
|
+
settings={"role": "Expert coder", "instructions": "Answer briefly"},
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
result = assistant.generate(
|
|
41
|
+
inputs=[{"type": "text", "content": "Write a sort function"}]
|
|
42
|
+
)
|
|
43
|
+
print(result)
|
|
44
|
+
api.close()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python -m pip install iagenify
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Python 3.10 or newer is required. The package uses `httpx` for HTTP requests and works in scripts, notebooks, and Python server applications. This release is synchronous: SDK calls return their results directly and do not require `await`.
|
|
54
|
+
|
|
55
|
+
## Python runtimes and frameworks
|
|
56
|
+
|
|
57
|
+
The SDK is a regular Python package, not a framework adapter. It works anywhere CPython 3.10+ can make outbound HTTPS requests: scripts, notebooks, CLI tools, and server applications built with FastAPI, Django, or Flask. It does not generate Python UI components like React; Python is the server, automation, and AI-agent side of an application. The SDK is synchronous, so in an async web handler run blocking SDK calls in the framework's worker thread. `api.hosts` currently deploys static sites and edge JavaScript modules; it does not host persistent Python web servers.
|
|
58
|
+
|
|
59
|
+
Use a context manager when you want the HTTP connection closed automatically:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
with IaGenify(api_key=os.environ["IAGENIFY_API_KEY"]) as api:
|
|
63
|
+
user = api.get_user()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Resources
|
|
67
|
+
|
|
68
|
+
The client exposes `auth`, `keys`, `models`, `memory`, `files`, `storage`, `cloud`, `search`, `fetch`, `convert`, `agents`, `workflows`, `domains`, `mail`, `hosts`, `compute`, and `mcp`.
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
api.models.create(model="gemini-3.5-flash")
|
|
72
|
+
api.storage.get()
|
|
73
|
+
api.domains.search("my-brand", tlds=["com", "tn"])
|
|
74
|
+
api.workflows.list()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See the [IaGenify SDK guide](https://developers.iagenify.com/sdk) for service concepts and Python examples, and the [API reference](https://developers.iagenify.com/api) for HTTP contracts. Python examples document Python behavior; they do not imply support for JavaScript-only runtimes or methods.
|
|
78
|
+
|
|
79
|
+
## Model turns and streaming
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
turn = api.models.turn(
|
|
83
|
+
model="gemini-3.5-flash",
|
|
84
|
+
messages=[{"role": "user", "content": "Explain Python decorators in one paragraph."}],
|
|
85
|
+
)
|
|
86
|
+
print(turn["message"]["content"])
|
|
87
|
+
|
|
88
|
+
streamed = api.models.turn(
|
|
89
|
+
model="gemini-3.5-flash",
|
|
90
|
+
messages=[{"role": "user", "content": "Give me a short greeting."}],
|
|
91
|
+
on_text=lambda delta: print(delta, end="", flush=True),
|
|
92
|
+
)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Agents
|
|
96
|
+
|
|
97
|
+
The server-executed agent follows the JavaScript SDK's default `agents.create()` contract:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
model = api.models.create(model="gemini-3.5-flash", memory=False)
|
|
101
|
+
agent = api.agents.create(model=model, tools={"search": api.tools.search}, max_steps=8, budget=30)
|
|
102
|
+
result = agent.run(
|
|
103
|
+
inputs=[{"type": "text", "content": "Find three recent sources about Python packaging."}],
|
|
104
|
+
on_step=lambda step: print(step),
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The Python `runtime="local"` agent runs a Python-native model/tool loop. It supports the workspace tools `read`, `list`, `glob`, `grep`, `write`, `edit`, `move`, `delete`, web `search` and `fetch`, custom Python callables, and authorized MCP tools. Writes require permission by default; provide `on_permission` or set `mode="auto"` for workspace writes. Paid tools require an approval callback. Set `memory=True` to persist the session journal on the local machine; reopen it with `api.agents.get(session_id, machine=...)` or `files=...`. Local sessions remain on that machine and workspace.
|
|
109
|
+
|
|
110
|
+
The local agent includes durable local session history, image inputs, workspace checkpoints and rewind (including partial-snapshot diagnostics), custom Python tools, MCP injection, skill invocation, sub-agent delegation, shell commands, storage and document tools, workflow execution, and image, video, voice, and music generation. It also carries the JavaScript engine's seven platform-service tools: `deploy` (hosting), `mail` (read and manage mailboxes), `send_mail` (HTML, Bcc and attachments), `domain` (DNS, mail records, DNSSEC, redirects), `cloud` (storages, space, live price grid), `document` (semantic indexing) and `generate` (a second model for volume work).
|
|
111
|
+
|
|
112
|
+
Permissions follow the JavaScript engine: `read` is free; `write` is free in `auto`; `storage` and `dns` are asked even in `auto`, and "always" applies to that one storage or domain; `send`, `publish` and `money` are asked on every call, in every mode including `full`, and "always" never sticks. An "always" on a `bash` command is saved to `~/.iagenify/permissions.json`, the file the JavaScript engine reads too. Guard checks (an `NS` record, an executable attachment, a malformed address) refuse before anyone is asked.
|
|
113
|
+
|
|
114
|
+
Not yet in Python: the server-side session record that lets a JavaScript agent session be reopened on another device (Python journals stay on the machine that ran them), and the `iagenify_docs` and `mcp` management tools. Its context meter estimates token use for clearing and compaction, while the context-window limit is read from the model catalogue when available. Local terminals are also available separately through `LocalTerminals`; account and computer skill/sub-agent libraries are exposed through `api.agents.skills` and `api.agents.subagents`.
|
|
115
|
+
|
|
116
|
+
The Python package exports `parsePrompt`, `parseTokenCount`, `storageSlug`, `PROMPT_OPTIONS`, `MEDIA_OPTIONS`, `sanitizeSchema`, `toolNameFor`, and `createMcpTools` for the corresponding JavaScript SDK helpers. Prefer the Pythonic snake_case aliases where offered: `parse_prompt`, `parse_token_count`, `storage_slug`, `sanitize_schema`, `tool_name_for`, and `create_mcp_tools`.
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from iagenify import LocalFiles
|
|
120
|
+
|
|
121
|
+
files = LocalFiles() # ~/.iagenify/files; paths are confined to this workspace
|
|
122
|
+
files.write("Notes/plan.md", "First draft")
|
|
123
|
+
print(files.read("Notes/plan.md")["content"])
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Sending mail
|
|
127
|
+
|
|
128
|
+
Mail leaves from one of the account's own mailboxes, nodemailer-style: HTML with a text fallback, Bcc, and attachments (25 MB in all; executables are refused because Gmail and Outlook reject the whole message for them).
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
box = api.mail.get("billing@acme.com")
|
|
132
|
+
sent = box.send(
|
|
133
|
+
to=["client@example.com"],
|
|
134
|
+
bcc=["accounting@acme.com"],
|
|
135
|
+
subject="Your invoice",
|
|
136
|
+
html='<h1>Thank you</h1><img src="cid:logo">',
|
|
137
|
+
text="Thank you",
|
|
138
|
+
attachments=[
|
|
139
|
+
{"filename": "invoice.pdf", "content": pdf_bytes, "content_type": "application/pdf"},
|
|
140
|
+
{"filename": "logo.png", "content": logo_bytes, "cid": "logo"},
|
|
141
|
+
{"path": "quote.pdf"},
|
|
142
|
+
],
|
|
143
|
+
)
|
|
144
|
+
print(sent["attachments"]) # [{"filename": "invoice.pdf", "size": ..., "contentType": ..., "inline": False}, ...]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Authentication and security
|
|
148
|
+
|
|
149
|
+
Pass the API key from an environment variable; do not put it in source control or browser code. On first use, the SDK exchanges the key for a session. The default session file is `~/.iagenify/session`, with owner-only directory/file permissions where the operating system supports them. The file is JSON and is not encrypted by the SDK. For an application-specific session store, pass an object that implements `read()`, `write(data)`, and `clear()`.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
api = IaGenify(
|
|
153
|
+
api_key=os.environ["IAGENIFY_API_KEY"],
|
|
154
|
+
base_url="https://api.iagenify.com",
|
|
155
|
+
app_name="my-python-service",
|
|
156
|
+
timeout=60,
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`assistant.generate()` has no request timeout, matching the JavaScript SDK's billable generation behavior. `api.models.turn()` uses a 300-second default; pass `timeout=...` there to change it. The client-level `timeout=` sets the default for ordinary API calls.
|
|
161
|
+
|
|
162
|
+
## Errors
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from iagenify import IaGenifyError, NotEnoughCredits, Unauthorized
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
result = assistant.generate(inputs=[{"type": "text", "content": "Hello"}])
|
|
169
|
+
except NotEnoughCredits as error:
|
|
170
|
+
print(error.required, error.available)
|
|
171
|
+
except Unauthorized:
|
|
172
|
+
print("Check the API key or session")
|
|
173
|
+
except IaGenifyError as error:
|
|
174
|
+
print(error.status, error.code, error.details)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Build locally
|
|
178
|
+
|
|
179
|
+
From this directory:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
python -m pip install --upgrade build twine
|
|
183
|
+
python -m build
|
|
184
|
+
python -m twine check dist/*
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This produces a wheel and source archive in `dist/`. Run `python -m twine check dist/*` before release. The `publish-python.yml` workflow builds and validates the distributions; publishing requires a configured PyPI Trusted Publisher and a release tag such as `iagenify-python-v0.1.0`.
|
|
188
|
+
|
iagenify-0.1.0/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# IaGenify Python SDK
|
|
2
|
+
|
|
3
|
+
The official Python client for the IaGenify API. It follows the JavaScript SDK's resource layout and uses familiar Python keyword arguments:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import os
|
|
7
|
+
from iagenify import IaGenify
|
|
8
|
+
|
|
9
|
+
api = IaGenify(api_key=os.environ["IAGENIFY_API_KEY"])
|
|
10
|
+
|
|
11
|
+
assistant = api.models.create(
|
|
12
|
+
model="gemini-3.5-flash",
|
|
13
|
+
settings={"role": "Expert coder", "instructions": "Answer briefly"},
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
result = assistant.generate(
|
|
17
|
+
inputs=[{"type": "text", "content": "Write a sort function"}]
|
|
18
|
+
)
|
|
19
|
+
print(result)
|
|
20
|
+
api.close()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python -m pip install iagenify
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Python 3.10 or newer is required. The package uses `httpx` for HTTP requests and works in scripts, notebooks, and Python server applications. This release is synchronous: SDK calls return their results directly and do not require `await`.
|
|
30
|
+
|
|
31
|
+
## Python runtimes and frameworks
|
|
32
|
+
|
|
33
|
+
The SDK is a regular Python package, not a framework adapter. It works anywhere CPython 3.10+ can make outbound HTTPS requests: scripts, notebooks, CLI tools, and server applications built with FastAPI, Django, or Flask. It does not generate Python UI components like React; Python is the server, automation, and AI-agent side of an application. The SDK is synchronous, so in an async web handler run blocking SDK calls in the framework's worker thread. `api.hosts` currently deploys static sites and edge JavaScript modules; it does not host persistent Python web servers.
|
|
34
|
+
|
|
35
|
+
Use a context manager when you want the HTTP connection closed automatically:
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
with IaGenify(api_key=os.environ["IAGENIFY_API_KEY"]) as api:
|
|
39
|
+
user = api.get_user()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Resources
|
|
43
|
+
|
|
44
|
+
The client exposes `auth`, `keys`, `models`, `memory`, `files`, `storage`, `cloud`, `search`, `fetch`, `convert`, `agents`, `workflows`, `domains`, `mail`, `hosts`, `compute`, and `mcp`.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
api.models.create(model="gemini-3.5-flash")
|
|
48
|
+
api.storage.get()
|
|
49
|
+
api.domains.search("my-brand", tlds=["com", "tn"])
|
|
50
|
+
api.workflows.list()
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See the [IaGenify SDK guide](https://developers.iagenify.com/sdk) for service concepts and Python examples, and the [API reference](https://developers.iagenify.com/api) for HTTP contracts. Python examples document Python behavior; they do not imply support for JavaScript-only runtimes or methods.
|
|
54
|
+
|
|
55
|
+
## Model turns and streaming
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
turn = api.models.turn(
|
|
59
|
+
model="gemini-3.5-flash",
|
|
60
|
+
messages=[{"role": "user", "content": "Explain Python decorators in one paragraph."}],
|
|
61
|
+
)
|
|
62
|
+
print(turn["message"]["content"])
|
|
63
|
+
|
|
64
|
+
streamed = api.models.turn(
|
|
65
|
+
model="gemini-3.5-flash",
|
|
66
|
+
messages=[{"role": "user", "content": "Give me a short greeting."}],
|
|
67
|
+
on_text=lambda delta: print(delta, end="", flush=True),
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Agents
|
|
72
|
+
|
|
73
|
+
The server-executed agent follows the JavaScript SDK's default `agents.create()` contract:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
model = api.models.create(model="gemini-3.5-flash", memory=False)
|
|
77
|
+
agent = api.agents.create(model=model, tools={"search": api.tools.search}, max_steps=8, budget=30)
|
|
78
|
+
result = agent.run(
|
|
79
|
+
inputs=[{"type": "text", "content": "Find three recent sources about Python packaging."}],
|
|
80
|
+
on_step=lambda step: print(step),
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The Python `runtime="local"` agent runs a Python-native model/tool loop. It supports the workspace tools `read`, `list`, `glob`, `grep`, `write`, `edit`, `move`, `delete`, web `search` and `fetch`, custom Python callables, and authorized MCP tools. Writes require permission by default; provide `on_permission` or set `mode="auto"` for workspace writes. Paid tools require an approval callback. Set `memory=True` to persist the session journal on the local machine; reopen it with `api.agents.get(session_id, machine=...)` or `files=...`. Local sessions remain on that machine and workspace.
|
|
85
|
+
|
|
86
|
+
The local agent includes durable local session history, image inputs, workspace checkpoints and rewind (including partial-snapshot diagnostics), custom Python tools, MCP injection, skill invocation, sub-agent delegation, shell commands, storage and document tools, workflow execution, and image, video, voice, and music generation. It also carries the JavaScript engine's seven platform-service tools: `deploy` (hosting), `mail` (read and manage mailboxes), `send_mail` (HTML, Bcc and attachments), `domain` (DNS, mail records, DNSSEC, redirects), `cloud` (storages, space, live price grid), `document` (semantic indexing) and `generate` (a second model for volume work).
|
|
87
|
+
|
|
88
|
+
Permissions follow the JavaScript engine: `read` is free; `write` is free in `auto`; `storage` and `dns` are asked even in `auto`, and "always" applies to that one storage or domain; `send`, `publish` and `money` are asked on every call, in every mode including `full`, and "always" never sticks. An "always" on a `bash` command is saved to `~/.iagenify/permissions.json`, the file the JavaScript engine reads too. Guard checks (an `NS` record, an executable attachment, a malformed address) refuse before anyone is asked.
|
|
89
|
+
|
|
90
|
+
Not yet in Python: the server-side session record that lets a JavaScript agent session be reopened on another device (Python journals stay on the machine that ran them), and the `iagenify_docs` and `mcp` management tools. Its context meter estimates token use for clearing and compaction, while the context-window limit is read from the model catalogue when available. Local terminals are also available separately through `LocalTerminals`; account and computer skill/sub-agent libraries are exposed through `api.agents.skills` and `api.agents.subagents`.
|
|
91
|
+
|
|
92
|
+
The Python package exports `parsePrompt`, `parseTokenCount`, `storageSlug`, `PROMPT_OPTIONS`, `MEDIA_OPTIONS`, `sanitizeSchema`, `toolNameFor`, and `createMcpTools` for the corresponding JavaScript SDK helpers. Prefer the Pythonic snake_case aliases where offered: `parse_prompt`, `parse_token_count`, `storage_slug`, `sanitize_schema`, `tool_name_for`, and `create_mcp_tools`.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from iagenify import LocalFiles
|
|
96
|
+
|
|
97
|
+
files = LocalFiles() # ~/.iagenify/files; paths are confined to this workspace
|
|
98
|
+
files.write("Notes/plan.md", "First draft")
|
|
99
|
+
print(files.read("Notes/plan.md")["content"])
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Sending mail
|
|
103
|
+
|
|
104
|
+
Mail leaves from one of the account's own mailboxes, nodemailer-style: HTML with a text fallback, Bcc, and attachments (25 MB in all; executables are refused because Gmail and Outlook reject the whole message for them).
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
box = api.mail.get("billing@acme.com")
|
|
108
|
+
sent = box.send(
|
|
109
|
+
to=["client@example.com"],
|
|
110
|
+
bcc=["accounting@acme.com"],
|
|
111
|
+
subject="Your invoice",
|
|
112
|
+
html='<h1>Thank you</h1><img src="cid:logo">',
|
|
113
|
+
text="Thank you",
|
|
114
|
+
attachments=[
|
|
115
|
+
{"filename": "invoice.pdf", "content": pdf_bytes, "content_type": "application/pdf"},
|
|
116
|
+
{"filename": "logo.png", "content": logo_bytes, "cid": "logo"},
|
|
117
|
+
{"path": "quote.pdf"},
|
|
118
|
+
],
|
|
119
|
+
)
|
|
120
|
+
print(sent["attachments"]) # [{"filename": "invoice.pdf", "size": ..., "contentType": ..., "inline": False}, ...]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Authentication and security
|
|
124
|
+
|
|
125
|
+
Pass the API key from an environment variable; do not put it in source control or browser code. On first use, the SDK exchanges the key for a session. The default session file is `~/.iagenify/session`, with owner-only directory/file permissions where the operating system supports them. The file is JSON and is not encrypted by the SDK. For an application-specific session store, pass an object that implements `read()`, `write(data)`, and `clear()`.
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
api = IaGenify(
|
|
129
|
+
api_key=os.environ["IAGENIFY_API_KEY"],
|
|
130
|
+
base_url="https://api.iagenify.com",
|
|
131
|
+
app_name="my-python-service",
|
|
132
|
+
timeout=60,
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`assistant.generate()` has no request timeout, matching the JavaScript SDK's billable generation behavior. `api.models.turn()` uses a 300-second default; pass `timeout=...` there to change it. The client-level `timeout=` sets the default for ordinary API calls.
|
|
137
|
+
|
|
138
|
+
## Errors
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from iagenify import IaGenifyError, NotEnoughCredits, Unauthorized
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
result = assistant.generate(inputs=[{"type": "text", "content": "Hello"}])
|
|
145
|
+
except NotEnoughCredits as error:
|
|
146
|
+
print(error.required, error.available)
|
|
147
|
+
except Unauthorized:
|
|
148
|
+
print("Check the API key or session")
|
|
149
|
+
except IaGenifyError as error:
|
|
150
|
+
print(error.status, error.code, error.details)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Build locally
|
|
154
|
+
|
|
155
|
+
From this directory:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
python -m pip install --upgrade build twine
|
|
159
|
+
python -m build
|
|
160
|
+
python -m twine check dist/*
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This produces a wheel and source archive in `dist/`. Run `python -m twine check dist/*` before release. The `publish-python.yml` workflow builds and validates the distributions; publishing requires a configured PyPI Trusted Publisher and a release tag such as `iagenify-python-v0.1.0`.
|
|
164
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "iagenify"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official Python SDK for the IaGenify AI platform"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "IaGenify LLC", email = "contact@iagenify.com" }]
|
|
14
|
+
keywords = ["iagenify", "ai", "agents", "llm", "workflows"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
]
|
|
27
|
+
dependencies = ["httpx>=0.27,<1"]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://iagenify.com"
|
|
31
|
+
Documentation = "https://developers.iagenify.com/sdk/python"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/iagenify"]
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.sdist]
|
|
37
|
+
include = ["/src", "/README.md", "/LICENSE", "/CHANGELOG.md", "/pyproject.toml"]
|
|
38
|
+
|