nvoken 0.9.1__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.
- nvoken-0.9.1/.gitignore +43 -0
- nvoken-0.9.1/LICENSE +201 -0
- nvoken-0.9.1/PKG-INFO +296 -0
- nvoken-0.9.1/README.md +270 -0
- nvoken-0.9.1/examples/fetch.py +28 -0
- nvoken-0.9.1/examples/quickstart.py +20 -0
- nvoken-0.9.1/pyproject.toml +48 -0
- nvoken-0.9.1/src/nvoken/__init__.py +153 -0
- nvoken-0.9.1/src/nvoken/agent.py +589 -0
- nvoken-0.9.1/src/nvoken/ask_user.py +174 -0
- nvoken-0.9.1/src/nvoken/callback.py +85 -0
- nvoken-0.9.1/src/nvoken/client.py +1793 -0
- nvoken-0.9.1/src/nvoken/media_preflight.py +242 -0
- nvoken-0.9.1/src/nvoken/py.typed +0 -0
- nvoken-0.9.1/src/nvoken/schema_preflight.py +415 -0
- nvoken-0.9.1/src/nvoken/stream.py +279 -0
- nvoken-0.9.1/src/nvoken_generated/__init__.py +367 -0
- nvoken-0.9.1/src/nvoken_generated/api/__init__.py +12 -0
- nvoken-0.9.1/src/nvoken_generated/api/agents_api.py +634 -0
- nvoken-0.9.1/src/nvoken_generated/api/apps_api.py +1186 -0
- nvoken-0.9.1/src/nvoken_generated/api/budgets_api.py +1185 -0
- nvoken-0.9.1/src/nvoken_generated/api/invocations_api.py +4160 -0
- nvoken-0.9.1/src/nvoken_generated/api/mcp_api.py +329 -0
- nvoken-0.9.1/src/nvoken_generated/api/models_api.py +659 -0
- nvoken-0.9.1/src/nvoken_generated/api/provider_keys_api.py +1834 -0
- nvoken-0.9.1/src/nvoken_generated/api/sessions_api.py +3220 -0
- nvoken-0.9.1/src/nvoken_generated/api/usage_api.py +401 -0
- nvoken-0.9.1/src/nvoken_generated/api_client.py +807 -0
- nvoken-0.9.1/src/nvoken_generated/api_response.py +21 -0
- nvoken-0.9.1/src/nvoken_generated/configuration.py +604 -0
- nvoken-0.9.1/src/nvoken_generated/exceptions.py +218 -0
- nvoken-0.9.1/src/nvoken_generated/models/__init__.py +167 -0
- nvoken-0.9.1/src/nvoken_generated/models/agent.py +102 -0
- nvoken-0.9.1/src/nvoken_generated/models/agent_definition.py +153 -0
- nvoken-0.9.1/src/nvoken_generated/models/agent_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/app.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/app_list.py +94 -0
- nvoken-0.9.1/src/nvoken_generated/models/budget.py +193 -0
- nvoken-0.9.1/src/nvoken_generated/models/budget_block.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/budget_scope.py +39 -0
- nvoken-0.9.1/src/nvoken_generated/models/builtin_tool_declaration.py +102 -0
- nvoken-0.9.1/src/nvoken_generated/models/callback_delivery_outcome.py +37 -0
- nvoken-0.9.1/src/nvoken_generated/models/callback_target.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/callback_tool_declaration.py +129 -0
- nvoken-0.9.1/src/nvoken_generated/models/char_location_citation.py +104 -0
- nvoken-0.9.1/src/nvoken_generated/models/citation.py +152 -0
- nvoken-0.9.1/src/nvoken_generated/models/compaction_policy.py +96 -0
- nvoken-0.9.1/src/nvoken_generated/models/compaction_policy_trigger_tokens.py +142 -0
- nvoken-0.9.1/src/nvoken_generated/models/create_budget_request.py +148 -0
- nvoken-0.9.1/src/nvoken_generated/models/create_invocation_request.py +260 -0
- nvoken-0.9.1/src/nvoken_generated/models/create_provider_key_request.py +113 -0
- nvoken-0.9.1/src/nvoken_generated/models/create_session_request.py +109 -0
- nvoken-0.9.1/src/nvoken_generated/models/daily_usage.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/daily_usage_bucket.py +117 -0
- nvoken-0.9.1/src/nvoken_generated/models/document_input_block.py +102 -0
- nvoken-0.9.1/src/nvoken_generated/models/document_input_source.py +114 -0
- nvoken-0.9.1/src/nvoken_generated/models/document_reference_block.py +121 -0
- nvoken-0.9.1/src/nvoken_generated/models/error_code.py +54 -0
- nvoken-0.9.1/src/nvoken_generated/models/error_response.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/fork_session_options.py +93 -0
- nvoken-0.9.1/src/nvoken_generated/models/fork_session_request.py +101 -0
- nvoken-0.9.1/src/nvoken_generated/models/fork_session_request_from_message.py +142 -0
- nvoken-0.9.1/src/nvoken_generated/models/host_tool_declaration.py +123 -0
- nvoken-0.9.1/src/nvoken_generated/models/host_tool_result_acceptance.py +108 -0
- nvoken-0.9.1/src/nvoken_generated/models/image_input_block.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/image_input_source.py +114 -0
- nvoken-0.9.1/src/nvoken_generated/models/image_reference_block.py +119 -0
- nvoken-0.9.1/src/nvoken_generated/models/input_block.py +149 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation.py +272 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_accepted_event.py +144 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_change.py +163 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_failure.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_input.py +143 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_result.py +107 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_result_event.py +124 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_status.py +41 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_stop_reason.py +41 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_stream_event.py +205 -0
- nvoken-0.9.1/src/nvoken_generated/models/invocation_update_event.py +134 -0
- nvoken-0.9.1/src/nvoken_generated/models/limits.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_list_tools_request.py +90 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_list_tools_response.py +105 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_projected_tool.py +111 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_server.py +131 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_timeouts.py +89 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_tool_annotations.py +105 -0
- nvoken-0.9.1/src/nvoken_generated/models/mcp_tool_exclusion.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/message_phase.py +35 -0
- nvoken-0.9.1/src/nvoken_generated/models/model.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_control_capabilities.py +108 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_cost.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_descriptor.py +138 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_input.py +139 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_input_capabilities.py +90 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_list.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_media_capabilities.py +95 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_media_kind_capabilities.py +88 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_pricing.py +183 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_provenance.py +130 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_reasoning_budget_capabilities.py +93 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_reasoning_capabilities.py +98 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_reasoning_effort_capabilities.py +91 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_sampling_capabilities.py +86 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_tool_capabilities.py +92 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_tool_choice_capabilities.py +90 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_tool_choice_mode.py +37 -0
- nvoken-0.9.1/src/nvoken_generated/models/model_usage.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/nudge_acknowledgement.py +104 -0
- nvoken-0.9.1/src/nvoken_generated/models/nudge_invocation_request.py +93 -0
- nvoken-0.9.1/src/nvoken_generated/models/output_text_delta_event.py +129 -0
- nvoken-0.9.1/src/nvoken_generated/models/pending_host_tool_call.py +114 -0
- nvoken-0.9.1/src/nvoken_generated/models/pending_input.py +129 -0
- nvoken-0.9.1/src/nvoken_generated/models/pending_input_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/pending_input_status.py +37 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key.py +199 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key_scope.py +35 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key_selection.py +135 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key_selection_one_of.py +112 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key_selection_one_of1.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_key_usage.py +133 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_static_key.py +87 -0
- nvoken-0.9.1/src/nvoken_generated/models/provider_tool.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/reasoning.py +90 -0
- nvoken-0.9.1/src/nvoken_generated/models/reasoning_effort.py +38 -0
- nvoken-0.9.1/src/nvoken_generated/models/redacted_block.py +93 -0
- nvoken-0.9.1/src/nvoken_generated/models/register_app_request.py +91 -0
- nvoken-0.9.1/src/nvoken_generated/models/resolved_limits.py +102 -0
- nvoken-0.9.1/src/nvoken_generated/models/resume_invocation_request.py +90 -0
- nvoken-0.9.1/src/nvoken_generated/models/retention_policy.py +87 -0
- nvoken-0.9.1/src/nvoken_generated/models/rotate_provider_key_request.py +98 -0
- nvoken-0.9.1/src/nvoken_generated/models/sampling.py +87 -0
- nvoken-0.9.1/src/nvoken_generated/models/seed_message.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/seed_message_content.py +143 -0
- nvoken-0.9.1/src/nvoken_generated/models/server_tool_use_block.py +105 -0
- nvoken-0.9.1/src/nvoken_generated/models/session.py +281 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_budget.py +87 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_compaction.py +142 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_compaction_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_compaction_status.py +35 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_content_block.py +208 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_context.py +100 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_fork_lineage.py +109 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_message.py +196 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_message_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_message_role.py +36 -0
- nvoken-0.9.1/src/nvoken_generated/models/session_options.py +105 -0
- nvoken-0.9.1/src/nvoken_generated/models/stream_end_event.py +137 -0
- nvoken-0.9.1/src/nvoken_generated/models/stream_resync_event.py +135 -0
- nvoken-0.9.1/src/nvoken_generated/models/structured_output.py +99 -0
- nvoken-0.9.1/src/nvoken_generated/models/structured_output_provenance.py +121 -0
- nvoken-0.9.1/src/nvoken_generated/models/submit_host_tool_results_request.py +108 -0
- nvoken-0.9.1/src/nvoken_generated/models/submit_host_tool_results_request_results_inner.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/submit_host_tool_results_response.py +132 -0
- nvoken-0.9.1/src/nvoken_generated/models/text_block.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/text_input_block.py +96 -0
- nvoken-0.9.1/src/nvoken_generated/models/thinking_delta_event.py +129 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_call.py +125 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_call_delivery.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_call_list.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_call_mode.py +37 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_call_status.py +38 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_callback_context.py +159 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_callback_request.py +110 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_callback_response.py +106 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_choice.py +103 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_declaration.py +152 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_result_block.py +105 -0
- nvoken-0.9.1/src/nvoken_generated/models/tool_use_block.py +105 -0
- nvoken-0.9.1/src/nvoken_generated/models/transcript_snapshot.py +116 -0
- nvoken-0.9.1/src/nvoken_generated/models/transcript_stream_event.py +177 -0
- nvoken-0.9.1/src/nvoken_generated/models/transcript_update.py +128 -0
- nvoken-0.9.1/src/nvoken_generated/models/update_app_request.py +87 -0
- nvoken-0.9.1/src/nvoken_generated/models/update_budget_request.py +87 -0
- nvoken-0.9.1/src/nvoken_generated/models/update_session_request.py +110 -0
- nvoken-0.9.1/src/nvoken_generated/models/update_session_request_metadata_value.py +131 -0
- nvoken-0.9.1/src/nvoken_generated/models/url_citation.py +102 -0
- nvoken-0.9.1/src/nvoken_generated/models/web_search_location.py +93 -0
- nvoken-0.9.1/src/nvoken_generated/models/web_search_result_location_citation.py +101 -0
- nvoken-0.9.1/src/nvoken_generated/models/web_search_tool.py +97 -0
- nvoken-0.9.1/src/nvoken_generated/models/webhook_event.py +36 -0
- nvoken-0.9.1/src/nvoken_generated/models/webhook_target.py +90 -0
- nvoken-0.9.1/src/nvoken_generated/py.typed +0 -0
- nvoken-0.9.1/src/nvoken_generated/rest.py +201 -0
- nvoken-0.9.1/tests/test_agent.py +289 -0
- nvoken-0.9.1/tests/test_conformance.py +1236 -0
nvoken-0.9.1/.gitignore
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.env
|
|
3
|
+
.env.*
|
|
4
|
+
!.env.example
|
|
5
|
+
|
|
6
|
+
# Go
|
|
7
|
+
/nvoken
|
|
8
|
+
bin/
|
|
9
|
+
dist/
|
|
10
|
+
*.exe
|
|
11
|
+
*.exe~
|
|
12
|
+
*.dll
|
|
13
|
+
*.so
|
|
14
|
+
*.dylib
|
|
15
|
+
*.test
|
|
16
|
+
*.out
|
|
17
|
+
coverage.*
|
|
18
|
+
*.coverprofile
|
|
19
|
+
profile.cov
|
|
20
|
+
go.work
|
|
21
|
+
go.work.sum
|
|
22
|
+
|
|
23
|
+
# JavaScript / TypeScript
|
|
24
|
+
node_modules/
|
|
25
|
+
sdk/typescript/dist/
|
|
26
|
+
examples/*/dist/
|
|
27
|
+
|
|
28
|
+
# Python
|
|
29
|
+
.pytest_cache/
|
|
30
|
+
.ruff_cache/
|
|
31
|
+
.venv/
|
|
32
|
+
__pycache__/
|
|
33
|
+
*.py[cod]
|
|
34
|
+
*.egg-info/
|
|
35
|
+
sdk/python/build/
|
|
36
|
+
sdk/python/dist/
|
|
37
|
+
|
|
38
|
+
# Rust
|
|
39
|
+
sdk/rust/target/
|
|
40
|
+
|
|
41
|
+
# Editors
|
|
42
|
+
.idea/
|
|
43
|
+
.vscode/
|
nvoken-0.9.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
nvoken-0.9.1/PKG-INFO
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nvoken
|
|
3
|
+
Version: 0.9.1
|
|
4
|
+
Summary: Python SDK for the nvoken durable agent runtime
|
|
5
|
+
Project-URL: Homepage, https://github.com/deepnoodle-ai/nvoken/tree/main/sdk/python
|
|
6
|
+
Project-URL: Repository, https://github.com/deepnoodle-ai/nvoken
|
|
7
|
+
Project-URL: Changelog, https://github.com/deepnoodle-ai/nvoken/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: Issues, https://github.com/deepnoodle-ai/nvoken/issues
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,ai,durable-execution,llm,nvoken
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: httpx<1,>=0.27
|
|
19
|
+
Requires-Dist: pydantic<3,>=2
|
|
20
|
+
Requires-Dist: python-dateutil<3,>=2.8
|
|
21
|
+
Requires-Dist: typing-extensions>=4.7
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: pytest-asyncio==1.4.0; extra == 'test'
|
|
24
|
+
Requires-Dist: pytest==9.1.1; extra == 'test'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# nvoken Python SDK
|
|
28
|
+
|
|
29
|
+
An Invocation is one durable agent turn. The host supplies `agent_key`,
|
|
30
|
+
optional `tenant_key`, `session_key`, and `idempotency_key`; instructions,
|
|
31
|
+
model, and tools travel inline with the turn.
|
|
32
|
+
|
|
33
|
+
The package has three deliberate levels:
|
|
34
|
+
|
|
35
|
+
- `Agent` is the ordinary workflow facade: `text`, `run`, `invoke`, `stream`,
|
|
36
|
+
and locally serialized bound Sessions.
|
|
37
|
+
- `Client` and `InvocationHandle` expose durable operations, transcript drains,
|
|
38
|
+
provider-key lifecycle, iterators, configurable waits, and resumable streams.
|
|
39
|
+
- `nvoken_generated` is the complete generated Runtime transport and raw
|
|
40
|
+
escape hatch.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python -m pip install nvoken
|
|
44
|
+
NVOKEN_BASE_URL=http://localhost:8080 NVOKEN_API_KEY=... \
|
|
45
|
+
python examples/quickstart.py
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The async facade provides durable handles, replay-safe retries, typed errors,
|
|
49
|
+
cursor iterators, resumable SSE, composed result reads (`result`,
|
|
50
|
+
`list_messages`, `output_text`), and callback verification. Session-scoped
|
|
51
|
+
messages use `Client.list_session_messages`.
|
|
52
|
+
|
|
53
|
+
Resolve the identity-only Agent anchor without admitting work:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
agents = await client.list_agent_identities(agent_key="support")
|
|
57
|
+
identity = await client.get_agent_identity(agents.items[0].id)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The identity contains only its nvoken ID, host-owned key, and creation time.
|
|
61
|
+
Instructions, models, tools, and provider keys remain per Invocation.
|
|
62
|
+
|
|
63
|
+
Opt into the fixed guarded public-web reader with `fetch_tool()`:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from nvoken import AgentOptions, Model, fetch_tool
|
|
67
|
+
|
|
68
|
+
options = AgentOptions(
|
|
69
|
+
agent_key="research",
|
|
70
|
+
model=Model(provider="anthropic", id="claude-sonnet-5"),
|
|
71
|
+
tools=(fetch_tool(),),
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The Runtime accepts only `{"name":"nvoken_fetch","mode":"builtin"}`. It owns
|
|
76
|
+
public-address checks, up to five guarded redirects, one transient retry,
|
|
77
|
+
HTML-to-Markdown conversion, and the ten-second and 64 KiB limits. Run
|
|
78
|
+
`python examples/fetch.py` to summarize `NVOKEN_FETCH_URL`.
|
|
79
|
+
|
|
80
|
+
Use an Agent for the common path:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
agent = client.agent(AgentOptions(
|
|
84
|
+
agent_key="support",
|
|
85
|
+
instructions="Help with billing questions.",
|
|
86
|
+
model=Model(provider="anthropic", id="claude-sonnet-5"),
|
|
87
|
+
))
|
|
88
|
+
|
|
89
|
+
print(await agent.text("Why was I charged twice?"))
|
|
90
|
+
continued = agent.session(session_key="customer-123")
|
|
91
|
+
print(await continued.text("What should I do next?"))
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
A bound Session serializes admission only within that local binding. The
|
|
95
|
+
Runtime remains authoritative across processes and rejects a second
|
|
96
|
+
nonterminal turn. Agent operations dispatch configured host-tool handlers.
|
|
97
|
+
If a waiting call has no handler, the Agent cancels before raising
|
|
98
|
+
`MissingToolHandlerError` by default; set
|
|
99
|
+
`InvocationOptions(leave_waiting_on_missing_handler=True)` only when another
|
|
100
|
+
worker deliberately owns it. `NoOutputTextError.result_kind` distinguishes
|
|
101
|
+
structured, tool-only, and empty completions.
|
|
102
|
+
|
|
103
|
+
For an intentional replace/regenerate action, use a new idempotency key and
|
|
104
|
+
the typed option:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
handle = await agent.invoke(
|
|
108
|
+
"Try that answer again.",
|
|
109
|
+
options=InvocationOptions(
|
|
110
|
+
idempotency_key="customer-123:regenerate-2",
|
|
111
|
+
if_active="supersede",
|
|
112
|
+
session_key="customer-123",
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Omission or `"reject"` preserves the default conflict response. Low-level
|
|
118
|
+
callers set the same policy on `InvokeRequest.if_active`.
|
|
119
|
+
|
|
120
|
+
`if_active="interrupt"` is the keep-the-work variant: the active Invocation
|
|
121
|
+
stops at its next execution seam and settles `completed` with `stop_reason`
|
|
122
|
+
`"interrupted"`, so the replacement turn builds on what it already produced.
|
|
123
|
+
`await handle.interrupt()` asks for the same graceful stop without admitting a
|
|
124
|
+
replacement, and `Invocation.stop_reason` names why any turn ended.
|
|
125
|
+
|
|
126
|
+
A turn can also stop without ending: `"incomplete"` means the Runtime enforced
|
|
127
|
+
a budget at a seam, with `stop_reason` naming which one. It is terminal — the
|
|
128
|
+
wait helpers stop there — and its work is kept, so treat it as an unfinished
|
|
129
|
+
answer rather than an error. `SessionMessage.phase` says which assistant
|
|
130
|
+
message was the reply: `"final_answer"` on the one that settled a completed
|
|
131
|
+
turn, `"commentary"` on everything else, so an incomplete turn has none.
|
|
132
|
+
|
|
133
|
+
`InvocationOptions(timeout=...)` is one overall local deadline. Cancelling the
|
|
134
|
+
calling task still raises native `asyncio.CancelledError`; it does not imply a
|
|
135
|
+
durable Runtime cancellation. Call `handle.cancel()` when that is intended.
|
|
136
|
+
|
|
137
|
+
Recovery reads accept a status union, and a known Invocation can stream only
|
|
138
|
+
durable frames:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
page = await client.list_invocations(
|
|
142
|
+
status=["queued", "running", "waiting"],
|
|
143
|
+
)
|
|
144
|
+
async for event in handle.events(deltas=False):
|
|
145
|
+
...
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Equivalent status sets share cursor identity regardless of input order.
|
|
149
|
+
Session get/list models expose typed nullable `usage`, computed from durable
|
|
150
|
+
Invocation usage as a convenience estimate rather than a billing ledger.
|
|
151
|
+
|
|
152
|
+
Set `Outcome(description=..., rubric=...)` on the request or Agent to request a
|
|
153
|
+
single finish-time self-review. The selected model does not see the criteria
|
|
154
|
+
during its initial work; nvoken supplies them once as a Dive system reminder
|
|
155
|
+
when the turn would otherwise finish, then continues the same turn within its
|
|
156
|
+
ordinary limits. No independent grade or result field is produced.
|
|
157
|
+
|
|
158
|
+
Install restart-stable compaction on a new or existing Session:
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from nvoken import ContextCompaction, SessionOptions
|
|
162
|
+
|
|
163
|
+
request = InvokeRequest(
|
|
164
|
+
agent_key="support",
|
|
165
|
+
session_key="support:123",
|
|
166
|
+
session_options=SessionOptions(
|
|
167
|
+
compaction=ContextCompaction(trigger_tokens="auto"),
|
|
168
|
+
),
|
|
169
|
+
input="hello",
|
|
170
|
+
model=Model(provider="anthropic", id="claude-sonnet-5"),
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Use an integer trigger and optional same-provider `model` for explicit policy.
|
|
175
|
+
A Session without a policy accepts late opt-in; once installed, the policy is
|
|
176
|
+
immutable. Supplied options on an existing Session must equal stored values or
|
|
177
|
+
admission returns `session_options_conflict`.
|
|
178
|
+
|
|
179
|
+
Summary usage appears in Session usage rather than Invocation usage. Read
|
|
180
|
+
applied and fell-through diagnostics with
|
|
181
|
+
`client.list_session_compactions(session_id)`.
|
|
182
|
+
|
|
183
|
+
`InvocationOptions.metadata` correlates a turn with your own records from the
|
|
184
|
+
Agent binding. It is part of the admitted input, so it is immutable and material
|
|
185
|
+
to idempotency: a replay carrying different metadata conflicts rather than
|
|
186
|
+
updating it. That is why it is per-call rather than an `AgentOptions` default.
|
|
187
|
+
|
|
188
|
+
Pass a stored or one-turn provider key directly through
|
|
189
|
+
`InvokeRequest`:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
request = InvokeRequest(
|
|
193
|
+
agent_key="support",
|
|
194
|
+
input="hello",
|
|
195
|
+
model=Model(provider="openai", id="gpt-test"),
|
|
196
|
+
provider_keys=(
|
|
197
|
+
ProviderKeySelection(
|
|
198
|
+
provider="openai",
|
|
199
|
+
source="caller_ephemeral",
|
|
200
|
+
api_key=provider_key,
|
|
201
|
+
),
|
|
202
|
+
),
|
|
203
|
+
)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Stored sources are `app_byok`, `tenant_byok`, and `platform` and do not
|
|
207
|
+
accept an `api_key`. `Client.stream_session(session_id, reducer, consume)`
|
|
208
|
+
follows the Session until its task is cancelled; a terminal turn does not end
|
|
209
|
+
the Session stream. For catch-up reads, use `get_transcript_page` when
|
|
210
|
+
checkpointing each page or `drain_transcript` to consume one fixed cut.
|
|
211
|
+
|
|
212
|
+
Discover models through the same async facade:
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
catalog = await client.list_models(provider="openai")
|
|
216
|
+
selected = await client.get_model(
|
|
217
|
+
Model(provider="openai", id=catalog.items[0].id)
|
|
218
|
+
)
|
|
219
|
+
print(selected.cataloged, selected.pricing.status)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The list is curated discovery metadata, not proof of provider-account access.
|
|
223
|
+
Exact inspection also accepts uncataloged IDs.
|
|
224
|
+
|
|
225
|
+
Set an explicit portable temperature on the request or Agent:
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
from nvoken import InvokeRequest, Model, Sampling
|
|
229
|
+
|
|
230
|
+
request = InvokeRequest(
|
|
231
|
+
agent_key="support",
|
|
232
|
+
input="hello",
|
|
233
|
+
model=Model(provider="anthropic", id="claude-haiku-4-5"),
|
|
234
|
+
sampling=Sampling(temperature=0),
|
|
235
|
+
)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Omit `sampling` to preserve the provider default. Check
|
|
239
|
+
`selected.controls.sampling.temperature` first; missing controls are unknown,
|
|
240
|
+
and unsupported or unknown selections fail before durable admission. The
|
|
241
|
+
portable range is `[0,1]`. `top_p` and stop sequences are intentionally absent;
|
|
242
|
+
`limits.max_output_tokens` is the output guardrail.
|
|
243
|
+
|
|
244
|
+
Reasoning is typed and fail closed:
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
from nvoken import InvokeRequest, Model, Reasoning
|
|
248
|
+
|
|
249
|
+
request = InvokeRequest(
|
|
250
|
+
agent_key="support",
|
|
251
|
+
input="hello",
|
|
252
|
+
model=Model(provider="anthropic", id="claude-opus-4-8"),
|
|
253
|
+
reasoning=Reasoning(effort="high"),
|
|
254
|
+
)
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Check `selected.controls.reasoning` first. `budget_tokens` requires a larger
|
|
258
|
+
explicit `limits.max_output_tokens`. Omission preserves provider defaults;
|
|
259
|
+
unsupported values and combinations are rejected without aliasing. OpenAI
|
|
260
|
+
reasoning remains unavailable until its complete continuation representation
|
|
261
|
+
is durable.
|
|
262
|
+
|
|
263
|
+
## Structured-output schema preflight
|
|
264
|
+
|
|
265
|
+
`Client.invoke` and Agent operations call
|
|
266
|
+
`preflight_output_schema(schema)` before transport when
|
|
267
|
+
`InvokeRequest.output_schema` is present. Rejection is an `NvokenError` with
|
|
268
|
+
code `schema_preflight_failed`; its safe `details` contain the portable issue
|
|
269
|
+
`code`, RFC 6901 `path`, and optional `keyword`. A successful local check means
|
|
270
|
+
eligible for admission. Generated APIs reached through `client.raw()` still
|
|
271
|
+
rely on the authoritative Runtime check.
|
|
272
|
+
|
|
273
|
+
## Remote MCP tools
|
|
274
|
+
|
|
275
|
+
Use the handwritten declaration for discovery and Invocation admission:
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
server = MCPServer(
|
|
279
|
+
name="support",
|
|
280
|
+
url="https://mcp.example.com/rpc",
|
|
281
|
+
allowed_tools=("lookup_order",),
|
|
282
|
+
headers={"Authorization": f"Bearer {mcp_token}"},
|
|
283
|
+
timeouts=MCPTimeouts(discovery_seconds=10, call_seconds=30),
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
catalog = await client.list_mcp_tools(server)
|
|
287
|
+
request = InvokeRequest(
|
|
288
|
+
agent_key="support",
|
|
289
|
+
input="hello",
|
|
290
|
+
model=Model(provider="anthropic", id="claude-sonnet-5"),
|
|
291
|
+
mcp_servers=(server,),
|
|
292
|
+
)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Headers are hidden from dataclass representation and are one-Invocation secret
|
|
296
|
+
material. They never appear in durable specs or public recovery surfaces.
|