agentic-systems 2.1.2__tar.gz → 2.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentic_systems-2.1.3/PKG-INFO +129 -0
- agentic_systems-2.1.3/README.md +46 -0
- {agentic_systems-2.1.2 → agentic_systems-2.1.3}/pyproject.toml +11 -7
- agentic_systems-2.1.3/src/agentic_systems/__init__.py +9 -0
- agentic_systems-2.1.3/src/agentic_systems/_configuration.py +217 -0
- agentic_systems-2.1.3/src/agentic_systems/_contracts.py +139 -0
- agentic_systems-2.1.3/src/agentic_systems/_engine/__init__.py +1 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/agents.py +1040 -1040
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/bedrock_runtime_client.py +297 -297
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/composition.py +47 -47
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/contracts.py +660 -660
- agentic_systems-2.1.3/src/agentic_systems/_engine/core/__init__.py +1 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/contracts.py +5 -5
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/human_output.py +5 -5
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/lineage.py +5 -5
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/provider.py +33 -33
- agentic_systems-2.1.3/src/agentic_systems/_engine/core/results.py +6 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/runtime.py +468 -468
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/scheduler.py +353 -353
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/core/tools.py +5 -5
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/defaults.py +28 -28
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/delegation.py +58 -58
- agentic_systems-2.1.3/src/agentic_systems/_engine/engines/__init__.py +1 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/engines/bedrock.py +73 -73
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/engines/names.py +69 -69
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/environments.py +832 -832
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/errors.py +147 -147
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/evals.py +1184 -1184
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/execution.py +243 -243
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/expectations.py +68 -68
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/factories.py +653 -653
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/final_answer.py +191 -191
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/human_output.py +988 -988
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/inspection.py +438 -438
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/__init__.py +37 -37
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/__init__.py +42 -42
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/base.py +93 -93
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/bedrock_openai.py +271 -271
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/langgraph.py +81 -81
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/native.py +56 -56
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/openai_agents.py +993 -989
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/openai_models.py +405 -405
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/strands.py +1204 -1204
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/strands_scripted.py +236 -236
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/adapters/tools.py +183 -183
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/boundary.py +317 -317
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/langgraph.py +1103 -1103
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/lineage.py +926 -926
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/normalization.py +59 -59
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/output_contracts.py +147 -147
- agentic_systems-2.1.3/src/agentic_systems/_engine/providers/__init__.py +1 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/base.py +381 -381
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/__init__.py +1 -1
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/converse.py +312 -312
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/direct.py +331 -331
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/identity.py +242 -242
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/langgraph.py +67 -67
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/models.py +191 -191
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock/tools.py +594 -594
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/bedrock_runtime.py +1 -1
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/conformance.py +382 -382
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/ollama_runtime.py +155 -155
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/openai_runtime.py +9 -9
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/python_runtime.py +409 -409
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/providers/vllm_runtime.py +169 -169
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/results.py +1 -1
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/__init__.py +117 -117
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/attestation.py +589 -589
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/base.py +25 -25
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/execution.py +173 -173
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/serving/vllm.py +5 -3
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/skills/__init__.py +22 -22
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/skills/loader.py +170 -170
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/skills/skill.py +429 -429
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/system.py +810 -810
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/__init__.py +27 -27
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/decorators.py +105 -105
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/events.py +46 -46
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/parsing.py +1 -1
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/runtime.py +35 -35
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/tool.py +376 -376
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/toolkit.py +106 -106
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/tools/toolset.py +19 -19
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/usage.py +94 -94
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/utils.py +1758 -1758
- agentic_systems-2.1.3/src/agentic_systems/_grammar.py +839 -0
- agentic_systems-2.1.3/src/agentic_systems/_results.py +194 -0
- agentic_systems-2.1.3/src/agentic_systems/_scaffolding.py +55 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/README.md +20 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/__init__.py +6 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/fixtures/cases.json +9 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/fixtures/catalog.json +10 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/offline.py +46 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/run.py +19 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/settings.py +31 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/skills.py +11 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/system.py +51 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/tools.py +130 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/order_fulfillment/verification.py +86 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/.env.example +4 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/.gitignore +7 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/README.md +29 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/app.py +38 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/execute_notebook.py +26 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/pyproject.toml +24 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/test_offline.py +14 -0
- agentic_systems-2.1.3/src/agentic_systems/_templates/project/tests/test_contract.py +40 -0
- agentic_systems-2.1.3/src/agentic_systems/_tools.py +155 -0
- agentic_systems-2.1.3/src/agentic_systems/cli.py +34 -0
- agentic_systems-2.1.3/src/agentic_systems.egg-info/PKG-INFO +129 -0
- agentic_systems-2.1.3/src/agentic_systems.egg-info/SOURCES.txt +124 -0
- {agentic_systems-2.1.2 → agentic_systems-2.1.3}/src/agentic_systems.egg-info/requires.txt +1 -0
- agentic_systems-2.1.2/CHANGELOG.md +0 -358
- agentic_systems-2.1.2/MANIFEST.in +0 -11
- agentic_systems-2.1.2/PKG-INFO +0 -1091
- agentic_systems-2.1.2/README.md +0 -1009
- agentic_systems-2.1.2/src/agentic_systems/__init__.py +0 -172
- agentic_systems-2.1.2/src/agentic_systems/api.py +0 -389
- agentic_systems-2.1.2/src/agentic_systems/api_contract.py +0 -473
- agentic_systems-2.1.2/src/agentic_systems/cli.py +0 -862
- agentic_systems-2.1.2/src/agentic_systems/core/__init__.py +0 -38
- agentic_systems-2.1.2/src/agentic_systems/core/agents.py +0 -5
- agentic_systems-2.1.2/src/agentic_systems/core/results.py +0 -6
- agentic_systems-2.1.2/src/agentic_systems/engines/__init__.py +0 -21
- agentic_systems-2.1.2/src/agentic_systems/providers/__init__.py +0 -66
- agentic_systems-2.1.2/src/agentic_systems.egg-info/PKG-INFO +0 -1091
- agentic_systems-2.1.2/src/agentic_systems.egg-info/SOURCES.txt +0 -103
- {agentic_systems-2.1.2 → agentic_systems-2.1.3}/setup.cfg +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/chain.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/compatibility.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/integrations/config.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/protocols.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/registry.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/migrations.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/results.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/serving.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/schemas/specs.py +0 -0
- {agentic_systems-2.1.2/src/agentic_systems → agentic_systems-2.1.3/src/agentic_systems/_engine}/serving/__init__.py +0 -0
- {agentic_systems-2.1.2 → agentic_systems-2.1.3}/src/agentic_systems.egg-info/dependency_links.txt +0 -0
- {agentic_systems-2.1.2 → agentic_systems-2.1.3}/src/agentic_systems.egg-info/entry_points.txt +0 -0
- {agentic_systems-2.1.2 → agentic_systems-2.1.3}/src/agentic_systems.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentic-systems
|
|
3
|
+
Version: 2.1.3
|
|
4
|
+
Summary: Agentic Systems: a computational grammar for building, executing, observing, and evaluating intelligent systems.
|
|
5
|
+
Author-email: Jacobo Gerardo Gonzalez Leon <jacobogerardo.gonzalez@bbva.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://www.github.com/JacoboGGLeon/agentic_systems
|
|
8
|
+
Project-URL: Repository, https://www.github.com/JacoboGGLeon/agentic_systems
|
|
9
|
+
Project-URL: LinkedIn, https://www.linkedin.com/in/jacoboggleon/
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: pydantic<3,>=2.7.0
|
|
20
|
+
Requires-Dist: pandas>=2.0.0
|
|
21
|
+
Requires-Dist: typing-extensions>=4.10.0
|
|
22
|
+
Requires-Dist: rich>=13.0.0
|
|
23
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
24
|
+
Provides-Extra: bedrock
|
|
25
|
+
Requires-Dist: boto3>=1.39.0; extra == "bedrock"
|
|
26
|
+
Requires-Dist: botocore>=1.39.0; extra == "bedrock"
|
|
27
|
+
Provides-Extra: langgraph
|
|
28
|
+
Requires-Dist: langgraph>=0.2.0; extra == "langgraph"
|
|
29
|
+
Requires-Dist: typing-extensions>=4.10.0; extra == "langgraph"
|
|
30
|
+
Provides-Extra: openai
|
|
31
|
+
Requires-Dist: openai<3,>=2.45.0; extra == "openai"
|
|
32
|
+
Provides-Extra: openai-agents
|
|
33
|
+
Requires-Dist: openai-agents<0.19,>=0.18.3; extra == "openai-agents"
|
|
34
|
+
Provides-Extra: strands
|
|
35
|
+
Requires-Dist: strands-agents[a2a]<2,>=1.29.0; extra == "strands"
|
|
36
|
+
Requires-Dist: mcp<2,>=1; extra == "strands"
|
|
37
|
+
Provides-Extra: vllm
|
|
38
|
+
Requires-Dist: openai<3,>=2.45.0; extra == "vllm"
|
|
39
|
+
Provides-Extra: vllm-client
|
|
40
|
+
Requires-Dist: openai<3,>=2.45.0; extra == "vllm-client"
|
|
41
|
+
Provides-Extra: vllm-server
|
|
42
|
+
Requires-Dist: vllm>=0.9.0; extra == "vllm-server"
|
|
43
|
+
Requires-Dist: openai<3,>=2.45.0; extra == "vllm-server"
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
47
|
+
Requires-Dist: ruff==0.15.22; extra == "dev"
|
|
48
|
+
Requires-Dist: tomli>=2.1.0; python_version < "3.11" and extra == "dev"
|
|
49
|
+
Requires-Dist: ipykernel>=6.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: jupyterlab>=4.0.0; extra == "dev"
|
|
51
|
+
Requires-Dist: nbclient>=0.10.0; extra == "dev"
|
|
52
|
+
Requires-Dist: nbformat>=5.10.0; extra == "dev"
|
|
53
|
+
Requires-Dist: hypothesis>=6.100.0; extra == "dev"
|
|
54
|
+
Requires-Dist: pyright>=1.1.390; extra == "dev"
|
|
55
|
+
Requires-Dist: import-linter>=2.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pip-audit>=2.7.0; extra == "dev"
|
|
57
|
+
Requires-Dist: radon>=6.0.1; extra == "dev"
|
|
58
|
+
Requires-Dist: cyclonedx-bom>=5.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: mutmut<4,>=3.7; extra == "dev"
|
|
60
|
+
Provides-Extra: all
|
|
61
|
+
Requires-Dist: boto3>=1.39.0; extra == "all"
|
|
62
|
+
Requires-Dist: botocore>=1.39.0; extra == "all"
|
|
63
|
+
Requires-Dist: langgraph>=0.2.0; extra == "all"
|
|
64
|
+
Requires-Dist: openai<3,>=2.45.0; extra == "all"
|
|
65
|
+
Requires-Dist: openai-agents<0.19,>=0.18.3; extra == "all"
|
|
66
|
+
Requires-Dist: strands-agents[a2a]<2,>=1.29.0; extra == "all"
|
|
67
|
+
Requires-Dist: mcp<2,>=1; extra == "all"
|
|
68
|
+
Requires-Dist: ipykernel>=6.0.0; extra == "all"
|
|
69
|
+
Requires-Dist: jupyterlab>=4.0.0; extra == "all"
|
|
70
|
+
Requires-Dist: nbclient>=0.10.0; extra == "all"
|
|
71
|
+
Requires-Dist: nbformat>=5.10.0; extra == "all"
|
|
72
|
+
Requires-Dist: pytest>=8.0.0; extra == "all"
|
|
73
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "all"
|
|
74
|
+
Requires-Dist: ruff==0.15.22; extra == "all"
|
|
75
|
+
Requires-Dist: hypothesis>=6.100.0; extra == "all"
|
|
76
|
+
Requires-Dist: pyright>=1.1.390; extra == "all"
|
|
77
|
+
Requires-Dist: import-linter>=2.0.0; extra == "all"
|
|
78
|
+
Requires-Dist: pip-audit>=2.7.0; extra == "all"
|
|
79
|
+
Requires-Dist: radon>=6.0.1; extra == "all"
|
|
80
|
+
Requires-Dist: cyclonedx-bom>=5.0.0; extra == "all"
|
|
81
|
+
Requires-Dist: mutmut<4,>=3.7; extra == "all"
|
|
82
|
+
Requires-Dist: tomli>=2.1.0; python_version < "3.11" and extra == "all"
|
|
83
|
+
|
|
84
|
+
# Agentic Systems
|
|
85
|
+
|
|
86
|
+
Construye agentes, coordínalos y comprueba sus resultados con una sola API.
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import agentic_systems as toolkit
|
|
90
|
+
|
|
91
|
+
worker = toolkit.Agent("total", toolkit.Action("sum", lambda data: {"total": sum(data["values"])}))
|
|
92
|
+
result = worker.run({"values": [2, 3, 5]})
|
|
93
|
+
result.data # {"total": 10}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Para coordinar unidades, conserva la misma forma de ejecutar:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
app = toolkit.System("application", toolkit.Sequence((worker,)))
|
|
100
|
+
app.run({"values": [2, 3, 5]}).data
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Agent y System admiten **Sequence**, **Parallel** y **Graph**. Las decisiones
|
|
104
|
+
son funciones Python. Tools implementan operaciones; Skills las agrupan;
|
|
105
|
+
Environment mantiene episodios y memoria; Eval comprueba el resultado.
|
|
106
|
+
`run()` es el recorrido habitual. `compile()` prepara una declaración para
|
|
107
|
+
reutilizarla cuando hace falta.
|
|
108
|
+
|
|
109
|
+
Empieza en [tutorials](tutorials/README.md), elige una tarea en
|
|
110
|
+
[examples](examples/README.md) o abre [Studio](examples/agentic_systems_studio/README.md).
|
|
111
|
+
Los [seis flujos](examples/grammar_tour/README.md) muestran la gramática completa
|
|
112
|
+
de Agent y System con entrada, proceso y salida.
|
|
113
|
+
|
|
114
|
+
El [notebook de toda la API](examples/api_walkthrough/01_api_user_guide.ipynb)
|
|
115
|
+
reúne el recorrido y la aplicación de pedidos. El [inventario de notebooks](docs/NOTEBOOK_INVENTORY_213.md)
|
|
116
|
+
distingue material vigente, referencias compartidas e historia.
|
|
117
|
+
|
|
118
|
+
La revisión **2.1.3** está en este repositorio y no se ha publicado en esta tarea.
|
|
119
|
+
Instala el wheel local proporcionado; [instalación](INSTALL.md) explica la
|
|
120
|
+
preparación inicial y los SDK opcionales. No hay aliases ni compatibilidad con
|
|
121
|
+
los constructores anteriores.
|
|
122
|
+
|
|
123
|
+
Para elegir un proveedor o framework, consulta [integraciones](docs/API_213.md#runtime-y-framework).
|
|
124
|
+
Hay pruebas actuales con Python, Ollama, Bedrock API key y OpenAI API key.
|
|
125
|
+
[La validación final](revisions/2.1.3/closeout-evidence/REPORT.md) especifica modelos,
|
|
126
|
+
casos, artefacto, consumo y límites. IAM y GPU siguen requiriendo su entorno.
|
|
127
|
+
|
|
128
|
+
[Guía de API](docs/API_213.md) · [Referencia completa](docs/API_213_SURFACE.md) ·
|
|
129
|
+
[Criterios de experiencia](docs/USER_EXPERIENCE_213.md) · [Validadores](docs/VALIDATION_213.md)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Agentic Systems
|
|
2
|
+
|
|
3
|
+
Construye agentes, coordínalos y comprueba sus resultados con una sola API.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import agentic_systems as toolkit
|
|
7
|
+
|
|
8
|
+
worker = toolkit.Agent("total", toolkit.Action("sum", lambda data: {"total": sum(data["values"])}))
|
|
9
|
+
result = worker.run({"values": [2, 3, 5]})
|
|
10
|
+
result.data # {"total": 10}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Para coordinar unidades, conserva la misma forma de ejecutar:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
app = toolkit.System("application", toolkit.Sequence((worker,)))
|
|
17
|
+
app.run({"values": [2, 3, 5]}).data
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Agent y System admiten **Sequence**, **Parallel** y **Graph**. Las decisiones
|
|
21
|
+
son funciones Python. Tools implementan operaciones; Skills las agrupan;
|
|
22
|
+
Environment mantiene episodios y memoria; Eval comprueba el resultado.
|
|
23
|
+
`run()` es el recorrido habitual. `compile()` prepara una declaración para
|
|
24
|
+
reutilizarla cuando hace falta.
|
|
25
|
+
|
|
26
|
+
Empieza en [tutorials](tutorials/README.md), elige una tarea en
|
|
27
|
+
[examples](examples/README.md) o abre [Studio](examples/agentic_systems_studio/README.md).
|
|
28
|
+
Los [seis flujos](examples/grammar_tour/README.md) muestran la gramática completa
|
|
29
|
+
de Agent y System con entrada, proceso y salida.
|
|
30
|
+
|
|
31
|
+
El [notebook de toda la API](examples/api_walkthrough/01_api_user_guide.ipynb)
|
|
32
|
+
reúne el recorrido y la aplicación de pedidos. El [inventario de notebooks](docs/NOTEBOOK_INVENTORY_213.md)
|
|
33
|
+
distingue material vigente, referencias compartidas e historia.
|
|
34
|
+
|
|
35
|
+
La revisión **2.1.3** está en este repositorio y no se ha publicado en esta tarea.
|
|
36
|
+
Instala el wheel local proporcionado; [instalación](INSTALL.md) explica la
|
|
37
|
+
preparación inicial y los SDK opcionales. No hay aliases ni compatibilidad con
|
|
38
|
+
los constructores anteriores.
|
|
39
|
+
|
|
40
|
+
Para elegir un proveedor o framework, consulta [integraciones](docs/API_213.md#runtime-y-framework).
|
|
41
|
+
Hay pruebas actuales con Python, Ollama, Bedrock API key y OpenAI API key.
|
|
42
|
+
[La validación final](revisions/2.1.3/closeout-evidence/REPORT.md) especifica modelos,
|
|
43
|
+
casos, artefacto, consumo y límites. IAM y GPU siguen requiriendo su entorno.
|
|
44
|
+
|
|
45
|
+
[Guía de API](docs/API_213.md) · [Referencia completa](docs/API_213_SURFACE.md) ·
|
|
46
|
+
[Criterios de experiencia](docs/USER_EXPERIENCE_213.md) · [Validadores](docs/VALIDATION_213.md)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agentic-systems"
|
|
7
|
-
version = "2.1.
|
|
7
|
+
version = "2.1.3"
|
|
8
8
|
description = "Agentic Systems: a computational grammar for building, executing, observing, and evaluating intelligent systems."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -24,6 +24,7 @@ dependencies = [
|
|
|
24
24
|
"pandas>=2.0.0",
|
|
25
25
|
"typing-extensions>=4.10.0",
|
|
26
26
|
"rich>=13.0.0",
|
|
27
|
+
"jsonschema>=4.23,<5",
|
|
27
28
|
]
|
|
28
29
|
|
|
29
30
|
|
|
@@ -95,11 +96,14 @@ filterwarnings = [
|
|
|
95
96
|
"ignore:'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16:DeprecationWarning:agents\\.run",
|
|
96
97
|
]
|
|
97
98
|
pythonpath = ["src"]
|
|
98
|
-
testpaths = ["tests"]
|
|
99
|
+
testpaths = ["tests/v213"]
|
|
99
100
|
cache_dir = ".tmp/pytest_cache"
|
|
100
101
|
|
|
101
102
|
[tool.ruff]
|
|
102
|
-
extend-exclude = ["artifacts"]
|
|
103
|
+
extend-exclude = ["artifacts", "src/agentic_systems/_engine"]
|
|
104
|
+
|
|
105
|
+
[tool.setuptools.package-data]
|
|
106
|
+
agentic_systems = ["_templates/**/*", "_templates/project/.env.example", "_templates/project/.gitignore"]
|
|
103
107
|
|
|
104
108
|
[tool.ruff.lint.per-file-ignores]
|
|
105
109
|
"src/agentic_systems/__init__.py" = ["F401"]
|
|
@@ -108,8 +112,8 @@ extend-exclude = ["artifacts"]
|
|
|
108
112
|
[tool.coverage.run]
|
|
109
113
|
source = ["src/agentic_systems"]
|
|
110
114
|
omit = [
|
|
111
|
-
"
|
|
112
|
-
"
|
|
115
|
+
"*/_engine/*",
|
|
116
|
+
"*/_templates/*",
|
|
113
117
|
]
|
|
114
118
|
|
|
115
119
|
[tool.coverage.report]
|
|
@@ -123,6 +127,6 @@ exclude_lines = [
|
|
|
123
127
|
]
|
|
124
128
|
|
|
125
129
|
[tool.mutmut]
|
|
126
|
-
source_paths = ["src/agentic_systems/
|
|
127
|
-
pytest_add_cli_args_test_selection = ["tests/
|
|
130
|
+
source_paths = ["src/agentic_systems/_contracts.py", "src/agentic_systems/_configuration.py", "src/agentic_systems/_results.py"]
|
|
131
|
+
pytest_add_cli_args_test_selection = ["tests/v213"]
|
|
128
132
|
mutate_only_covered_lines = true
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Agentic Systems 2.1.3: one construction and execution grammar."""
|
|
2
|
+
from ._configuration import framework, model_artifact, model_server, runtime
|
|
3
|
+
from ._grammar import Action, Agent, Environment, Eval, Graph, Limits, Parallel, Sequence, System
|
|
4
|
+
from ._results import RunResult
|
|
5
|
+
from ._tools import load_skill, skill, tool
|
|
6
|
+
|
|
7
|
+
__version__ = "2.1.3"
|
|
8
|
+
__all__ = ["tool", "skill", "load_skill", "Action", "Agent", "System", "Sequence", "Parallel", "Graph",
|
|
9
|
+
"Environment", "Eval", "Limits", "RunResult", "runtime", "framework", "model_artifact", "model_server", "__version__"]
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"""One spelling and one immutable configuration per execution responsibility."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
import math
|
|
6
|
+
from types import MappingProxyType
|
|
7
|
+
|
|
8
|
+
from ._results import _json, _redact
|
|
9
|
+
|
|
10
|
+
_PROVIDERS = {"python-runtime", "openai-runtime", "ollama-runtime", "bedrock-runtime", "vllm-runtime"}
|
|
11
|
+
_FRAMEWORKS = {"native", "langgraph", "openai-agents", "strands"}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class _Runtime:
|
|
16
|
+
provider: str
|
|
17
|
+
model: str | None
|
|
18
|
+
region: str | None
|
|
19
|
+
endpoint: str | None
|
|
20
|
+
_api_key: str | None = field(repr=False)
|
|
21
|
+
timeout_s: float
|
|
22
|
+
max_retries: int
|
|
23
|
+
max_tool_calls: int
|
|
24
|
+
max_turns: int
|
|
25
|
+
max_tokens: int | None
|
|
26
|
+
backoff_s: float
|
|
27
|
+
max_concurrency: int
|
|
28
|
+
|
|
29
|
+
def inspect(self):
|
|
30
|
+
return {"provider": self.provider, "model": self.model, "region": self.region, "endpoint": self.endpoint,
|
|
31
|
+
"api_key_configured": self._api_key is not None, "timeout_s": self.timeout_s,
|
|
32
|
+
"max_retries": self.max_retries, "max_tool_calls": self.max_tool_calls,
|
|
33
|
+
"max_turns": self.max_turns, "max_tokens": self.max_tokens,
|
|
34
|
+
"backoff_s": self.backoff_s, "max_concurrency": self.max_concurrency}
|
|
35
|
+
|
|
36
|
+
def _to_engine(self):
|
|
37
|
+
from ._engine.core.runtime import RuntimeConfig
|
|
38
|
+
from ._engine.core.scheduler import SchedulerConfig
|
|
39
|
+
return RuntimeConfig(provider=self.provider, model_id=self.model, region_name=self.region,
|
|
40
|
+
endpoint=self.endpoint, api_key=self._api_key,
|
|
41
|
+
scheduler=SchedulerConfig(timeout_s=self.timeout_s, max_retries=self.max_retries,
|
|
42
|
+
max_tool_calls=self.max_tool_calls, max_turns=self.max_turns,
|
|
43
|
+
max_concurrency=self.max_concurrency, backoff_s=self.backoff_s))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def runtime(*, provider, model=None, region=None, endpoint=None, api_key=None, timeout_s=60.0,
|
|
47
|
+
max_retries=0, max_tool_calls=5, max_turns=6, max_tokens=None, backoff_s=0.0, max_concurrency=1):
|
|
48
|
+
if provider not in _PROVIDERS:
|
|
49
|
+
raise ValueError("Choose an explicit provider: " + ", ".join(sorted(_PROVIDERS)))
|
|
50
|
+
for name, value, minimum in (("max_retries", max_retries, 0), ("max_tool_calls", max_tool_calls, 0),
|
|
51
|
+
("max_turns", max_turns, 1), ("max_concurrency", max_concurrency, 1)):
|
|
52
|
+
if type(value) is not int or value < minimum:
|
|
53
|
+
raise ValueError(name + " is outside its supported range")
|
|
54
|
+
if max_tokens is not None and (type(max_tokens) is not int or max_tokens < 1):
|
|
55
|
+
raise ValueError("max_tokens must be positive")
|
|
56
|
+
if type(timeout_s) not in {int, float} or not math.isfinite(timeout_s) or timeout_s <= 0:
|
|
57
|
+
raise ValueError("timeout_s must be positive and finite")
|
|
58
|
+
if type(backoff_s) not in {int, float} or not math.isfinite(backoff_s) or backoff_s < 0:
|
|
59
|
+
raise ValueError("backoff_s must be nonnegative and finite")
|
|
60
|
+
for name, value in (("model", model), ("region", region), ("endpoint", endpoint), ("api_key", api_key)):
|
|
61
|
+
if value is not None and (not isinstance(value, str) or not value):
|
|
62
|
+
raise TypeError(name + " must be a nonempty string")
|
|
63
|
+
if region is not None and provider != "bedrock-runtime":
|
|
64
|
+
raise ValueError("region belongs to Bedrock")
|
|
65
|
+
if provider == "python-runtime" and any(v is not None for v in (region, endpoint, api_key, max_tokens)):
|
|
66
|
+
raise ValueError("Python Runtime does not consume model connection/generation options")
|
|
67
|
+
return _Runtime(provider, model or ("python-runtime" if provider == "python-runtime" else None), region,
|
|
68
|
+
endpoint, api_key, timeout_s, max_retries, max_tool_calls, max_turns, max_tokens, backoff_s, max_concurrency)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(frozen=True)
|
|
72
|
+
class _Framework:
|
|
73
|
+
name: str
|
|
74
|
+
agent_kwargs: object
|
|
75
|
+
run_kwargs: object
|
|
76
|
+
|
|
77
|
+
def inspect(self):
|
|
78
|
+
return {"name": self.name, "agent_kwargs": {k: type(v).__name__ for k, v in self.agent_kwargs.items()},
|
|
79
|
+
"run_kwargs": {k: type(v).__name__ for k, v in self.run_kwargs.items()}}
|
|
80
|
+
|
|
81
|
+
def _to_engine(self):
|
|
82
|
+
from ._engine.integrations.config import FrameworkConfig
|
|
83
|
+
return FrameworkConfig(name=self.name, agent_kwargs=dict(self.agent_kwargs), run_kwargs=dict(self.run_kwargs))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def framework(name, *, agent_kwargs=None, run_kwargs=None):
|
|
87
|
+
if name not in _FRAMEWORKS:
|
|
88
|
+
raise ValueError("Choose an exact framework name: " + ", ".join(sorted(_FRAMEWORKS)))
|
|
89
|
+
if agent_kwargs is not None and not isinstance(agent_kwargs, dict) or run_kwargs is not None and not isinstance(run_kwargs, dict):
|
|
90
|
+
raise TypeError("Framework options must be dictionaries")
|
|
91
|
+
if name in {"native", "langgraph"} and (agent_kwargs or run_kwargs):
|
|
92
|
+
raise ValueError("This adapter does not forward native SDK options")
|
|
93
|
+
from ._engine.integrations.config import RESERVED_AGENT_KWARGS, RESERVED_RUN_KWARGS
|
|
94
|
+
owned = {"runtime", "model", "provider", "api_key", "endpoint", "timeout_s", "max_retries", "max_tokens", "max_turns", "max_tool_calls", "contract", "policy", "limits"}
|
|
95
|
+
if (set(agent_kwargs or {}) & (set(RESERVED_AGENT_KWARGS) | owned)
|
|
96
|
+
or set(run_kwargs or {}) & (set(RESERVED_RUN_KWARGS) | owned)):
|
|
97
|
+
raise ValueError("Framework options cannot override toolkit-owned configuration")
|
|
98
|
+
def nested_conflict(value):
|
|
99
|
+
if isinstance(value, dict):
|
|
100
|
+
return bool(set(value) & owned) or any(nested_conflict(v) for v in value.values())
|
|
101
|
+
return False
|
|
102
|
+
for options in (agent_kwargs or {}, run_kwargs or {}):
|
|
103
|
+
for key, value in options.items():
|
|
104
|
+
if key in {"model_settings", "model_kwargs", "generation_config", "run_config", "config"}:
|
|
105
|
+
settings = value if isinstance(value, dict) else vars(value) if hasattr(value, "__dict__") else {}
|
|
106
|
+
settings = {k: v for k, v in settings.items() if v is not None}
|
|
107
|
+
if nested_conflict(settings):
|
|
108
|
+
raise ValueError("Nested SDK options cannot override toolkit-owned configuration")
|
|
109
|
+
return _Framework(name, MappingProxyType(dict(agent_kwargs or {})), MappingProxyType(dict(run_kwargs or {})))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@dataclass(frozen=True)
|
|
113
|
+
class _Artifact:
|
|
114
|
+
model: str
|
|
115
|
+
base_model: str | None
|
|
116
|
+
adapter_path: str | None
|
|
117
|
+
tokenizer: str | None
|
|
118
|
+
revision: str | None
|
|
119
|
+
quantization: str | None
|
|
120
|
+
metadata: object
|
|
121
|
+
|
|
122
|
+
def inspect(self):
|
|
123
|
+
return {"model": self.model, "base_model": self.base_model, "adapter_path": self.adapter_path,
|
|
124
|
+
"tokenizer": self.tokenizer, "revision": self.revision, "quantization": self.quantization,
|
|
125
|
+
"metadata": _json(dict(self.metadata))}
|
|
126
|
+
|
|
127
|
+
def _to_engine(self):
|
|
128
|
+
from ._engine.schemas.serving import ModelArtifact
|
|
129
|
+
return ModelArtifact(model_id=self.model, base_model_id=self.base_model, adapter_path=self.adapter_path,
|
|
130
|
+
tokenizer_id=self.tokenizer, revision=self.revision, quantization=self.quantization, metadata=dict(self.metadata))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def model_artifact(model, *, base_model=None, adapter_path=None, tokenizer=None, revision=None, quantization=None, metadata=None):
|
|
134
|
+
if not isinstance(model, str) or not model.strip():
|
|
135
|
+
raise ValueError("Model identity is required")
|
|
136
|
+
result = _Artifact(model, base_model, adapter_path, tokenizer, revision, quantization, MappingProxyType(_json(metadata or {})))
|
|
137
|
+
result._to_engine()
|
|
138
|
+
return result
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@dataclass(frozen=True)
|
|
142
|
+
class _Endpoint:
|
|
143
|
+
url: str
|
|
144
|
+
model: str
|
|
145
|
+
backend: str
|
|
146
|
+
api_key_configured: bool
|
|
147
|
+
pid: int | None
|
|
148
|
+
owned: bool
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@dataclass(frozen=True)
|
|
152
|
+
class _Health:
|
|
153
|
+
status: str
|
|
154
|
+
endpoint: _Endpoint
|
|
155
|
+
detail: str | None
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _endpoint(value):
|
|
159
|
+
return _Endpoint(value.base_url, value.model_id, value.backend, value.api_key_configured, value.pid, value.owned)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@dataclass(frozen=True)
|
|
163
|
+
class _Server:
|
|
164
|
+
_resource: object = field(repr=False)
|
|
165
|
+
|
|
166
|
+
@property
|
|
167
|
+
def endpoint(self):
|
|
168
|
+
return _endpoint(self._resource.endpoint)
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def command(self):
|
|
172
|
+
key = self._resource.spec.api_key.get_secret_value()
|
|
173
|
+
args = self._resource.command
|
|
174
|
+
return tuple("[REDACTED]" if i and args[i-1] == "--api-key" else v.replace(key, "[REDACTED]")
|
|
175
|
+
if key and key != "vllm" else v for i, v in enumerate(args))
|
|
176
|
+
|
|
177
|
+
def inspect(self):
|
|
178
|
+
value = self._resource.inspect()
|
|
179
|
+
value["command"] = list(self.command)
|
|
180
|
+
value["endpoint"] = self.endpoint.__dict__.copy()
|
|
181
|
+
configuration = value.pop("spec")
|
|
182
|
+
artifact = configuration["artifact"]
|
|
183
|
+
for before, after in (("model_id", "model"), ("base_model_id", "base_model"), ("tokenizer_id", "tokenizer")):
|
|
184
|
+
artifact[after] = artifact.pop(before)
|
|
185
|
+
value["configuration"] = configuration
|
|
186
|
+
return _redact(value)
|
|
187
|
+
|
|
188
|
+
def start(self):
|
|
189
|
+
return _endpoint(self._resource.start())
|
|
190
|
+
|
|
191
|
+
def health(self):
|
|
192
|
+
value = self._resource.health()
|
|
193
|
+
key = self._resource.spec.api_key.get_secret_value()
|
|
194
|
+
return _Health(value.status, _endpoint(value.endpoint), value.detail.replace(key, "[REDACTED]") if key and value.detail else value.detail)
|
|
195
|
+
|
|
196
|
+
def stop(self):
|
|
197
|
+
self._resource.stop()
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def model_server(artifact, *, profile="fast", served_model_name=None, host="127.0.0.1", port=8000,
|
|
201
|
+
tool_call_parser="hermes", reasoning_parser=None, enable_auto_tool_choice=True,
|
|
202
|
+
api_key="vllm", startup_timeout_s=600.0, log_path="vllm-server.log", binary="vllm", extra_args=(),
|
|
203
|
+
gpu_memory_utilization=None, max_model_len=None, max_num_seqs=None):
|
|
204
|
+
if not isinstance(artifact, _Artifact):
|
|
205
|
+
raise TypeError("Pass model_artifact(...)")
|
|
206
|
+
managed = {"--host", "--port", "--served-model-name", "--gpu-memory-utilization", "--max-model-len", "--max-num-seqs",
|
|
207
|
+
"--tool-call-parser", "--reasoning-parser", "--enable-auto-tool-choice", "--api-key", "--generation-config"}
|
|
208
|
+
if not isinstance(extra_args, tuple) or any(not isinstance(v, str) or v.split("=", 1)[0] in managed for v in extra_args):
|
|
209
|
+
raise ValueError("extra_args cannot override managed server parameters")
|
|
210
|
+
if profile not in {"fast", "medium", "power", "custom"}:
|
|
211
|
+
raise ValueError("Unknown exact server profile")
|
|
212
|
+
from ._engine.serving.vllm import VLLMServer, vllm_server_spec
|
|
213
|
+
spec = vllm_server_spec(artifact._to_engine(), profile=profile, served_model_name=served_model_name, host=host, port=port,
|
|
214
|
+
tool_call_parser=tool_call_parser, reasoning_parser=reasoning_parser, enable_auto_tool_choice=enable_auto_tool_choice,
|
|
215
|
+
api_key=api_key, startup_timeout_s=startup_timeout_s, log_path=log_path, binary=binary, extra_args=extra_args,
|
|
216
|
+
gpu_memory_utilization=gpu_memory_utilization, max_model_len=max_model_len, max_num_seqs=max_num_seqs)
|
|
217
|
+
return _Server(VLLMServer(spec))
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Closed user dictionaries; the engine's policy vocabulary remains private."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import replace
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
from ._results import _from_engine, _json
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _closed(value, allowed, label):
|
|
11
|
+
if value is None:
|
|
12
|
+
return {}
|
|
13
|
+
if not isinstance(value, dict) or set(value) - set(allowed):
|
|
14
|
+
raise ValueError(label + " accepts only: " + ", ".join(sorted(allowed)))
|
|
15
|
+
return _json(value)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _validate_schema(schema):
|
|
19
|
+
from jsonschema import Draft202012Validator
|
|
20
|
+
if not isinstance(schema, dict):
|
|
21
|
+
raise TypeError("output_schema must be a JSON Schema dictionary")
|
|
22
|
+
def visit(value):
|
|
23
|
+
if isinstance(value, dict):
|
|
24
|
+
if "$ref" in value and not value["$ref"].startswith("#"):
|
|
25
|
+
raise ValueError("Schema references must be local; no remote resolution")
|
|
26
|
+
for child in value.values():
|
|
27
|
+
visit(child)
|
|
28
|
+
elif isinstance(value, list):
|
|
29
|
+
for child in value:
|
|
30
|
+
visit(child)
|
|
31
|
+
visit(schema)
|
|
32
|
+
Draft202012Validator.check_schema(schema)
|
|
33
|
+
return _json(schema)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _validate_contract(value, tools=(), runtime=None):
|
|
37
|
+
result = _closed(value, {"tool_expectation", "completion", "failure_policy", "expected_output", "expected_tool_outputs", "output_schema"}, "contract")
|
|
38
|
+
expectation = _closed(result.get("tool_expectation"), {"all_of", "any_of", "allowed", "forbidden", "min_count"}, "tool_expectation")
|
|
39
|
+
for key in ("all_of", "any_of", "allowed", "forbidden"):
|
|
40
|
+
if key in expectation and (not isinstance(expectation[key], list) or any(not isinstance(v, str) for v in expectation[key])):
|
|
41
|
+
raise TypeError(key + " requires a list of Tool names")
|
|
42
|
+
references = set().union(*(set(expectation.get(k, [])) for k in ("all_of", "any_of", "allowed", "forbidden")))
|
|
43
|
+
if references - set(tools):
|
|
44
|
+
raise ValueError("Contract references unavailable Tools")
|
|
45
|
+
required, forbidden = set(expectation.get("all_of", [])), set(expectation.get("forbidden", []))
|
|
46
|
+
allowed = set(expectation["allowed"]) if "allowed" in expectation else set(tools)
|
|
47
|
+
if required & forbidden or required - allowed:
|
|
48
|
+
raise ValueError("Contradictory required/allowed/forbidden Tools")
|
|
49
|
+
if expectation.get("any_of") and not set(expectation["any_of"]) & (allowed - forbidden):
|
|
50
|
+
raise ValueError("No any_of Tool can satisfy this contract")
|
|
51
|
+
if "min_count" in expectation:
|
|
52
|
+
count = expectation["min_count"]
|
|
53
|
+
if type(count) is not int or count < 0:
|
|
54
|
+
raise ValueError("min_count must be nonnegative")
|
|
55
|
+
if runtime and count > runtime.max_tool_calls:
|
|
56
|
+
raise ValueError("Contract exceeds the actor Tool budget")
|
|
57
|
+
if runtime and len(required) > runtime.max_tool_calls:
|
|
58
|
+
raise ValueError("Required Tools exceed the actor budget")
|
|
59
|
+
if result.get("completion", "default") not in {"default", "when_required_tools_satisfied", "always_finalize"}:
|
|
60
|
+
raise ValueError("Unknown exact completion mode")
|
|
61
|
+
if result.get("failure_policy", "no_unresolved") not in {"allow", "no_unresolved", "fail_fast"}:
|
|
62
|
+
raise ValueError("Unknown exact failure_policy")
|
|
63
|
+
for key in ("expected_output", "expected_tool_outputs"):
|
|
64
|
+
if key in result and not isinstance(result[key], dict):
|
|
65
|
+
raise TypeError(key + " must be a dictionary")
|
|
66
|
+
outputs = result.get("expected_tool_outputs", {})
|
|
67
|
+
if set(outputs) - set(tools) or any(not isinstance(v, dict) for v in outputs.values()):
|
|
68
|
+
raise ValueError("expected_tool_outputs requires available Tool names and dictionary expectations")
|
|
69
|
+
if "output_schema" in result:
|
|
70
|
+
result["output_schema"] = _validate_schema(result["output_schema"])
|
|
71
|
+
if expectation:
|
|
72
|
+
result["tool_expectation"] = expectation
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _validate_policy(value):
|
|
77
|
+
result = _closed(value, {"temperature", "tool_choice", "repair", "max_repairs", "finalize", "trace", "strict"}, "policy")
|
|
78
|
+
if "temperature" in result and (type(result["temperature"]) not in {int, float} or not 0 <= result["temperature"] <= 2):
|
|
79
|
+
raise ValueError("temperature must be between 0 and 2")
|
|
80
|
+
if "max_repairs" in result and (type(result["max_repairs"]) is not int or result["max_repairs"] < 0):
|
|
81
|
+
raise ValueError("max_repairs must be nonnegative")
|
|
82
|
+
for key in ("repair", "strict"):
|
|
83
|
+
if key in result and type(result[key]) is not bool:
|
|
84
|
+
raise TypeError(key + " must be boolean")
|
|
85
|
+
for key, allowed in (("tool_choice", {"auto", "required", "none"}), ("trace", {"compact", "full"}),
|
|
86
|
+
("finalize", {"never", "on_max_turns", "after_required_tools"})):
|
|
87
|
+
if key in result and result[key] not in allowed:
|
|
88
|
+
raise ValueError("Unknown " + key)
|
|
89
|
+
return result
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _invoke_actor(owner, config, selected_framework, contract, policy, value):
|
|
93
|
+
from ._engine.factories import agent
|
|
94
|
+
expectation = contract.get("tool_expectation", {})
|
|
95
|
+
private_contract = {k: v for k, v in contract.items() if k != "output_schema"}
|
|
96
|
+
if expectation:
|
|
97
|
+
private_contract["tool_expectation"] = {k: v for k, v in expectation.items() if k != "forbidden"}
|
|
98
|
+
private_contract["must_call"] = expectation.get("all_of", [])
|
|
99
|
+
private_contract["must_not_call"] = expectation.get("forbidden", [])
|
|
100
|
+
private_contract["require_no_unresolved_tool_failures"] = contract.get("failure_policy") != "allow"
|
|
101
|
+
private_policy = {**policy, "max_turns": config.max_turns, "max_tool_calls": config.max_tool_calls}
|
|
102
|
+
if config.max_tokens is not None:
|
|
103
|
+
private_policy["max_tokens"] = config.max_tokens
|
|
104
|
+
instructions = owner.instructions
|
|
105
|
+
if "output_schema" in contract:
|
|
106
|
+
instructions += "\nReturn a JSON object satisfying this JSON Schema: " + json.dumps(contract["output_schema"])
|
|
107
|
+
actor = agent(name=owner.name, runtime=config._to_engine(), framework=selected_framework._to_engine(),
|
|
108
|
+
skills=[s._to_engine() for s in owner.skills], instructions=instructions,
|
|
109
|
+
contract=private_contract, policy=private_policy)
|
|
110
|
+
return _from_engine(actor.run(value))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _check_output(output, contract):
|
|
114
|
+
issues = []
|
|
115
|
+
schema = contract.get("output_schema")
|
|
116
|
+
if schema is not None:
|
|
117
|
+
from jsonschema import Draft202012Validator
|
|
118
|
+
data = output.data
|
|
119
|
+
if not data and output.text:
|
|
120
|
+
try:
|
|
121
|
+
data = json.loads(output.text)
|
|
122
|
+
except (TypeError, ValueError):
|
|
123
|
+
issues.append({"code": "invalid_structured_output", "message": "Model text is not JSON"})
|
|
124
|
+
if isinstance(data, dict):
|
|
125
|
+
for error in Draft202012Validator(schema).iter_errors(data):
|
|
126
|
+
issues.append({"code": "output_schema_mismatch", "message": error.message, "path": list(error.path)})
|
|
127
|
+
else:
|
|
128
|
+
issues.append({"code": "output_schema_mismatch", "message": "Expected a JSON object"})
|
|
129
|
+
if not issues:
|
|
130
|
+
output = replace(output, data=data)
|
|
131
|
+
called = {e.name for n in output.walk() for e in n.tool_events}
|
|
132
|
+
forbidden = set(contract.get("tool_expectation", {}).get("forbidden", []))
|
|
133
|
+
if called & forbidden:
|
|
134
|
+
issues.append({"code": "forbidden_tool", "message": "Observed a forbidden Tool"})
|
|
135
|
+
if issues:
|
|
136
|
+
return replace(output, ok=False, errors=(*output.errors, *issues), validation={"ok": False, "issues": issues})
|
|
137
|
+
if output.ok and contract.get("failure_policy") == "allow":
|
|
138
|
+
output = replace(output, meta={**output.meta, "allowed_error_ids": [n.execution_id for n in output.walk()]})
|
|
139
|
+
return output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Private provider and framework execution machinery."""
|