aigenos-flow 0.3.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.
- aigenos_flow-0.3.1/.gitignore +30 -0
- aigenos_flow-0.3.1/LICENSE +202 -0
- aigenos_flow-0.3.1/NOTICE +5 -0
- aigenos_flow-0.3.1/PKG-INFO +414 -0
- aigenos_flow-0.3.1/README.md +335 -0
- aigenos_flow-0.3.1/aigenos_flow/__init__.py +152 -0
- aigenos_flow-0.3.1/aigenos_flow/_server_entry.py +18 -0
- aigenos_flow-0.3.1/aigenos_flow/_slack_helper.py +96 -0
- aigenos_flow-0.3.1/aigenos_flow/agent.py +361 -0
- aigenos_flow-0.3.1/aigenos_flow/agui/__init__.py +0 -0
- aigenos_flow-0.3.1/aigenos_flow/agui/events.py +135 -0
- aigenos_flow-0.3.1/aigenos_flow/agui/protocols/__init__.py +42 -0
- aigenos_flow-0.3.1/aigenos_flow/agui/protocols/a2ui.py +89 -0
- aigenos_flow-0.3.1/aigenos_flow/agui/protocols/mcp_ui.py +149 -0
- aigenos_flow-0.3.1/aigenos_flow/agui/stream.py +17 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/__init__.py +0 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/generator.py +99 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/llm.py +143 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/prompts.py +133 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/providers/__init__.py +0 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/providers/anthropic_provider.py +50 -0
- aigenos_flow-0.3.1/aigenos_flow/ai/providers/ollama_provider.py +75 -0
- aigenos_flow-0.3.1/aigenos_flow/approvals.py +135 -0
- aigenos_flow-0.3.1/aigenos_flow/autowidget.py +346 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/__init__.py +30 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/api.py +322 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/manager.py +532 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/models.py +122 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/mongodb.py +296 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/postgresql.py +246 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/secrets.py +82 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/serialization.py +45 -0
- aigenos_flow-0.3.1/aigenos_flow/connectors/store.py +407 -0
- aigenos_flow-0.3.1/aigenos_flow/context.py +475 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/duration_picker.json +88 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/order_id_input.json +39 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/order_summary.json +41 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/refund_confirm.json +48 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/subscription_details.json +157 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/subscription_grid.json +68 -0
- aigenos_flow-0.3.1/aigenos_flow/data/widgets/trip_checkout.json +75 -0
- aigenos_flow-0.3.1/aigenos_flow/data/workflows/refund_flow.yaml +63 -0
- aigenos_flow-0.3.1/aigenos_flow/declarative.py +1298 -0
- aigenos_flow-0.3.1/aigenos_flow/decorators.py +132 -0
- aigenos_flow-0.3.1/aigenos_flow/engine/__init__.py +0 -0
- aigenos_flow-0.3.1/aigenos_flow/engine/bindings.py +34 -0
- aigenos_flow-0.3.1/aigenos_flow/engine/loader.py +90 -0
- aigenos_flow-0.3.1/aigenos_flow/engine/runtime.py +190 -0
- aigenos_flow-0.3.1/aigenos_flow/engine/safe_eval.py +206 -0
- aigenos_flow-0.3.1/aigenos_flow/fields.py +201 -0
- aigenos_flow-0.3.1/aigenos_flow/guarantees.py +340 -0
- aigenos_flow-0.3.1/aigenos_flow/host.py +91 -0
- aigenos_flow-0.3.1/aigenos_flow/hosts/__init__.py +9 -0
- aigenos_flow-0.3.1/aigenos_flow/hosts/langgraph_host.py +459 -0
- aigenos_flow-0.3.1/aigenos_flow/hosts/test_host.py +233 -0
- aigenos_flow-0.3.1/aigenos_flow/integration.py +1432 -0
- aigenos_flow-0.3.1/aigenos_flow/integrations/__init__.py +0 -0
- aigenos_flow-0.3.1/aigenos_flow/integrations/databases.py +332 -0
- aigenos_flow-0.3.1/aigenos_flow/integrations/flow.py +2243 -0
- aigenos_flow-0.3.1/aigenos_flow/integrations/langgraph.py +530 -0
- aigenos_flow-0.3.1/aigenos_flow/integrations/write_access.py +28 -0
- aigenos_flow-0.3.1/aigenos_flow/interpret.py +1815 -0
- aigenos_flow-0.3.1/aigenos_flow/main.py +628 -0
- aigenos_flow-0.3.1/aigenos_flow/mcp_tools.py +226 -0
- aigenos_flow-0.3.1/aigenos_flow/outline.py +296 -0
- aigenos_flow-0.3.1/aigenos_flow/procedure.py +676 -0
- aigenos_flow-0.3.1/aigenos_flow/py.typed +0 -0
- aigenos_flow-0.3.1/aigenos_flow/runtime.py +1936 -0
- aigenos_flow-0.3.1/aigenos_flow/scenarios.py +216 -0
- aigenos_flow-0.3.1/aigenos_flow/schemas/__init__.py +0 -0
- aigenos_flow-0.3.1/aigenos_flow/schemas/widget_spec.py +29 -0
- aigenos_flow-0.3.1/aigenos_flow/schemas/workflow.py +37 -0
- aigenos_flow-0.3.1/aigenos_flow/shortform.py +1473 -0
- aigenos_flow-0.3.1/aigenos_flow/skill_editor.py +222 -0
- aigenos_flow-0.3.1/aigenos_flow/skill_generator.py +959 -0
- aigenos_flow-0.3.1/aigenos_flow/skills.py +2190 -0
- aigenos_flow-0.3.1/aigenos_flow/store.py +197 -0
- aigenos_flow-0.3.1/aigenos_flow/testing.py +143 -0
- aigenos_flow-0.3.1/aigenos_flow/toolbox.py +643 -0
- aigenos_flow-0.3.1/aigenos_flow/trace.py +84 -0
- aigenos_flow-0.3.1/aigenos_flow/write_guard.py +144 -0
- aigenos_flow-0.3.1/pyproject.toml +167 -0
- aigenos_flow-0.3.1/tests/__init__.py +0 -0
- aigenos_flow-0.3.1/tests/conftest.py +38 -0
- aigenos_flow-0.3.1/tests/flow/__init__.py +0 -0
- aigenos_flow-0.3.1/tests/flow/conftest.py +40 -0
- aigenos_flow-0.3.1/tests/flow/test_after_flow_langgraph.py +124 -0
- aigenos_flow-0.3.1/tests/flow/test_amount_grounding.py +106 -0
- aigenos_flow-0.3.1/tests/flow/test_async_and_remote_tools.py +232 -0
- aigenos_flow-0.3.1/tests/flow/test_confirm_by.py +205 -0
- aigenos_flow-0.3.1/tests/flow/test_confirm_card.py +317 -0
- aigenos_flow-0.3.1/tests/flow/test_consent_grounding.py +39 -0
- aigenos_flow-0.3.1/tests/flow/test_conversation_memory.py +968 -0
- aigenos_flow-0.3.1/tests/flow/test_correction.py +101 -0
- aigenos_flow-0.3.1/tests/flow/test_deterministic_agents.py +184 -0
- aigenos_flow-0.3.1/tests/flow/test_digression.py +253 -0
- aigenos_flow-0.3.1/tests/flow/test_executor.py +130 -0
- aigenos_flow-0.3.1/tests/flow/test_extract_json.py +73 -0
- aigenos_flow-0.3.1/tests/flow/test_fields.py +110 -0
- aigenos_flow-0.3.1/tests/flow/test_langgraph_compile.py +34 -0
- aigenos_flow-0.3.1/tests/flow/test_link_handoff.py +492 -0
- aigenos_flow-0.3.1/tests/flow/test_link_step.py +462 -0
- aigenos_flow-0.3.1/tests/flow/test_modes.py +128 -0
- aigenos_flow-0.3.1/tests/flow/test_must_elicit.py +180 -0
- aigenos_flow-0.3.1/tests/flow/test_new_features.py +132 -0
- aigenos_flow-0.3.1/tests/flow/test_non_finite_fields.py +40 -0
- aigenos_flow-0.3.1/tests/flow/test_optional_arg_binding.py +105 -0
- aigenos_flow-0.3.1/tests/flow/test_outside_flow.py +212 -0
- aigenos_flow-0.3.1/tests/flow/test_pick_recollect.py +174 -0
- aigenos_flow-0.3.1/tests/flow/test_procedure.py +276 -0
- aigenos_flow-0.3.1/tests/flow/test_release_review.py +583 -0
- aigenos_flow-0.3.1/tests/flow/test_repeat_chat.py +408 -0
- aigenos_flow-0.3.1/tests/flow/test_reply_integrity.py +161 -0
- aigenos_flow-0.3.1/tests/flow/test_resume_rereads.py +156 -0
- aigenos_flow-0.3.1/tests/flow/test_say_templates.py +92 -0
- aigenos_flow-0.3.1/tests/flow/test_session.py +126 -0
- aigenos_flow-0.3.1/tests/flow/test_short_form.py +994 -0
- aigenos_flow-0.3.1/tests/flow/test_skill_editor.py +203 -0
- aigenos_flow-0.3.1/tests/flow/test_skill_generator.py +351 -0
- aigenos_flow-0.3.1/tests/flow/test_skill_loader.py +89 -0
- aigenos_flow-0.3.1/tests/flow/test_startflow.py +181 -0
- aigenos_flow-0.3.1/tests/flow/test_steps_language.py +247 -0
- aigenos_flow-0.3.1/tests/flow/test_then_say.py +124 -0
- aigenos_flow-0.3.1/tests/flow/test_unheard_answers.py +221 -0
- aigenos_flow-0.3.1/tests/flow/test_widget_submission_bypass.py +85 -0
- aigenos_flow-0.3.1/tests/flow/test_widget_submission_graph.py +113 -0
- aigenos_flow-0.3.1/tests/flow/test_workflow_field.py +236 -0
- aigenos_flow-0.3.1/tests/flow/test_wrap_custom_graph.py +245 -0
- aigenos_flow-0.3.1/tests/flow/test_wrapper_integration.py +682 -0
- aigenos_flow-0.3.1/tests/test_bare_install.py +68 -0
- aigenos_flow-0.3.1/tests/test_bindings.py +35 -0
- aigenos_flow-0.3.1/tests/test_bundled_data.py +59 -0
- aigenos_flow-0.3.1/tests/test_connectors.py +428 -0
- aigenos_flow-0.3.1/tests/test_cookbook.py +122 -0
- aigenos_flow-0.3.1/tests/test_create_skill_replace.py +106 -0
- aigenos_flow-0.3.1/tests/test_current_source_import.py +45 -0
- aigenos_flow-0.3.1/tests/test_database_tools.py +248 -0
- aigenos_flow-0.3.1/tests/test_declarative_skill.py +346 -0
- aigenos_flow-0.3.1/tests/test_developer_guide.py +106 -0
- aigenos_flow-0.3.1/tests/test_easy_steps.py +371 -0
- aigenos_flow-0.3.1/tests/test_examples_runnable.py +106 -0
- aigenos_flow-0.3.1/tests/test_gallery.py +85 -0
- aigenos_flow-0.3.1/tests/test_gallery_templates.py +96 -0
- aigenos_flow-0.3.1/tests/test_gate_runtime.py +795 -0
- aigenos_flow-0.3.1/tests/test_guarantees_steps.py +97 -0
- aigenos_flow-0.3.1/tests/test_guide.py +111 -0
- aigenos_flow-0.3.1/tests/test_guidelines.py +137 -0
- aigenos_flow-0.3.1/tests/test_language_size.py +135 -0
- aigenos_flow-0.3.1/tests/test_llm_provider_errors.py +111 -0
- aigenos_flow-0.3.1/tests/test_loader_fail_closed.py +914 -0
- aigenos_flow-0.3.1/tests/test_outline.py +156 -0
- aigenos_flow-0.3.1/tests/test_packaging_metadata.py +239 -0
- aigenos_flow-0.3.1/tests/test_protocols.py +84 -0
- aigenos_flow-0.3.1/tests/test_readme_claims.py +91 -0
- aigenos_flow-0.3.1/tests/test_readme_frontdoor.py +77 -0
- aigenos_flow-0.3.1/tests/test_runtime.py +59 -0
- aigenos_flow-0.3.1/tests/test_safe_eval.py +92 -0
- aigenos_flow-0.3.1/tests/test_safe_eval_loadtime.py +81 -0
- aigenos_flow-0.3.1/tests/test_safe_eval_strict.py +81 -0
- aigenos_flow-0.3.1/tests/test_self_mounted_router_guard.py +148 -0
- aigenos_flow-0.3.1/tests/test_server_bootstrap.py +83 -0
- aigenos_flow-0.3.1/tests/test_server_security.py +513 -0
- aigenos_flow-0.3.1/tests/test_shipped_skill_gates.py +124 -0
- aigenos_flow-0.3.1/tests/test_showcase_conference_trip.py +265 -0
- aigenos_flow-0.3.1/tests/test_showcase_offsite.py +90 -0
- aigenos_flow-0.3.1/tests/test_showcase_refund_desk.py +189 -0
- aigenos_flow-0.3.1/tests/test_skill_generator_collision.py +55 -0
- aigenos_flow-0.3.1/tests/test_steps_reference.py +103 -0
- aigenos_flow-0.3.1/tests/test_store.py +51 -0
- aigenos_flow-0.3.1/tests/test_tool_library_api.py +362 -0
- aigenos_flow-0.3.1/tests/test_trace_scenarios_guarantees.py +295 -0
- aigenos_flow-0.3.1/tests/test_widget_linkage.py +160 -0
- aigenos_flow-0.3.1/tests/test_widget_loader.py +63 -0
- aigenos_flow-0.3.1/tests/test_wire_contract.py +1094 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Build and test artifacts for the aigenos-flow Python package.
|
|
2
|
+
#
|
|
3
|
+
# This file is also what the published sdist ships as its .gitignore:
|
|
4
|
+
# hatchling walks up from the project root looking for a VCS ignore file, uses
|
|
5
|
+
# it for the sdist's default exclusions and then force-includes it in the
|
|
6
|
+
# archive (hatchling/builders/sdist.py get_default_build_data). Without a local
|
|
7
|
+
# one, the monorepo's root .gitignore ended up inside aigenos_flow-*.tar.gz,
|
|
8
|
+
# which is not part of this package.
|
|
9
|
+
|
|
10
|
+
# Build output
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
*.egg-info/
|
|
14
|
+
|
|
15
|
+
# Caches
|
|
16
|
+
__pycache__/
|
|
17
|
+
*.py[cod]
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
|
|
22
|
+
# Local state a running server writes — never committed, never published.
|
|
23
|
+
# ANCHORED (/data/): an unanchored `data/` also swallows aigenos_flow/data/, the
|
|
24
|
+
# shipped widget catalog, so a newly designed widget was silently never committed.
|
|
25
|
+
/data/
|
|
26
|
+
aigenos_flow/data/skills/
|
|
27
|
+
aigenos_flow/data/studio.db
|
|
28
|
+
aigenos_flow/data/studio.db-*
|
|
29
|
+
aigenos_flow/data/connectors.sqlite3
|
|
30
|
+
aigenos_flow/data/connectors.sqlite3-*
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: aigenos-flow
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Deterministic conversational flows for LangGraph agents — with an optional drop-in widget layer (AG-UI/A2UI/MCP-UI).
|
|
5
|
+
Project-URL: Homepage, https://aigenos.io
|
|
6
|
+
Project-URL: Repository, https://github.com/aigenos/flow
|
|
7
|
+
Project-URL: Issues, https://github.com/aigenos/flow/issues
|
|
8
|
+
Project-URL: Documentation, https://aigenos.io
|
|
9
|
+
Author: aigenos
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: a2ui,agui,ai-agents,chatbot,conversational-ai,deterministic,dialogue,langgraph,mcp-ui,react,skills,widgets
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: langchain-core>=0.3.67
|
|
27
|
+
Requires-Dist: langgraph-prebuilt!=1.0.10,!=1.0.11,!=1.0.12,!=1.0.13,!=1.0.9,<2.0,>=0.6.0
|
|
28
|
+
Requires-Dist: langgraph<2.0,>=0.6.0
|
|
29
|
+
Requires-Dist: pydantic>=2.7.4
|
|
30
|
+
Requires-Dist: pyyaml>=6.0
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: anthropic>=0.92; extra == 'all'
|
|
33
|
+
Requires-Dist: cryptography>=43; extra == 'all'
|
|
34
|
+
Requires-Dist: fastapi>=0.115; extra == 'all'
|
|
35
|
+
Requires-Dist: httpx>=0.27; extra == 'all'
|
|
36
|
+
Requires-Dist: langchain-anthropic>=0.3; extra == 'all'
|
|
37
|
+
Requires-Dist: langchain-google-genai>=2.0; extra == 'all'
|
|
38
|
+
Requires-Dist: langchain-ollama>=0.2; extra == 'all'
|
|
39
|
+
Requires-Dist: langchain-openai>=0.3; extra == 'all'
|
|
40
|
+
Requires-Dist: psycopg[binary,pool]>=3.2; extra == 'all'
|
|
41
|
+
Requires-Dist: pymongo>=4.6; extra == 'all'
|
|
42
|
+
Requires-Dist: pymongo[srv]>=4.10; extra == 'all'
|
|
43
|
+
Requires-Dist: redis>=5.0; extra == 'all'
|
|
44
|
+
Requires-Dist: sqlparse>=0.5; extra == 'all'
|
|
45
|
+
Requires-Dist: sse-starlette>=2.1; extra == 'all'
|
|
46
|
+
Requires-Dist: uvicorn[standard]>=0.32; extra == 'all'
|
|
47
|
+
Provides-Extra: anthropic
|
|
48
|
+
Requires-Dist: langchain-anthropic>=0.3; extra == 'anthropic'
|
|
49
|
+
Provides-Extra: connectors
|
|
50
|
+
Requires-Dist: cryptography>=43; extra == 'connectors'
|
|
51
|
+
Requires-Dist: psycopg[binary,pool]>=3.2; extra == 'connectors'
|
|
52
|
+
Requires-Dist: pymongo[srv]>=4.10; extra == 'connectors'
|
|
53
|
+
Requires-Dist: sqlparse>=0.5; extra == 'connectors'
|
|
54
|
+
Provides-Extra: dev
|
|
55
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
56
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
57
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
58
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
59
|
+
Requires-Dist: ruff>=0.7; extra == 'dev'
|
|
60
|
+
Provides-Extra: gemini
|
|
61
|
+
Requires-Dist: langchain-google-genai>=2.0; extra == 'gemini'
|
|
62
|
+
Provides-Extra: mongodb
|
|
63
|
+
Requires-Dist: pymongo>=4.6; extra == 'mongodb'
|
|
64
|
+
Provides-Extra: ollama
|
|
65
|
+
Requires-Dist: langchain-ollama>=0.2; extra == 'ollama'
|
|
66
|
+
Provides-Extra: openai
|
|
67
|
+
Requires-Dist: langchain-openai>=0.3; extra == 'openai'
|
|
68
|
+
Provides-Extra: redis
|
|
69
|
+
Requires-Dist: redis>=5.0; extra == 'redis'
|
|
70
|
+
Provides-Extra: server
|
|
71
|
+
Requires-Dist: anthropic>=0.92; extra == 'server'
|
|
72
|
+
Requires-Dist: fastapi>=0.115; extra == 'server'
|
|
73
|
+
Requires-Dist: httpx>=0.27; extra == 'server'
|
|
74
|
+
Requires-Dist: langchain-anthropic>=0.3; extra == 'server'
|
|
75
|
+
Requires-Dist: langchain-ollama>=0.2; extra == 'server'
|
|
76
|
+
Requires-Dist: sse-starlette>=2.1; extra == 'server'
|
|
77
|
+
Requires-Dist: uvicorn[standard]>=0.32; extra == 'server'
|
|
78
|
+
Description-Content-Type: text/markdown
|
|
79
|
+
|
|
80
|
+
# aigenos-flow
|
|
81
|
+
|
|
82
|
+
> **The LLM fills fields. Your program does everything else.**
|
|
83
|
+
|
|
84
|
+
You probably already have the setup this package upgrades: a LangGraph ReAct
|
|
85
|
+
agent that loads **skills as natural-language instructions**. It mostly works,
|
|
86
|
+
and two things keep failing in the same way:
|
|
87
|
+
|
|
88
|
+
1. **Policies are advisory.** "Always require a 2FA code above $1000" holds on
|
|
89
|
+
most runs — until a rephrase, a correction, or a pushy user lands on the run
|
|
90
|
+
where the model skips it. The instruction was a suggestion, and the model is
|
|
91
|
+
the one deciding.
|
|
92
|
+
2. **Widgets are a coin flip.** If rendering a widget is a tool the model *may*
|
|
93
|
+
call, your forms and grids show up sometimes. The UI is a choice the LLM
|
|
94
|
+
makes per turn, so it drifts like everything else.
|
|
95
|
+
|
|
96
|
+
aigenos-flow fixes both **without replacing your agent**: you keep ReAct for
|
|
97
|
+
open-ended turns, and promote the workflows that touch real things — money,
|
|
98
|
+
bookings, tickets — into typed, deterministic flows.
|
|
99
|
+
|
|
100
|
+
## Install
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install aigenos-flow # the engine — no server, no UI required
|
|
104
|
+
pip install "aigenos-flow[server]" # optional FastAPI server that streams widgets
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Python 3.11+. The engine's whole dependency list is pydantic, PyYAML,
|
|
108
|
+
langchain-core, langgraph and langgraph-prebuilt.
|
|
109
|
+
|
|
110
|
+
## What changes in a skill: before → after
|
|
111
|
+
|
|
112
|
+
**Before** — the instruction skill you have today. Every rule is enforced by
|
|
113
|
+
hoping the model complies:
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
---
|
|
117
|
+
name: transfer-funds
|
|
118
|
+
description: Send money to a saved payee.
|
|
119
|
+
---
|
|
120
|
+
Help the user transfer money. Collect the amount and the payee.
|
|
121
|
+
ALWAYS require a 6-digit verification code for amounts of $1000 or more.
|
|
122
|
+
Confirm with the user before calling transfer_money. Never skip confirmation.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**After** — same file, same English body, plus a list of steps. The rules move
|
|
126
|
+
from prose into structure the runtime enforces:
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
---
|
|
130
|
+
name: transfer-funds
|
|
131
|
+
description: Send money to a saved payee. Amounts of $1000 and above require a 2FA code.
|
|
132
|
+
steps:
|
|
133
|
+
- ask: { amount: "How much do you want to send? (USD)" }
|
|
134
|
+
check: { amount > 0: "Enter an amount above zero." }
|
|
135
|
+
- ask: { payee: "Who is it going to?" }
|
|
136
|
+
choices: [mom, landlord, gym]
|
|
137
|
+
- ask: { code: "Enter the 6-digit code we texted you." }
|
|
138
|
+
when: amount >= 1000 # the 2FA gate, re-evaluated on every replay
|
|
139
|
+
type: secret # never logged, never supplied by the model
|
|
140
|
+
pattern: '^[0-9]{6}$' # a shape, so "skip" cannot satisfy the gate
|
|
141
|
+
- say: "You're sending ${{amount}} to {{payee}}."
|
|
142
|
+
- confirm: Send this transfer?
|
|
143
|
+
- do: bank_transfer # changes something: unreachable until the yes
|
|
144
|
+
- say: "Sent ${{amount}} to {{payee}}."
|
|
145
|
+
---
|
|
146
|
+
Help the user transfer money. Collect the amount and the payee.
|
|
147
|
+
(The body stays — it's now LLM context for extraction and tone. The 2FA rule
|
|
148
|
+
above no longer lives here, because prose can't enforce anything.)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
What you **added**: `steps:`. Five kinds of step (`ask`, `say`, `do`,
|
|
152
|
+
`confirm`, `chat`), with `when:` for the gate and `check:` for what an answer must
|
|
153
|
+
satisfy. What you **kept**: the English. What you **deleted**: nothing. Skills
|
|
154
|
+
that are purely advisory — tone, escalation, style — stay instruction-only and
|
|
155
|
+
unchanged.
|
|
156
|
+
|
|
157
|
+
There is no schema to write. `amount` is a number because the `when:` compares
|
|
158
|
+
it with one, `payee` is a select because of `choices:`, and `bank_transfer`
|
|
159
|
+
receives the answers whose names match its parameters. It is not marked
|
|
160
|
+
read-only, so it needs the `confirm:` above it, runs at most once per flow run,
|
|
161
|
+
and goes on the audit trail with the code redacted.
|
|
162
|
+
|
|
163
|
+
The loader verifies the skill **before any conversation starts**, and a
|
|
164
|
+
violation is a load error, not a warning: a misspelled word, a tool that
|
|
165
|
+
changes something with no `confirm:` above it, a step that reads an answer
|
|
166
|
+
nothing has asked for, or a condition that compares text with a number. And one
|
|
167
|
+
thing it does for you: `amount` decides whether a code is needed, so the flow
|
|
168
|
+
makes it user-only. The model may pass on a number the user typed; any other
|
|
169
|
+
number is dropped.
|
|
170
|
+
|
|
171
|
+
This exact before/after is a **runnable proof** — the same hostile input thrown
|
|
172
|
+
at both architectures, 42 checks, about 1 second, no API key:
|
|
173
|
+
[`examples/before_after/prove.py`](https://github.com/aigenos/flow/tree/main/examples/before_after).
|
|
174
|
+
The model is scripted in both halves, so the proof is about the executor: when
|
|
175
|
+
a model emits a $5000 transfer with no code, the prompt-only agent runs it; as
|
|
176
|
+
structure, the transfer is unreachable — and the legitimate path still
|
|
177
|
+
completes. It runs from a clone on the bare install; no extra is needed.
|
|
178
|
+
|
|
179
|
+
## Two ways to run it
|
|
180
|
+
|
|
181
|
+
### 1 — Let aigenos-flow be the agent
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from aigenos_flow import create_agent
|
|
185
|
+
|
|
186
|
+
agent = create_agent(llm, "skills/", tools=[bank_transfer])
|
|
187
|
+
|
|
188
|
+
agent.invoke({"messages": [("user", "send $5000 to mom")]},
|
|
189
|
+
config={"configurable": {"thread_id": "t1"}})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
That's the whole integration. A query that matches a skill runs its flow
|
|
193
|
+
**deterministically** — typed extraction, gates, replayed order. A query that
|
|
194
|
+
doesn't (and the conversation *after* a flow completes) is ordinary ReAct
|
|
195
|
+
question/answer over the accumulated context. Activation is a structured
|
|
196
|
+
classifier per message — deterministic *when*, LLM-judged *which*, no regex.
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
create_agent(llm, skills_dir="skills/", *, tools=None, prompt="", a2ui=True,
|
|
200
|
+
mode="flex", checkpointer=None, host=None,
|
|
201
|
+
governed_tools="flow_only")
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- `tools=` takes a list of LangChain tools / plain callables, or a
|
|
205
|
+
`{name: callable}` dict. They are both tools a skill's steps may name and
|
|
206
|
+
the ReAct loop's tools.
|
|
207
|
+
- **Tools can live with the skills instead.** Every public function in
|
|
208
|
+
`skills/tools.py` or `skills/tools/*.py` is a tool the steps can name
|
|
209
|
+
(`tools_dir=` adds a folder kept elsewhere). Mark the ones that only look
|
|
210
|
+
things up with `@readonly`; any other tool needs a `confirm:` above it.
|
|
211
|
+
Adding a flow never means editing the agent's own code.
|
|
212
|
+
- **A write a skill governs never reaches the model raw.** That is
|
|
213
|
+
`governed_tools="flow_only"`, the default: on a turn that lands in the ReAct
|
|
214
|
+
loop, the model gets a shim that refuses and starts the governing flow
|
|
215
|
+
instead, with gates armed. `governed_tools="allow"` opts out and keeps the
|
|
216
|
+
ungated path.
|
|
217
|
+
- `skills_dir` must exist and hold at least one flow-capable skill. Otherwise
|
|
218
|
+
this **raises** — it never hands back a plain ReAct agent that merely looks
|
|
219
|
+
gated.
|
|
220
|
+
- A `MemorySaver` checkpointer is installed by default so paused flows survive
|
|
221
|
+
across `invoke` calls. Pass your own `checkpointer=` in production.
|
|
222
|
+
|
|
223
|
+
### 2 — Wrap the agent you already have
|
|
224
|
+
|
|
225
|
+
Already running `create_react_agent`, or a LangGraph graph of your own? Keep
|
|
226
|
+
it. One call adds the deterministic boundary in front:
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from aigenos_flow import wrap_agent
|
|
230
|
+
|
|
231
|
+
safe_agent = wrap_agent(my_existing_agent, skills_dir="skills/",
|
|
232
|
+
llm=llm, tools=[bank_transfer])
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Your agent keeps its tools, its prompt and its state; extra keys on its own
|
|
236
|
+
state schema pass through and merge back. The wrapper intercepts messages that
|
|
237
|
+
match a skill, runs the flow to completion, then hands the conversation back.
|
|
238
|
+
|
|
239
|
+
Wrapping cannot edit a compiled graph's tool list, so it **checks** instead of
|
|
240
|
+
repairing: a tool on your agent whose name a skill governs is an error, and
|
|
241
|
+
tools it cannot vouch for are a warning (nothing can tell that your
|
|
242
|
+
`transfer_money` is the skill's `bank_transfer`). Fix either one by wrapping the
|
|
243
|
+
tool — the flow still executes the real thing:
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
from aigenos_flow import flow_only
|
|
247
|
+
|
|
248
|
+
my_existing_agent = create_react_agent(llm, tools=[flow_only(bank_transfer)])
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Prefer wiring the router yourself (custom state schemas, non-LangGraph
|
|
252
|
+
frameworks)? The explicit recipe with a zero-LLM proof is in
|
|
253
|
+
[`examples/embed_existing_agent`](https://github.com/aigenos/flow/tree/main/examples/embed_existing_agent).
|
|
254
|
+
|
|
255
|
+
## What the file gives you besides the gate
|
|
256
|
+
|
|
257
|
+
**What you approve is what runs.** The confirmation is a card the engine
|
|
258
|
+
builds: the tool a yes will run and the inputs it will run with. What was shown
|
|
259
|
+
is kept and compared when the tool is called. If an input changed after the
|
|
260
|
+
yes, the tool does not run and the yes is asked for again.
|
|
261
|
+
|
|
262
|
+
**It reads back as a procedure.**
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
python -m aigenos_flow.procedure skills/ transfer-funds
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
prints each step in plain words, every way through the flow, and what must be
|
|
269
|
+
true before each tool that changes something. It is generated from the file
|
|
270
|
+
and the tools with no model involved, so it cannot say something the flow does
|
|
271
|
+
not do.
|
|
272
|
+
|
|
273
|
+
**A yes can be someone else's.**
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
- confirm: Approve this transfer?
|
|
277
|
+
by: compliance
|
|
278
|
+
when: amount >= 10000
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The flow stops and files a request showing the question, the tool and its
|
|
282
|
+
inputs. The answer reaches the flow only through the approvals store
|
|
283
|
+
(`store.decide(id, True, by="dana")`, or `POST /flow/approvals/{id}`): sent
|
|
284
|
+
through the conversation, by the user, by the model or by a posted form, it is
|
|
285
|
+
refused. `by:` says who is asked; checking who answers is yours to put in
|
|
286
|
+
front.
|
|
287
|
+
|
|
288
|
+
**Tools from an MCP server** work like any others:
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
from aigenos_flow.mcp_tools import MCPTools # pip install mcp
|
|
292
|
+
|
|
293
|
+
agent = create_agent(llm, "skills/", tools=MCPTools([sys.executable, "server.py"]).tools())
|
|
294
|
+
remote = MCPTools(url="https://mcp.example.com/mcp") # a remote server, over streamable HTTP
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
A tool the server annotates `readOnlyHint` is a lookup. Any other needs a
|
|
298
|
+
`confirm:` above it and runs at most once, like a function that is not
|
|
299
|
+
`@readonly`. Tools you already load with LangChain's MCP adapters, and
|
|
300
|
+
`async def` tools, can be passed in `tools=` as they are.
|
|
301
|
+
|
|
302
|
+
## Widgets stop being a coin flip
|
|
303
|
+
|
|
304
|
+
In a flow, a widget is **not a tool the model may call** — it's what an `ask:`
|
|
305
|
+
step *is*. Every run, the same step renders the same thing:
|
|
306
|
+
|
|
307
|
+
| step | what renders — always |
|
|
308
|
+
|---|---|
|
|
309
|
+
| `ask: { amount: ... }` | number input |
|
|
310
|
+
| `ask: { payee: ... }` with `choices:` | select built from the choices |
|
|
311
|
+
| `ask: { code: ... }` with `type: secret` | masked input — exactly when the gate fires |
|
|
312
|
+
| `ask:` with `from: <tool>` | that tool's rows as a selectable grid |
|
|
313
|
+
| `say: "{{tool.result}}"` | a card, grid or timeline — chosen by the shape of the data |
|
|
314
|
+
| `confirm:` | a card naming the tool a yes will run and its inputs, with Yes and No |
|
|
315
|
+
| `do: bank_transfer` | nothing — the one place money can move |
|
|
316
|
+
|
|
317
|
+
With `a2ui=True` (the default), a pause interrupts with exactly
|
|
318
|
+
`{"prompt", "field", "flow_id", "widget"}`, and the same widget spec rides on
|
|
319
|
+
the paused assistant message as `additional_kwargs["aigenos_widget"]`, so an
|
|
320
|
+
AG-UI / A2UI client renders it straight from the stream. For an `ask:` with
|
|
321
|
+
`from:` or `widget:` that widget is what the step built: the selectable grid
|
|
322
|
+
with its rows, or the designed widget with its data.
|
|
323
|
+
|
|
324
|
+
Resume with a widget submission
|
|
325
|
+
(`Command(resume={"code": "481920"})`) or free text
|
|
326
|
+
(`Command(resume="481920, yes send it")`). A submission comes back as **typed
|
|
327
|
+
field updates that bypass the LLM entirely** — pure validation and gate
|
|
328
|
+
re-evaluation, so a form can't hallucinate, and a corrected value (the user
|
|
329
|
+
bumps $500 → $5000 on a review screen) re-arms the 2FA gate and clears the code
|
|
330
|
+
already collected. `a2ui=False` skips widget resolution entirely.
|
|
331
|
+
|
|
332
|
+
The widget itself either has no asset at all (derived from the `FieldSpec` on
|
|
333
|
+
the fly) or is a JSON file in your widgets catalog, in git, named by
|
|
334
|
+
`widget: <id>`. The catalog is the `widgets/` folder under `FG_DATA_DIR` (one
|
|
335
|
+
`*.json` per widget, matched by its `id`); with `FG_DATA_DIR` unset that is the
|
|
336
|
+
package's own data folder, so set it to a folder in your repository.
|
|
337
|
+
|
|
338
|
+
**And you do not need our frontend.** Determinism is entirely backend. Smallest
|
|
339
|
+
tier first: read `chat.awaiting` + `chat.spec` after each turn, map the spec to
|
|
340
|
+
your own components, and post back with `chat.submit(field=value)` — no npm
|
|
341
|
+
package, no `[server]` extra. Or take the wire protocols from `[server]`
|
|
342
|
+
(`?protocol=ag-ui|a2ui|mcp-ui`); what is proven there is that this project's own
|
|
343
|
+
client consumes those bytes end to end, not conformance to a published A2UI or
|
|
344
|
+
MCP-UI spec revision — both adapters track drafts. Or use the renderer:
|
|
345
|
+
[`@aigenos/flow`](https://www.npmjs.com/package/@aigenos/flow) on npm, a
|
|
346
|
+
`<Widget>` component plus 16 primitives, zero runtime deps.
|
|
347
|
+
|
|
348
|
+
## Test whole conversations with no API key
|
|
349
|
+
|
|
350
|
+
`TestHost` stands in for the LLM: you script what the model *would* extract;
|
|
351
|
+
the **real engine** runs the turn — validation, gates, order, effect dedup:
|
|
352
|
+
|
|
353
|
+
```python
|
|
354
|
+
from aigenos_flow import FlowAgent, SetField
|
|
355
|
+
from aigenos_flow.hosts.test_host import TestHost
|
|
356
|
+
|
|
357
|
+
def bank_transfer(amount: float, payee: str, code: str = "") -> dict:
|
|
358
|
+
# a tool is a plain function: it receives the answers whose names
|
|
359
|
+
# match its parameters (LangChain tools with .invoke() work as-is)
|
|
360
|
+
return {"txn": "TXN-1"}
|
|
361
|
+
|
|
362
|
+
host = TestHost() # stands in for the LLM
|
|
363
|
+
agent = FlowAgent.from_dir("skills/", host=host,
|
|
364
|
+
tools={"bank_transfer": bank_transfer})
|
|
365
|
+
|
|
366
|
+
# "When the user says this, the model would extract these fields."
|
|
367
|
+
host.queue_commands("send $5000 to mom",
|
|
368
|
+
SetField(field="amount", value=5000),
|
|
369
|
+
SetField(field="payee", value="mom"))
|
|
370
|
+
|
|
371
|
+
chat = agent.session("transfer-funds").user("send $5000 to mom")
|
|
372
|
+
assert chat.awaiting == "code" # $5000 -> the gate is armed
|
|
373
|
+
|
|
374
|
+
chat.submit(code="481920").submit(confirm=True)
|
|
375
|
+
assert chat.done # fired once, only with the code
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Your policy gates become CI assertions instead of prayers.
|
|
379
|
+
|
|
380
|
+
## Where LangGraph fits
|
|
381
|
+
|
|
382
|
+
Built **on** LangGraph, not hiding it: `agent.as_langgraph()` *compiles* the
|
|
383
|
+
skill folder into an ordinary graph you can embed, checkpoint and stream — or
|
|
384
|
+
skip the graph entirely, `agent.turn(state)` is a plain function. The
|
|
385
|
+
determinism comes from the replay runtime (the flow re-runs from the top each
|
|
386
|
+
turn, so corrections re-arm every downstream gate), not from the graph layer.
|
|
387
|
+
|
|
388
|
+
## Serving it
|
|
389
|
+
|
|
390
|
+
The `[server]` extra binds loopback and defaults CORS to local dev origins
|
|
391
|
+
(never `*`). Every endpoint that writes a skill or widget, or hands back a
|
|
392
|
+
skill's source, is **reachable from loopback only by default** — a skill can
|
|
393
|
+
carry Python this process then imports — so the Studio (the authoring UI; it
|
|
394
|
+
runs from a clone of the repository and is not inside this package) works on
|
|
395
|
+
your own machine while a request from any other host gets a 403. Set
|
|
396
|
+
`FG_SKILL_WRITES=off` to drop that surface entirely, or `=token` with
|
|
397
|
+
`FG_ADMIN_TOKEN` to keep it behind a secret, before exposing the port. The
|
|
398
|
+
Studio UI does not send that token in 0.3.1, so token mode is for API and CI
|
|
399
|
+
clients. Chatting, listing skills and reading widgets are open. Sensitive
|
|
400
|
+
fields are redacted in the audit trail. Full table:
|
|
401
|
+
[the developer guide](https://github.com/aigenos/flow/blob/main/docs/developer-guide.md#rest-api-server-extra).
|
|
402
|
+
|
|
403
|
+
## Links
|
|
404
|
+
|
|
405
|
+
- [Steps reference](https://github.com/aigenos/flow/blob/main/docs/steps.md) — the whole short form on one page
|
|
406
|
+
- [Developer guide](https://github.com/aigenos/flow/blob/main/docs/developer-guide.md) — install, tool library, REST API, ship checklist
|
|
407
|
+
- [10-minute tutorial](https://github.com/aigenos/flow/blob/main/docs/GUIDE.md) · [long-form reference](https://github.com/aigenos/flow/blob/main/docs/skill-authoring.md)
|
|
408
|
+
- [Runnable proofs, no API key](https://github.com/aigenos/flow/tree/main/examples)
|
|
409
|
+
- Source: https://github.com/aigenos/flow · Issues: https://github.com/aigenos/flow/issues
|
|
410
|
+
- Site: https://aigenos.io
|
|
411
|
+
|
|
412
|
+
## License
|
|
413
|
+
|
|
414
|
+
Apache-2.0
|