fastworkflow 2.13.5__py3-none-any.whl → 2.14.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. fastworkflow/_workflows/command_metadata_extraction/_commands/ErrorCorrection/you_misunderstood.py +1 -1
  2. fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/go_up.py +1 -1
  3. fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/reset_context.py +1 -1
  4. fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/what_can_i_do.py +98 -166
  5. fastworkflow/_workflows/command_metadata_extraction/_commands/wildcard.py +7 -3
  6. fastworkflow/build/genai_postprocessor.py +143 -149
  7. fastworkflow/chat_session.py +42 -11
  8. fastworkflow/command_metadata_api.py +794 -0
  9. fastworkflow/command_routing.py +4 -1
  10. fastworkflow/examples/fastworkflow.env +1 -1
  11. fastworkflow/examples/fastworkflow.passwords.env +1 -0
  12. fastworkflow/examples/hello_world/_commands/add_two_numbers.py +1 -0
  13. fastworkflow/examples/retail_workflow/_commands/calculate.py +67 -0
  14. fastworkflow/examples/retail_workflow/_commands/cancel_pending_order.py +4 -1
  15. fastworkflow/examples/retail_workflow/_commands/exchange_delivered_order_items.py +13 -1
  16. fastworkflow/examples/retail_workflow/_commands/find_user_id_by_email.py +6 -1
  17. fastworkflow/examples/retail_workflow/_commands/find_user_id_by_name_zip.py +6 -1
  18. fastworkflow/examples/retail_workflow/_commands/get_order_details.py +22 -10
  19. fastworkflow/examples/retail_workflow/_commands/get_product_details.py +12 -4
  20. fastworkflow/examples/retail_workflow/_commands/get_user_details.py +21 -5
  21. fastworkflow/examples/retail_workflow/_commands/list_all_product_types.py +4 -1
  22. fastworkflow/examples/retail_workflow/_commands/modify_pending_order_address.py +3 -0
  23. fastworkflow/examples/retail_workflow/_commands/modify_pending_order_items.py +12 -0
  24. fastworkflow/examples/retail_workflow/_commands/modify_pending_order_payment.py +7 -1
  25. fastworkflow/examples/retail_workflow/_commands/modify_user_address.py +3 -0
  26. fastworkflow/examples/retail_workflow/_commands/return_delivered_order_items.py +10 -1
  27. fastworkflow/examples/retail_workflow/_commands/transfer_to_human_agents.py +1 -1
  28. fastworkflow/examples/retail_workflow/tools/calculate.py +1 -1
  29. fastworkflow/mcp_server.py +52 -44
  30. fastworkflow/run/__main__.py +9 -5
  31. fastworkflow/run_agent/__main__.py +8 -8
  32. fastworkflow/run_agent/agent_module.py +6 -16
  33. fastworkflow/utils/command_dependency_graph.py +130 -143
  34. fastworkflow/utils/dspy_utils.py +11 -0
  35. fastworkflow/utils/signatures.py +7 -0
  36. fastworkflow/workflow_agent.py +186 -0
  37. {fastworkflow-2.13.5.dist-info → fastworkflow-2.14.1.dist-info}/METADATA +12 -3
  38. {fastworkflow-2.13.5.dist-info → fastworkflow-2.14.1.dist-info}/RECORD +41 -40
  39. fastworkflow/agent_integration.py +0 -239
  40. fastworkflow/examples/retail_workflow/_commands/parameter_dependency_graph.json +0 -36
  41. {fastworkflow-2.13.5.dist-info → fastworkflow-2.14.1.dist-info}/LICENSE +0 -0
  42. {fastworkflow-2.13.5.dist-info → fastworkflow-2.14.1.dist-info}/WHEEL +0 -0
  43. {fastworkflow-2.13.5.dist-info → fastworkflow-2.14.1.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastworkflow
3
- Version: 2.13.5
3
+ Version: 2.14.1
4
4
  Summary: A framework for rapidly building large-scale, deterministic, interactive workflows with a fault-tolerant, conversational UX
5
5
  License: Apache-2.0
6
6
  Keywords: fastworkflow,ai,workflow,llm,openai
@@ -198,6 +198,7 @@ You'll need to add at least:
198
198
  LITELLM_API_KEY_SYNDATA_GEN=your-mistral-api-key
199
199
  LITELLM_API_KEY_PARAM_EXTRACTION=your-mistral-api-key
200
200
  LITELLM_API_KEY_RESPONSE_GEN=your-mistral-api-key
201
+ LITELLM_API_KEY_PLANNER=your-mistral-api-key
201
202
  LITELLM_API_KEY_AGENT=your-mistral-api-key
202
203
  ```
203
204
 
@@ -260,6 +261,12 @@ fastworkflow train <workflow_dir> <env_file> <passwords_file>
260
261
  fastworkflow run <workflow_dir> <env_file> <passwords_file>
261
262
  ```
262
263
 
264
+ To run a workflow in agentic mode, add the `--run_as_agent` flag:
265
+
266
+ ```sh
267
+ fastworkflow run <workflow_dir> <env_file> <passwords_file> --run_as_agent
268
+ ```
269
+
263
270
  Each command has additional options that can be viewed with the `--help` flag:
264
271
 
265
272
  ```sh
@@ -581,7 +588,8 @@ This single command will generate the `greet.py` command, `get_properties` and `
581
588
  | `LLM_SYNDATA_GEN` | LiteLLM model string for synthetic utterance generation | `train` | `mistral/mistral-small-latest` |
582
589
  | `LLM_PARAM_EXTRACTION` | LiteLLM model string for parameter extraction | `train`, `run` | `mistral/mistral-small-latest` |
583
590
  | `LLM_RESPONSE_GEN` | LiteLLM model string for response generation | `run` | `mistral/mistral-small-latest` |
584
- | `LLM_AGENT` | LiteLLM model string for the DSPy agent | `run_agent` | `mistral/mistral-small-latest` |
591
+ | `LLM_PLANNER` | LiteLLM model string for the agent's task planner | `run` (agent mode) | `mistral/mistral-small-latest` |
592
+ | `LLM_AGENT` | LiteLLM model string for the DSPy agent | `run` (agent mode) | `mistral/mistral-small-latest` |
585
593
  | `NOT_FOUND` | Placeholder value for missing parameters during extraction | Always | `"NOT_FOUND"` |
586
594
  | `MISSING_INFORMATION_ERRMSG` | Error message prefix for missing parameters | Always | `"Missing required..."` |
587
595
  | `INVALID_INFORMATION_ERRMSG` | Error message prefix for invalid parameters | Always | `"Invalid information..."` |
@@ -593,7 +601,8 @@ This single command will generate the `greet.py` command, `get_properties` and `
593
601
  | `LITELLM_API_KEY_SYNDATA_GEN`| API key for the `LLM_SYNDATA_GEN` model | `train` | *required* |
594
602
  | `LITELLM_API_KEY_PARAM_EXTRACTION`| API key for the `LLM_PARAM_EXTRACTION` model | `train`, `run` | *required* |
595
603
  | `LITELLM_API_KEY_RESPONSE_GEN`| API key for the `LLM_RESPONSE_GEN` model | `run` | *required* |
596
- | `LITELLM_API_KEY_AGENT`| API key for the `LLM_AGENT` model | `run_agent` | *required* |
604
+ | `LITELLM_API_KEY_PLANNER`| API key for the `LLM_PLANNER` model | `run` (agent mode) | *required* |
605
+ | `LITELLM_API_KEY_AGENT`| API key for the `LLM_AGENT` model | `run` (agent mode) | *required* |
597
606
 
598
607
  > [!tip]
599
608
  > The example workflows are configured to use Mistral's models by default. You can get a free API key from [Mistral AI](https://mistral.ai) that works with the `mistral-small-latest` model.
@@ -3,15 +3,14 @@ fastworkflow/__init__.py,sha256=FbOtFQsjbYXcMjL800X46LcDayzqmB6RDZL782_hj9w,7102
3
3
  fastworkflow/_workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  fastworkflow/_workflows/command_metadata_extraction/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  fastworkflow/_workflows/command_metadata_extraction/_commands/ErrorCorrection/abort.py,sha256=MccJ6Yf7Yrf-9u4Ntv30b5-_IPv68LD6e6YmiBGlr9g,1382
6
- fastworkflow/_workflows/command_metadata_extraction/_commands/ErrorCorrection/you_misunderstood.py,sha256=3zaaSNY2suXB3uSyRBTUsSu4CvS5j0fX1LNoqVbDyk8,2526
7
- fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/go_up.py,sha256=2ykh7YanaEp-NnugaXMD5sj1nZvhfnCg7T0i6-j12gk,1838
8
- fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/reset_context.py,sha256=rkJWpPUaHffO-DVi0csVyu2o4VbwDrZN0w9j1YerEp0,1295
9
- fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/what_can_i_do.py,sha256=XuqsxJF6Wt4nwMjDZUxZxruD-bcTTiFr-kLA1JU79FI,9368
6
+ fastworkflow/_workflows/command_metadata_extraction/_commands/ErrorCorrection/you_misunderstood.py,sha256=Sp_H_ybS5-UM8ActdIrANInIsgQ1uA3pAZnznF8ubvk,2511
7
+ fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/go_up.py,sha256=K526OAf5ks95SwqVdRNVxLM_AWDfA1qXbkNYq0dANwg,1889
8
+ fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/reset_context.py,sha256=xvInu6uDw0YRUHVXNyTZphSr75f8QiQgFwDtv7SlE9o,1346
9
+ fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/what_can_i_do.py,sha256=Fw8tsk3wyCujf8nBfUgPDxnTP9c2IE513FzqAWGm8pU,6216
10
10
  fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/what_is_current_context.py,sha256=S5RQLr62Q2MnKU85nw4IW_ueAK_FXvhcY9gXajFxujg,1464
11
11
  fastworkflow/_workflows/command_metadata_extraction/_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- fastworkflow/_workflows/command_metadata_extraction/_commands/wildcard.py,sha256=fLG35yGOF0pqS-Zl68HLHALJTxtPKvl7SLla6DDzElY,30175
12
+ fastworkflow/_workflows/command_metadata_extraction/_commands/wildcard.py,sha256=RLeoIFmrKugcqSNgDqS62ET9yhHlWZuSgGEpd5rlcV8,30295
13
13
  fastworkflow/_workflows/command_metadata_extraction/command_context_model.json,sha256=zGWBweQSmFf7WsfR_F2DE7AJ8S8-q7F9ZbvyccysJJI,117
14
- fastworkflow/agent_integration.py,sha256=kl_0G-d133kSYNdxYxFfh0bECBp_OxTwFEz27tXmc-A,9344
15
14
  fastworkflow/build/__main__.py,sha256=NtedkZfM56qoEJ5vQECSURbE8AMTfwHN3tAZyZoWabk,15905
16
15
  fastworkflow/build/ast_class_extractor.py,sha256=F9OG4stkp7w3kadKqxMm8h3ZDSp_zg6mwcrKMl_XqdI,13527
17
16
  fastworkflow/build/class_analysis_structures.py,sha256=UWOKcs9pCiNuXc64hNywkTJq5X5KfG1pqdSZwWiZh-c,4053
@@ -26,20 +25,21 @@ fastworkflow/build/context_model_generator.py,sha256=d1QNwUuvkxp3tKNckCEvoLVWC8r
26
25
  fastworkflow/build/dependency_manager.py,sha256=7PnbidRBGkZNOV_K5EdL7qD0EMcKdgF8ptguaCcc0QE,3702
27
26
  fastworkflow/build/dir_scanner.py,sha256=vsYM8zpCMO1MRMD09x65MxX6NRcO_14WLOCrvNxKAV8,1032
28
27
  fastworkflow/build/documentation_generator.py,sha256=6gDJxP6fa11lhaHArR2avQ8ko7HlZoKYww-78k80YFk,15672
29
- fastworkflow/build/genai_postprocessor.py,sha256=PAwvDwWom85TbUbD8DWYnyOJsSPGWjGT2B-STD-jA0o,31961
28
+ fastworkflow/build/genai_postprocessor.py,sha256=KrezKVEHUxFeWtvxQ1nkFoQ3nTIYgGEIazyZWAjCg5k,31145
30
29
  fastworkflow/build/inheritance_block_regenerator.py,sha256=8UzaYSnHVuGh-fmUYax-3XeBTuSnN3jXSyP4aicunDw,6317
31
30
  fastworkflow/build/libcst_transformers.py,sha256=QY0edS3HxqozX5QVcsuCWXgcyn_yzcPkJ7BoKDSH5-k,24763
32
31
  fastworkflow/build/navigator_stub_generator.py,sha256=_DSvHC6r1xWQiFHtUgPhI51nQf7ePB28ePrF330jaDI,11827
33
32
  fastworkflow/build/pydantic_model_generator.py,sha256=oNyoANyUWBpHG-fE3tGL911RNvDzQXjxAm0ssvuXUH4,1854
34
33
  fastworkflow/build/utterance_generator.py,sha256=UrtkF0wyAZ1hiFitHX0g8w7Wh-D0leLCrP1aUACSfHo,299
35
34
  fastworkflow/cache_matching.py,sha256=OoB--1tO6-O4BKCuCrUbB0CkUr76J62K4VAf6MShi-w,7984
36
- fastworkflow/chat_session.py,sha256=7_creqo5TwXczXw9Dp5WiuQy3vbDTmnGvlFyeeq5_GI,22585
35
+ fastworkflow/chat_session.py,sha256=Ixuz_yELuvDHhomfrJwc7rd9AUpvuREzJA-ZHdNZYPQ,23983
37
36
  fastworkflow/cli.py,sha256=I9oJQWRya2dR-emeNPo6imgyhwY-Wz-g7RZgQPmGaEU,25843
38
37
  fastworkflow/command_context_model.py,sha256=nWxLP3TR7WJr3yWCedqcdFOxo_kwae_mS3VRN2cOmK8,13437
39
38
  fastworkflow/command_directory.py,sha256=aJ6UQCwevfF11KbcQB2Qz6mQ7Kj91pZtvHmQY6JFnao,29030
40
39
  fastworkflow/command_executor.py,sha256=WWM_Tz9kg9MAk96UXcou3hyp2EGDSFjvsJrZX0MFOuY,8041
41
40
  fastworkflow/command_interfaces.py,sha256=PWIKlcp0G8nmYl0vkrg1o6QzJL0pxXkfrn1joqTa0eU,460
42
- fastworkflow/command_routing.py,sha256=xMEHTfYmomwlKRLk--vHiN3WSWKrAKNGYRR2w6Av1fQ,17086
41
+ fastworkflow/command_metadata_api.py,sha256=KtidE3PM9HYfY-nmEXZ8Y4nnaw2qn23p_gvwFVT3F8Y,39770
42
+ fastworkflow/command_routing.py,sha256=R7194pcY0d2VHzmCu9ALacm1UvNuIRIvTn8mLp-EZIM,17219
43
43
  fastworkflow/docs/context_modules_prd.txt,sha256=9wvs3LgNoIVXAczo1sXBIV4YmFqVhzC2ja1T3K7FG04,2199
44
44
  fastworkflow/examples/extended_workflow_example/README.md,sha256=2O0O4Bg--fwF98YDScnkNCUL3PcH8KpX2p6I1cwNWeg,2864
45
45
  fastworkflow/examples/extended_workflow_example/_commands/WorkItem/get_status.py,sha256=fC_c6qF-bCRTD14mcY1fzhEvigkV-TmDy3B6jpUG5Tc,4093
@@ -47,10 +47,10 @@ fastworkflow/examples/extended_workflow_example/_commands/generate_report.py,sha
47
47
  fastworkflow/examples/extended_workflow_example/_commands/startup.py,sha256=V5Q29148SvXw6i3i0pKTuNWsv2xnkUMsHHuzt1ndxro,1028
48
48
  fastworkflow/examples/extended_workflow_example/simple_workflow_template.json,sha256=A-dAl5iD9ehdMGGn05O2Kjwq6ZetqQjAGzlM1st0K9U,1237
49
49
  fastworkflow/examples/extended_workflow_example/workflow_inheritance_model.json,sha256=TBk272pqfyRKzm4T-I6_nGfbcdmEzjwon7kFPWtgyhw,81
50
- fastworkflow/examples/fastworkflow.env,sha256=5yQTfQpK99TR5dLwKVOwFatuC1G73Rkng2hv2IjX6cg,645
51
- fastworkflow/examples/fastworkflow.passwords.env,sha256=zucqjXFPsp-SRtDBNn_v7h_N1l8uNBcMEHqQoIcQa6M,355
50
+ fastworkflow/examples/fastworkflow.env,sha256=AtHxE3hf69DDIA8o27cOeV_0iKuMTpJCHf-CY_gzPzQ,629
51
+ fastworkflow/examples/fastworkflow.passwords.env,sha256=CJemqCpj8HeSznTFUfCSc6I5r8noXuRWKfkrHaslD7E,424
52
52
  fastworkflow/examples/hello_world/_commands/README.md,sha256=pYOTGqVx41ZIuNc6hPTEJzNcMQ2Vwx3PN74ifSlayvU,1297
53
- fastworkflow/examples/hello_world/_commands/add_two_numbers.py,sha256=DE8YSvJUDjqfknmZYJx9UPEJO-hSFsEoKZKhmEauGfo,2167
53
+ fastworkflow/examples/hello_world/_commands/add_two_numbers.py,sha256=0lFGK1llT6u6fByvzCDPdegjY6gWcerM2cvxVSo7lIw,2232
54
54
  fastworkflow/examples/hello_world/_commands/context_inheritance_model.json,sha256=RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o,2
55
55
  fastworkflow/examples/hello_world/application/add_two_numbers.py,sha256=gKZiY52R4I7qhuNhZCdAQCEok4ORWwMc0lwRcMTO7jc,64
56
56
  fastworkflow/examples/messaging_app_1/_commands/context_inheritance_model.json,sha256=RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o,2
@@ -81,28 +81,28 @@ fastworkflow/examples/messaging_app_4/application/chatroom.py,sha256=8KTsuqjNfRx
81
81
  fastworkflow/examples/messaging_app_4/application/user.py,sha256=X3piohhyTwjNi5ArQQLYLkItnA7XsjlK5bD1aj_QJbM,788
82
82
  fastworkflow/examples/messaging_app_4/context_hierarchy_model.json,sha256=p1PkLFHO8MVeP1g2922baMxOEVy2If9kktgKKit4qPg,141
83
83
  fastworkflow/examples/messaging_app_4/startup_action.json,sha256=HhS0ApuK1wZmX2M0pVusCkgrV0IU7BwvkfEOpRfN95A,84
84
- fastworkflow/examples/retail_workflow/_commands/cancel_pending_order.py,sha256=OgjIsvln8SiSmwcaf5LJUOcuAv7gu1vkGvciW3kBbWE,3992
85
- fastworkflow/examples/retail_workflow/_commands/exchange_delivered_order_items.py,sha256=vxlbNmK1ud-cTbRvrBWx840ixRXqgxvy_TH8mYvPBtE,3325
86
- fastworkflow/examples/retail_workflow/_commands/find_user_id_by_email.py,sha256=sMWtGZ9tPud_1YrXYWZPbCwrZau7rWTws7tcGouCWXs,2633
87
- fastworkflow/examples/retail_workflow/_commands/find_user_id_by_name_zip.py,sha256=P1ct4wst0XwmuWs-DA_ZR1REsJ2dxxh098G4Rsgvw9I,3223
88
- fastworkflow/examples/retail_workflow/_commands/get_order_details.py,sha256=Oyli07wfp_QyEbfEJe0W4lTEg04mDFsdw2xN0uPAT9c,2908
89
- fastworkflow/examples/retail_workflow/_commands/get_product_details.py,sha256=yrzquOw4Dn-WSnG16xs-Hx-c8tHhHPQNTf2Iwqz0sE0,2518
90
- fastworkflow/examples/retail_workflow/_commands/get_user_details.py,sha256=8S5ena_EAgDpphXRK0drkJa_WI5rY9I4B2vo755VvaY,2447
91
- fastworkflow/examples/retail_workflow/_commands/list_all_product_types.py,sha256=BmClTqdMmvrkmXZ-DNf4v2qAvmvw9nN1MTm_RveYezw,2435
92
- fastworkflow/examples/retail_workflow/_commands/modify_pending_order_address.py,sha256=DoeFg0wfDGn7qAiCbhLF2_qRcgUHt1mvMEo84wXCupQ,3408
93
- fastworkflow/examples/retail_workflow/_commands/modify_pending_order_items.py,sha256=NQekF-uqL0OuTolRZr377oWlGI-plnuIaRc2pfM7mGQ,3364
94
- fastworkflow/examples/retail_workflow/_commands/modify_pending_order_payment.py,sha256=lJJWGYHTfCrx4z-O8hnNWVTjp7i-7DlAZJrEzRc5Ebs,2805
95
- fastworkflow/examples/retail_workflow/_commands/modify_user_address.py,sha256=9xiXI_KEvWsX_S8pSYRKG5YPweC-lj4upjj4JbOM2Ko,3730
96
- fastworkflow/examples/retail_workflow/_commands/parameter_dependency_graph.json,sha256=MOVypaQyc4kPNXhMl1woBTRub-p6BApnRliRUfHl5E8,814
97
- fastworkflow/examples/retail_workflow/_commands/return_delivered_order_items.py,sha256=_8h_6xix55XxhfCxegOMXzK26jIl20wHo38leTLq5BM,3166
98
- fastworkflow/examples/retail_workflow/_commands/transfer_to_human_agents.py,sha256=3k-wWgLooMkUZLRBNntpD-QNQCvPPeu5qSxJBcfc6hE,2884
84
+ fastworkflow/examples/retail_workflow/_commands/calculate.py,sha256=uj-Yg0RSiSPkK7Y0AZN1fgDdL0GWIw33g9ARAPGFFVU,2285
85
+ fastworkflow/examples/retail_workflow/_commands/cancel_pending_order.py,sha256=2t2UMXnzhcuImxDpqLWRX8GWvxcf3NLxGehS5PMFjEk,4106
86
+ fastworkflow/examples/retail_workflow/_commands/exchange_delivered_order_items.py,sha256=5U_R40k8qIfldDKpjZnlSD2bgJc2gAE7DOvFp1UB_Mk,3701
87
+ fastworkflow/examples/retail_workflow/_commands/find_user_id_by_email.py,sha256=nSrBAgnhaMb0CBQIeCS3SzXYFB31t_6ALKL7fKLHYwg,2750
88
+ fastworkflow/examples/retail_workflow/_commands/find_user_id_by_name_zip.py,sha256=lA9UfEkBNjCXozM4fALSZZuS0DgO3W1qQ2cg0dv1XUA,3340
89
+ fastworkflow/examples/retail_workflow/_commands/get_order_details.py,sha256=JSgu5T5L1IMXRy48QGpbHxTL-mMGuaaax8ZhIJCqJw8,3270
90
+ fastworkflow/examples/retail_workflow/_commands/get_product_details.py,sha256=Qfzaz3hHNia9GJvR9Lhdv8qJWdy-GZ6VbzTCYyD4Hh8,2842
91
+ fastworkflow/examples/retail_workflow/_commands/get_user_details.py,sha256=gn_BO7EKQrnTuEO_q9-FfX8MSqJB22gjUCXwPZyuAUE,3059
92
+ fastworkflow/examples/retail_workflow/_commands/list_all_product_types.py,sha256=qnxbHU6PwWiV0E9jO6jYOIs1w5RCrTYQYqYyip14VzI,2529
93
+ fastworkflow/examples/retail_workflow/_commands/modify_pending_order_address.py,sha256=5SJbcNEJdqT3V7SICm8NsO4oDcqTfQ8VMaIyfAdw6tc,3509
94
+ fastworkflow/examples/retail_workflow/_commands/modify_pending_order_items.py,sha256=a-5BB1Ol-0nkRVzQzbKIzGVgUncWOfv3aYxd7KuGt5w,3793
95
+ fastworkflow/examples/retail_workflow/_commands/modify_pending_order_payment.py,sha256=iDKDRRtf9KuYoOyEHNoO6Y08QBhJTMfLP8wCZG2egro,3014
96
+ fastworkflow/examples/retail_workflow/_commands/modify_user_address.py,sha256=2Zxgbge6wDufWEvk5D7PgOkYb3bayXGH_d0Kr0AFRsw,3864
97
+ fastworkflow/examples/retail_workflow/_commands/return_delivered_order_items.py,sha256=UTolxh-ZsVVwIVAwDisZ6h_M05ubKgEsCD7dgCCqicM,3471
98
+ fastworkflow/examples/retail_workflow/_commands/transfer_to_human_agents.py,sha256=H9Zv9Jd1MmEITrsly0Yee5u4JC2NQKQsYKlLvCoy1WI,2903
99
99
  fastworkflow/examples/retail_workflow/command_dependency_graph.json,sha256=JNGfIBD9q_7Be7EAom2FlJF2nvW15LqRC7wn2GGllYI,1786
100
100
  fastworkflow/examples/retail_workflow/context_inheritance_model.json,sha256=jrlby8FUUwkx4V_EGMix_pkQlWcUCVUgmeoapZaZnt4,3
101
101
  fastworkflow/examples/retail_workflow/retail_data/__init__.py,sha256=HW8jqarRRTRtNBMp8jqQBTanFTQQC_uShqY_PiGrVtI,629
102
102
  fastworkflow/examples/retail_workflow/retail_data/orders.json,sha256=JZihJYbSjy1r0WvIb0yAACm2rxjgq7XEde9chpwRztE,1810945
103
103
  fastworkflow/examples/retail_workflow/retail_data/products.json,sha256=qeq8wal0LF9SiMJ3mszlK5MIQjOD7SRwa7rwiJ92Kg8,172258
104
104
  fastworkflow/examples/retail_workflow/retail_data/users.json,sha256=b0_RBMxegLkhZsQDUxXDFTLGzqUqkNzfGEJe5_h8K4I,322932
105
- fastworkflow/examples/retail_workflow/tools/calculate.py,sha256=WaMc99zo6tnbzV5OFXAkmMg6c46tuESoTbfb3md5Fmw,1310
105
+ fastworkflow/examples/retail_workflow/tools/calculate.py,sha256=g8OzrRCL1_sTYafS8tGU0naWiyA0-AVo1wnGVWOVzBU,1310
106
106
  fastworkflow/examples/retail_workflow/tools/cancel_pending_order.py,sha256=qni2P65e9ihTQDnEsncQsmxioTlY7u8loh2i7kMmmvM,3306
107
107
  fastworkflow/examples/retail_workflow/tools/exchange_delivered_order_items.py,sha256=2-R0ofkQH_3BJ-6OCaSGPRHN4l4rkiEOAd3pZpTrSF4,5356
108
108
  fastworkflow/examples/retail_workflow/tools/find_user_id_by_email.py,sha256=XSAht9HvnMOAhY6jHfm2gwGZ_e2SxyVQZWWLlYNaWvM,1118
@@ -138,24 +138,24 @@ fastworkflow/examples/simple_workflow_template/application/__init__.py,sha256=47
138
138
  fastworkflow/examples/simple_workflow_template/application/workitem.py,sha256=Sm-QoX-EZvynkNf7uO3dViZF2VZqUlr6PAZZ7yjQEfk,40197
139
139
  fastworkflow/examples/simple_workflow_template/simple_workflow_template.json,sha256=A-dAl5iD9ehdMGGn05O2Kjwq6ZetqQjAGzlM1st0K9U,1237
140
140
  fastworkflow/examples/simple_workflow_template/startup_action.json,sha256=gj0-B4CqTYCs8OwHKhTu95H4uZbLsDf1th06IFfNXVs,75
141
- fastworkflow/mcp_server.py,sha256=_clX0PxgSSacyFZzcCcuCgNFL9yz-eUb_NHzMEORWXg,8286
141
+ fastworkflow/mcp_server.py,sha256=f6vqHiG-cuMpeoeRY-mvsFxApmQ28cAJFfMtqoJYy5k,8864
142
142
  fastworkflow/model_pipeline_training.py,sha256=P_9wrYSfJVSYCTu8VEPkgXJ16eH58LLCK4rCRbRFAVg,46740
143
143
  fastworkflow/refine/__main__.py,sha256=bDLpPNMcdp8U4EFnMdjxx1sPDQCZuEJoBURr2KebTng,3398
144
144
  fastworkflow/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
- fastworkflow/run/__main__.py,sha256=XRsvV-S5m4wLO-JbgHKbBZCsAh6lqa5dHA_BMMEwUHY,10564
145
+ fastworkflow/run/__main__.py,sha256=f03MJeL9gELvxsn276AUl1Hx35sY2diliepCpV8_k38,10801
146
146
  fastworkflow/run_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
- fastworkflow/run_agent/__main__.py,sha256=XljMeXeEzKEAUTf5tgNjgu4pbUl1JkrvnUB6IQKDkOc,12001
148
- fastworkflow/run_agent/agent_module.py,sha256=nNvSfBBN2_Hl8L_AU86qK0qqzZUdf5NbqpnHpFU7CV0,8473
147
+ fastworkflow/run_agent/__main__.py,sha256=japXWziVDHdLl7Hk-jzwcYkImVY4j4k9SodMhiRK3ow,11986
148
+ fastworkflow/run_agent/agent_module.py,sha256=XbOfX2K2CwmIRT45YtoROCN4en9Ud8gMQh2kGEhqw_A,8012
149
149
  fastworkflow/train/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  fastworkflow/train/__main__.py,sha256=AeGja42d0QhslQkxvDVigIluxxL7DYLdQPXYFOKQ7QA,8536
151
151
  fastworkflow/train/generate_synthetic.py,sha256=sTDk-E5ewkS4o-0LJeofiEv4uXGpqdGcFRYKY_Yf36Y,5322
152
152
  fastworkflow/user_message_queues.py,sha256=svbuFxQ16q6Tz6urPWfD4IEsOTMxtS1Kc1PP8EE8AWg,1422
153
153
  fastworkflow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
- fastworkflow/utils/command_dependency_graph.py,sha256=lroPyXrLMwcXKgvGxw_HCcwhWaMTb2As2Gu3IlvV-EE,14238
154
+ fastworkflow/utils/command_dependency_graph.py,sha256=7YmAnVXcaLsPVeC3SvM4pGdUsCUxWM4H2qXrtGwQpAI,13512
155
155
  fastworkflow/utils/context_utils.py,sha256=mjYVzNJCmimNMmBdOKfzFeDSws_oAADAwcfz_N6sR7M,749
156
156
  fastworkflow/utils/dspy_cache_utils.py,sha256=OP2IsWPMGCdhjC-4iRqggWgTEfvPxFN_78tV1_C6uHY,3725
157
157
  fastworkflow/utils/dspy_logger.py,sha256=NS40fYl-J-vps82BUh9D8kqv5dP3_qAY78HZWyZemEA,6571
158
- fastworkflow/utils/dspy_utils.py,sha256=lxbI4iHBjHr-YiedZDFMAyjIsnsPRsUEVKfNgGLYu88,4726
158
+ fastworkflow/utils/dspy_utils.py,sha256=Gl7hh3chxAKfPTE4uuHkfhHcGXuwM7paWUMSgzcMqh0,5392
159
159
  fastworkflow/utils/env.py,sha256=2E9sev6kWEHP0jx1gs1Kv2HJAjr_mb8nyIPzWpRBU08,787
160
160
  fastworkflow/utils/fuzzy_match.py,sha256=9NRvgrhHezslGQdquFeWXxc2oE1eNYz4NFMEtsSeXMw,2521
161
161
  fastworkflow/utils/generate_param_examples.py,sha256=K0x1Zwe82xqhKA15AYTodWg7mquXsobXtqtZT-B5QAE,25581
@@ -163,12 +163,13 @@ fastworkflow/utils/logging.py,sha256=2SA-04fg7Lx_vGf980tfCOGDQxBvU9X6Vbhv47rbdaw
163
163
  fastworkflow/utils/parameterize_func_decorator.py,sha256=V6YJnishWRCdwiBQW6P17hmGGrga0Empk-AN5Gm7iMk,633
164
164
  fastworkflow/utils/pydantic_model_2_dspy_signature_class.py,sha256=w1pvl8rJq48ulFwaAtBgfXYn_SBIDBgq1aLMUg1zJn8,12875
165
165
  fastworkflow/utils/python_utils.py,sha256=OzSf-bGve1401SHM3QXXFauBOBrlGQzPNgvvGJPavX0,8200
166
- fastworkflow/utils/signatures.py,sha256=xB08E7CzgrpBWj4S371STan1xFRRVQOQ8A_DIv_f15o,20098
166
+ fastworkflow/utils/signatures.py,sha256=mb9dFI6c0VuBJkRZt42CGgpcTs2KUtitrtAOs0ewBgI,20671
167
167
  fastworkflow/utils/startup_progress.py,sha256=9icSdnpFAxzIq0sUliGpNaH0Efvrt5lDtGfURV5BD98,3539
168
168
  fastworkflow/workflow.py,sha256=Dh6qmJvb8NPNLUyK0ElfoaKV5MWhZkNBG-1NHxxdeqM,18282
169
+ fastworkflow/workflow_agent.py,sha256=lSK4OTnfDTg7qCKMySQnmjSVF5WD-V9W4ZrsRBq29Dg,9296
169
170
  fastworkflow/workflow_inheritance_model.py,sha256=Pp-qSrQISgPfPjJVUfW84pc7HLmL2evuq0UVIYR51K0,7974
170
- fastworkflow-2.13.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
171
- fastworkflow-2.13.5.dist-info/METADATA,sha256=HaIU0FPYH_HcffB-Qp43XagrPq6cnWLqe87xiphH52c,29430
172
- fastworkflow-2.13.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
173
- fastworkflow-2.13.5.dist-info/entry_points.txt,sha256=m8HqoPzCyaZLAx-V5X8MJgw3Lx3GiPDlxNEZ7K-Gb-U,54
174
- fastworkflow-2.13.5.dist-info/RECORD,,
171
+ fastworkflow-2.14.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
172
+ fastworkflow-2.14.1.dist-info/METADATA,sha256=thQ6A88cQ36LsACqyvsrVMPnv7m_mDiLcOqsa-1oYWw,29867
173
+ fastworkflow-2.14.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
174
+ fastworkflow-2.14.1.dist-info/entry_points.txt,sha256=m8HqoPzCyaZLAx-V5X8MJgw3Lx3GiPDlxNEZ7K-Gb-U,54
175
+ fastworkflow-2.14.1.dist-info/RECORD,,
@@ -1,239 +0,0 @@
1
- """
2
- Agent integration module for fastWorkflow.
3
- Provides workflow tool agent functionality for intelligent tool selection.
4
- """
5
-
6
-
7
- import contextlib
8
- import os
9
- import json
10
- from typing import Any, List, Dict
11
-
12
- import dspy
13
-
14
- import fastworkflow
15
- from fastworkflow.mcp_server import FastWorkflowMCPServer
16
-
17
-
18
- class WorkflowAssistantSignature(dspy.Signature):
19
- """
20
- Understand the tool request. Based on this tool request, select the most appropriate tool from the available list.
21
- Then, construct a complete and valid specially formatted query string for that chosen tool, including its specific arguments.
22
- Finally, invoke the chosen tool by passing this query string as its argument.
23
- Tool execution may return an error message because of missing or invalid parameter values.
24
- Retry with a corrected query string if:
25
- 1. Missing parameters can be found in the tool request
26
- 2. Error message indicates parameter values are improperly formatted and the formatting errors can be corrected using your internal knowledge.
27
- Otherwise, return the error message back to the user and finish.
28
- Invoke only one tool. DO NOT invoke any other tools except the one explicitly requested.
29
- """
30
- tool_request = dspy.InputField(desc="The natural language tool request.")
31
- tool_result = dspy.OutputField(desc="Result or information request after invoking the tool.")
32
-
33
-
34
-
35
-
36
-
37
- def _create_individual_query_tool(tool_def: Dict, chat_session_obj: fastworkflow.ChatSession):
38
- """Create a DSPy tool function for a specific MCP tool.
39
- This tool expects a single string argument 'query' for the specific tool.
40
- """
41
- tool_name = tool_def['name']
42
- tool_desc = tool_def['description']
43
-
44
- example_query = f'{tool_name}'
45
- param_name_value_list = []
46
- for param_name, param_dict in tool_def['inputSchema']['properties'].items():
47
- param_name_value_list.append((param_name, f"<replace with {param_dict.get('description', 'value')} or '{param_dict.get('default', 'null')}'>"))
48
-
49
- if param_name_value_list:
50
- param_values = ', '.join(f'{name}={value}' for name, value in param_name_value_list)
51
- example_query = f'{example_query} {param_values}'
52
-
53
- tool_docstring = (
54
- f"Executes the '{tool_name}' tool. Tool description: {tool_desc}.\\n"
55
- f"To use this tool, you MUST provide a single string argument named 'query'.\\n"
56
- f"The value for 'query' MUST be a string specifically formatted for the '{tool_name}' tool.\\n"
57
- f"Example of a query string that should be the VALUE of 'query':\\n"
58
- f"{example_query}\\n"
59
- f"Therefore, when invoking this tool, your 'tool_args' field should be a JSON object like this:\\n"
60
- f'{{ "query": "{example_query}" }}'
61
- f'If there is a PARAMETER EXTRACTION ERROR, ignore the instructions above and just follow the instructions returned in the tool response'
62
- )
63
-
64
- def individual_tool(query: str) -> str:
65
- """Receives a query string for the tool and passes it to the core workflow execution."""
66
- return _execute_workflow_query_tool(query=query, chat_session_obj=chat_session_obj)
67
-
68
- individual_tool.__name__ = tool_name
69
- individual_tool.__doc__ = tool_docstring
70
-
71
- return individual_tool
72
-
73
-
74
- def _execute_workflow_query_tool(query: str, *, chat_session_obj: fastworkflow.ChatSession) -> str:
75
- """
76
- Process plain utterance query.
77
- This function is intended to be used as a tool by a DSPy agent.
78
- """
79
- # Directly invoke the command without going through queues
80
- # This allows the agent to synchronously call workflow tools
81
- from fastworkflow.command_executor import CommandExecutor
82
- command_output = CommandExecutor.invoke_command(chat_session_obj, query)
83
-
84
- # Format output - extract text from command response
85
- if hasattr(command_output, 'command_responses') and command_output.command_responses:
86
- response_parts = []
87
- response_parts.extend(
88
- cmd_response.response
89
- for cmd_response in command_output.command_responses
90
- if hasattr(cmd_response, 'response') and cmd_response.response
91
- )
92
- return "\n".join(response_parts) if response_parts else "Command executed successfully."
93
-
94
- return "Command executed but produced no output."
95
-
96
-
97
-
98
- def initialize_workflow_tool_agent(mcp_server: FastWorkflowMCPServer, max_iters: int = 5):
99
- """
100
- Initialize and return a DSPy ReAct agent that exposes individual MCP tools.
101
- Each tool expects a single query string for its specific tool.
102
-
103
- Args:
104
- mcp_server: FastWorkflowMCPServer instance
105
- max_iters: Maximum iterations for the ReAct agent
106
-
107
- Returns:
108
- DSPy ReAct agent configured with workflow tools
109
- """
110
- # Configure DSPy if not already configured
111
- if not dspy.settings.lm:
112
- if LLM_AGENT := fastworkflow.get_env_var("LLM_AGENT"):
113
- LITELLM_API_KEY_AGENT = fastworkflow.get_env_var("LITELLM_API_KEY_AGENT")
114
- lm = dspy.LM(model=LLM_AGENT, api_key=LITELLM_API_KEY_AGENT)
115
- dspy.settings.configure(lm=lm)
116
-
117
- available_tools = mcp_server.list_tools()
118
-
119
- if not available_tools:
120
- return None
121
-
122
- chat_session_obj = mcp_server.chat_session
123
- if not chat_session_obj:
124
- return None
125
-
126
- individual_tools = []
127
- for tool_def in available_tools:
128
- if tool_def['name'] == "transfer_to_human_agents":
129
- continue
130
- tool_func = _create_individual_query_tool(tool_def, chat_session_obj)
131
- individual_tools.append(tool_func)
132
-
133
- return dspy.ReAct(
134
- WorkflowAssistantSignature,
135
- tools=individual_tools,
136
- max_iters=max_iters,
137
- )
138
-
139
-
140
-
141
-
142
-
143
- def get_enhanced_what_can_i_do_output(chat_session: fastworkflow.ChatSession) -> Dict[str, Any]:
144
- """
145
- Get enhanced command information for agent mode.
146
- Returns structured JSON with context info, command details, etc.
147
-
148
- Args:
149
- chat_session: The active ChatSession
150
-
151
- Returns:
152
- Dictionary with enhanced command and context information
153
- """
154
- workflow = fastworkflow.ChatSession.get_active_workflow()
155
- if not workflow:
156
- return {"error": "No active workflow"}
157
-
158
- # Get the current context information
159
- context_info = {
160
- "name": workflow.current_command_context_name,
161
- "display_name": workflow.current_command_context_displayname,
162
- "description": "", # Could be extracted from context class docstring
163
- "inheritance": [], # Could be extracted from context_inheritance_model.json
164
- "containment": [] # Could be extracted from context_containment_model.json
165
- }
166
-
167
- # Get command information
168
- from fastworkflow.command_routing import RoutingRegistry
169
- from fastworkflow.command_directory import CommandDirectory
170
-
171
- subject_crd = RoutingRegistry.get_definition(workflow.folderpath)
172
- cme_crd = RoutingRegistry.get_definition(
173
- fastworkflow.get_internal_workflow_path("command_metadata_extraction")
174
- )
175
-
176
- # Get available commands
177
- cme_command_names = cme_crd.get_command_names('IntentDetection')
178
- subject_command_names = subject_crd.get_command_names(workflow.current_command_context_name)
179
-
180
- candidate_commands = set(cme_command_names) | set(subject_command_names)
181
-
182
- # Filter and build command details
183
- commands = []
184
- for fq_cmd in candidate_commands:
185
- if fq_cmd == "wildcard":
186
- continue
187
-
188
- # Check if command has utterances
189
- utterance_meta = (
190
- subject_crd.command_directory.get_utterance_metadata(fq_cmd) or
191
- cme_crd.command_directory.get_utterance_metadata(fq_cmd)
192
- )
193
-
194
- if not utterance_meta:
195
- continue
196
-
197
- cmd_name = fq_cmd.split("/")[-1]
198
-
199
- # Get command signature information if available
200
- signature_info = {}
201
- with contextlib.suppress(Exception):
202
- # Try to get command class for signature extraction
203
- cmd_module = subject_crd.get_command_module(fq_cmd)
204
- if hasattr(cmd_module, 'Signature') and hasattr(cmd_module.Signature, 'Input'):
205
- input_class = cmd_module.Signature.Input
206
- signature_info = {
207
- "inputs": [
208
- {
209
- "name": field_name,
210
- "type": str(field_info.annotation),
211
- "description": field_info.description or "",
212
- "examples": getattr(field_info, 'examples', [])
213
- }
214
- for field_name, field_info in input_class.model_fields.items()
215
- ]
216
- }
217
- # Get docstring and plain_utterances from utterance metadata if available
218
- docstring = ""
219
- plain_utterances = []
220
- if hasattr(utterance_meta, 'docstring'):
221
- docstring = utterance_meta.docstring or ""
222
- if hasattr(utterance_meta, 'plain_utterances'):
223
- plain_utterances = utterance_meta.plain_utterances or []
224
-
225
- commands.append({
226
- "qualified_name": fq_cmd,
227
- "name": cmd_name,
228
- "signature_docstring": docstring,
229
- "plain_utterances": plain_utterances,
230
- **signature_info
231
- })
232
-
233
- return {
234
- "context": context_info,
235
- "commands": sorted(commands, key=lambda x: x["name"])
236
- }
237
-
238
-
239
-
@@ -1,36 +0,0 @@
1
- {
2
- "nodes": [
3
- "cancel_pending_order",
4
- "exchange_delivered_order_items",
5
- "find_user_id_by_email",
6
- "find_user_id_by_name_zip",
7
- "get_order_details",
8
- "get_product_details",
9
- "get_user_details",
10
- "list_all_product_types",
11
- "modify_pending_order_address",
12
- "modify_pending_order_items",
13
- "modify_pending_order_payment",
14
- "modify_user_address",
15
- "return_delivered_order_items",
16
- "transfer_to_human_agents"
17
- ],
18
- "edges": [
19
- {
20
- "from": "get_user_details",
21
- "to": "find_user_id_by_email"
22
- },
23
- {
24
- "from": "modify_user_address",
25
- "to": "find_user_id_by_email"
26
- },
27
- {
28
- "from": "get_user_details",
29
- "to": "find_user_id_by_name_zip"
30
- },
31
- {
32
- "from": "modify_user_address",
33
- "to": "find_user_id_by_name_zip"
34
- }
35
- ]
36
- }