rasa-pro 3.14.0.dev10__py3-none-any.whl → 3.14.0.dev11__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.
Potentially problematic release.
This version of rasa-pro might be problematic. Click here for more details.
- rasa/__main__.py +15 -3
- rasa/agents/agent_manager.py +50 -2
- rasa/agents/constants.py +3 -0
- rasa/agents/core/types.py +11 -0
- rasa/agents/protocol/a2a/a2a_agent.py +45 -5
- rasa/agents/protocol/mcp/mcp_base_agent.py +14 -5
- rasa/agents/protocol/mcp/mcp_open_agent.py +27 -13
- rasa/agents/protocol/mcp/mcp_task_agent.py +42 -31
- rasa/agents/schemas/agent_tool_result.py +0 -2
- rasa/agents/schemas/agent_tool_schema.py +55 -3
- rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +6 -6
- rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +5 -5
- rasa/agents/utils.py +42 -3
- rasa/builder/copilot/telemetry.py +35 -19
- rasa/builder/main.py +5 -14
- rasa/builder/project_generator.py +1 -1
- rasa/builder/service.py +5 -0
- rasa/builder/template_cache.py +9 -184
- rasa/cli/project_templates/basic/data/data.md +5 -6
- rasa/cli/project_templates/basic/domain/domain.md +5 -2
- rasa/cli/project_templates/finance/README.md +8 -7
- rasa/cli/project_templates/finance/actions/__init__.py +0 -46
- rasa/cli/project_templates/finance/actions/accounts/check_balance.py +18 -0
- rasa/cli/project_templates/finance/actions/{transfers/action_process_immediate_payment.py → cards/check_that_card_exists.py} +6 -3
- rasa/cli/project_templates/finance/actions/cards/list_cards.py +22 -0
- rasa/cli/project_templates/finance/actions/contacts/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/contacts/add_contact.py +30 -0
- rasa/cli/project_templates/finance/actions/contacts/list_contacts.py +22 -0
- rasa/cli/project_templates/finance/actions/contacts/remove_contact.py +35 -0
- rasa/cli/project_templates/finance/actions/db.py +117 -0
- rasa/cli/project_templates/finance/actions/transfers/check_transfer_funds.py +27 -0
- rasa/cli/project_templates/finance/actions/transfers/check_transfer_limit.py +36 -0
- rasa/cli/project_templates/finance/actions/transfers/execute_recurrent_payment.py +20 -0
- rasa/cli/project_templates/finance/actions/transfers/execute_transfer.py +45 -0
- rasa/cli/project_templates/finance/actions/transfers/list_transactions.py +32 -0
- rasa/cli/project_templates/finance/config.yml +6 -0
- rasa/cli/project_templates/finance/credentials.yml +7 -6
- rasa/cli/project_templates/finance/data/accounts/check_balance.yml +3 -4
- rasa/cli/project_templates/finance/data/accounts/download_statements.yml +26 -0
- rasa/cli/project_templates/finance/data/bills/bill_pay_reminder.yml +25 -0
- rasa/cli/project_templates/finance/data/cards/activate_card.yml +35 -0
- rasa/cli/project_templates/finance/data/cards/block_card.yml +37 -58
- rasa/cli/project_templates/finance/data/cards/list_cards.yml +14 -0
- rasa/cli/project_templates/finance/data/cards/replace_card.yml +16 -0
- rasa/cli/project_templates/finance/data/cards/replace_eligible_card.yml +29 -0
- rasa/cli/project_templates/finance/data/contacts/add_contact.yml +33 -0
- rasa/cli/project_templates/finance/data/contacts/list_contacts.yml +14 -0
- rasa/cli/project_templates/finance/data/contacts/remove_contact.yml +31 -0
- rasa/cli/project_templates/finance/data/data.md +6 -3
- rasa/cli/project_templates/finance/data/general/agent_details.yml +6 -0
- rasa/cli/project_templates/finance/data/general/hello.yml +1 -2
- rasa/cli/project_templates/finance/data/general/human_handoff.yml +1 -1
- rasa/cli/project_templates/finance/data/transfers/check_transfer_limit.yml +18 -0
- rasa/cli/project_templates/finance/data/transfers/list_transactions.yml +46 -0
- rasa/cli/project_templates/finance/data/transfers/move_money_between_accounts.yml +51 -0
- rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +29 -62
- rasa/cli/project_templates/finance/data/transfers/transfer_money_to_a_third_party.yml +175 -0
- rasa/cli/project_templates/finance/db/cards.json +18 -0
- rasa/cli/project_templates/finance/db/contacts.json +10 -0
- rasa/cli/project_templates/finance/db/my_account.json +6 -0
- rasa/cli/project_templates/finance/db/transactions.json +22 -0
- rasa/cli/project_templates/finance/docs/docs.md +8 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/budgeting_analytics.txt +22 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/multi_currency_accounts.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/premium_benefits.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/contactless_limits.txt +16 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/freeze_unfreeze_card.txt +16 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/lost_stolen_card.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/instant_payments.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/international_transfers.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/fraud_protection.txt +22 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/secure_payments.txt +22 -0
- rasa/cli/project_templates/finance/domain/_system/patterns/pattern_session_start.yml +11 -0
- rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +9 -5
- rasa/cli/project_templates/finance/domain/accounts/download_statements.yml +40 -0
- rasa/cli/project_templates/finance/domain/bills/bill_pay_reminder.yml +49 -0
- rasa/cli/project_templates/finance/domain/cards/activate_card.yml +24 -0
- rasa/cli/project_templates/finance/domain/cards/block_card.yml +33 -90
- rasa/cli/project_templates/finance/domain/cards/list_cards.yml +16 -0
- rasa/cli/project_templates/finance/domain/cards/replace_card.yml +43 -0
- rasa/cli/project_templates/finance/domain/cards/shared.yml +15 -0
- rasa/cli/project_templates/finance/domain/contacts/add_contact.yml +37 -0
- rasa/cli/project_templates/finance/domain/contacts/list_contacts.yml +16 -0
- rasa/cli/project_templates/finance/domain/contacts/remove_contact.yml +32 -0
- rasa/cli/project_templates/finance/domain/domain.md +9 -1
- rasa/cli/project_templates/finance/domain/general/_shared.yml +53 -0
- rasa/cli/project_templates/finance/domain/general/agent_details.yml +19 -0
- rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -2
- rasa/cli/project_templates/finance/domain/general/feedback.yml +0 -3
- rasa/cli/project_templates/finance/domain/general/human_handoff.yml +7 -3
- rasa/cli/project_templates/finance/domain/general/welcome.yml +5 -2
- rasa/cli/project_templates/finance/domain/transfers/check_transfer_limit.yml +32 -0
- rasa/cli/project_templates/finance/domain/transfers/list_transactions.yml +44 -0
- rasa/cli/project_templates/finance/domain/transfers/shared.yml +17 -0
- rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +203 -61
- rasa/cli/project_templates/finance/endpoints.yml +3 -2
- rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +31 -12
- rasa/cli/project_templates/telco/data/data.md +1 -1
- rasa/cli/project_templates/telco/docs/docs.md +3 -0
- rasa/cli/project_templates/telco/domain/domain.md +1 -2
- rasa/constants.py +1 -1
- rasa/core/actions/direct_custom_actions_executor.py +9 -2
- rasa/core/agent.py +2 -3
- rasa/core/available_agents.py +1 -1
- rasa/core/brokers/broker.py +1 -1
- rasa/core/brokers/kafka.py +52 -8
- rasa/core/channels/__init__.py +82 -35
- rasa/core/channels/inspector/README.md +1 -1
- rasa/core/channels/telegram.py +4 -9
- rasa/core/channels/voice_stream/twilio_media_streams.py +5 -1
- rasa/core/concurrent_lock_store.py +66 -16
- rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +76 -1
- rasa/core/iam_credentials_providers/credentials_provider_protocol.py +1 -1
- rasa/core/lock_store.py +41 -7
- rasa/core/policies/flows/agent_executor.py +632 -0
- rasa/core/policies/flows/flow_executor.py +3 -417
- rasa/core/policies/flows/mcp_tool_executor.py +32 -12
- rasa/core/processor.py +49 -28
- rasa/core/run.py +22 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +1 -1
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +11 -3
- rasa/dialogue_understanding/commands/clarify_command.py +11 -3
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +11 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -0
- rasa/dialogue_understanding/processor/command_processor.py +70 -0
- rasa/dialogue_understanding/stack/dialogue_stack.py +0 -25
- rasa/engine/loader.py +12 -0
- rasa/engine/recipes/default_components.py +111 -82
- rasa/engine/recipes/default_recipe.py +79 -22
- rasa/engine/runner/dask.py +8 -5
- rasa/graph_components/validators/default_recipe_validator.py +59 -19
- rasa/model_manager/warm_rasa_process.py +13 -3
- rasa/model_training.py +0 -14
- rasa/nlu/classifiers/logistic_regression_classifier.py +1 -22
- rasa/nlu/classifiers/mitie_intent_classifier.py +3 -0
- rasa/nlu/classifiers/sklearn_intent_classifier.py +1 -3
- rasa/nlu/extractors/crf_entity_extractor.py +9 -10
- rasa/nlu/extractors/mitie_entity_extractor.py +3 -0
- rasa/nlu/extractors/spacy_entity_extractor.py +3 -0
- rasa/nlu/featurizers/dense_featurizer/mitie_featurizer.py +2 -0
- rasa/nlu/featurizers/dense_featurizer/spacy_featurizer.py +3 -0
- rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +4 -2
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +4 -0
- rasa/nlu/tokenizers/jieba_tokenizer.py +3 -4
- rasa/nlu/tokenizers/mitie_tokenizer.py +3 -2
- rasa/nlu/tokenizers/spacy_tokenizer.py +3 -2
- rasa/nlu/utils/mitie_utils.py +3 -0
- rasa/nlu/utils/spacy_utils.py +3 -2
- rasa/telemetry.py +63 -0
- rasa/utils/log_utils.py +95 -4
- rasa/utils/tensorflow/__init__.py +0 -22
- rasa/utils/tensorflow/callback.py +17 -7
- rasa/utils/tensorflow/layers.py +10 -7
- rasa/utils/tensorflow/rasa_layers.py +1 -1
- rasa/version.py +1 -1
- {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev11.dist-info}/METADATA +99 -89
- {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev11.dist-info}/RECORD +164 -235
- rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +0 -47
- rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +0 -40
- rasa/cli/project_templates/finance/actions/action_session_start.py +0 -74
- rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +0 -48
- rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +0 -36
- rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +0 -54
- rasa/cli/project_templates/finance/actions/database.py +0 -277
- rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +0 -52
- rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +0 -51
- rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +0 -40
- rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +0 -40
- rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +0 -46
- rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +0 -49
- rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +0 -19
- rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +0 -36
- rasa/cli/project_templates/finance/csvs/accounts.csv +0 -8
- rasa/cli/project_templates/finance/csvs/advisors.csv +0 -7
- rasa/cli/project_templates/finance/csvs/appointments.csv +0 -211
- rasa/cli/project_templates/finance/csvs/branches.csv +0 -10
- rasa/cli/project_templates/finance/csvs/cards.csv +0 -11
- rasa/cli/project_templates/finance/csvs/payees.csv +0 -11
- rasa/cli/project_templates/finance/csvs/transactions.csv +0 -71
- rasa/cli/project_templates/finance/csvs/users.csv +0 -4
- rasa/cli/project_templates/finance/data/cards/select_card.yml +0 -12
- rasa/cli/project_templates/finance/data/general/bot_identity.yml +0 -6
- rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +0 -5
- rasa/cli/project_templates/finance/data/system/source/accounts.json +0 -51
- rasa/cli/project_templates/finance/data/system/source/advisors.json +0 -44
- rasa/cli/project_templates/finance/data/system/source/appointments.json +0 -1474
- rasa/cli/project_templates/finance/data/system/source/branches.json +0 -47
- rasa/cli/project_templates/finance/data/system/source/cards.json +0 -72
- rasa/cli/project_templates/finance/data/system/source/payees.json +0 -74
- rasa/cli/project_templates/finance/data/system/source/transactions.json +0 -492
- rasa/cli/project_templates/finance/data/system/source/users.json +0 -29
- rasa/cli/project_templates/finance/data/transfers/add_payee.yml +0 -29
- rasa/cli/project_templates/finance/data/transfers/list_payees.yml +0 -5
- rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +0 -21
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +0 -7
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +0 -8
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +0 -48
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +0 -47
- rasa/cli/project_templates/finance/domain/cards/select_card.yml +0 -12
- rasa/cli/project_templates/finance/domain/general/bot_identity.yml +0 -5
- rasa/cli/project_templates/finance/domain/general/defaults.yml +0 -24
- rasa/cli/project_templates/finance/domain/general/goodbye.yml +0 -7
- rasa/cli/project_templates/finance/domain/general/help.yml +0 -5
- rasa/cli/project_templates/finance/domain/general/utils.yml +0 -13
- rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +0 -47
- rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +0 -4
- rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +0 -16
- {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev11.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev11.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev11.dist-info}/entry_points.txt +0 -0
rasa/__main__.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import argparse
|
|
2
|
+
|
|
3
|
+
# Check TensorFlow availability without importing the module
|
|
4
|
+
import importlib.util
|
|
2
5
|
import os
|
|
3
6
|
import platform
|
|
4
7
|
import sys
|
|
@@ -10,7 +13,6 @@ from rasa_sdk import __version__ as rasa_sdk_version
|
|
|
10
13
|
import rasa.telemetry
|
|
11
14
|
import rasa.utils.io
|
|
12
15
|
import rasa.utils.licensing
|
|
13
|
-
import rasa.utils.tensorflow.environment as tf_env
|
|
14
16
|
from rasa import version
|
|
15
17
|
from rasa.cli import (
|
|
16
18
|
data,
|
|
@@ -40,6 +42,14 @@ from rasa.shared.exceptions import RasaException
|
|
|
40
42
|
from rasa.utils.common import configure_logging_and_warnings
|
|
41
43
|
from rasa.utils.log_utils import configure_structlog
|
|
42
44
|
|
|
45
|
+
TENSORFLOW_AVAILABLE = importlib.util.find_spec("tensorflow") is not None
|
|
46
|
+
|
|
47
|
+
# Only import TensorFlow modules if TensorFlow is available
|
|
48
|
+
if TENSORFLOW_AVAILABLE:
|
|
49
|
+
import rasa.utils.tensorflow.environment as tf_env
|
|
50
|
+
else:
|
|
51
|
+
tf_env = None # type: ignore[assignment]
|
|
52
|
+
|
|
43
53
|
structlogger = structlog.get_logger()
|
|
44
54
|
|
|
45
55
|
|
|
@@ -123,8 +133,10 @@ def main(raw_arguments: Optional[List[str]] = None) -> None:
|
|
|
123
133
|
rasa.utils.io.configure_colored_logging(log_level)
|
|
124
134
|
configure_structlog(log_level)
|
|
125
135
|
|
|
126
|
-
|
|
127
|
-
tf_env
|
|
136
|
+
# Only setup TensorFlow environment if TensorFlow is available
|
|
137
|
+
if TENSORFLOW_AVAILABLE and tf_env is not None:
|
|
138
|
+
tf_env.setup_tf_environment()
|
|
139
|
+
tf_env.check_deterministic_ops()
|
|
128
140
|
|
|
129
141
|
# insert current path in syspath so custom modules are found
|
|
130
142
|
sys.path.insert(1, os.getcwd())
|
rasa/agents/agent_manager.py
CHANGED
|
@@ -80,6 +80,14 @@ class AgentManager(metaclass=Singleton):
|
|
|
80
80
|
"""
|
|
81
81
|
# Add the agent to the manager
|
|
82
82
|
agent_identifier = make_agent_identifier(agent_name, protocol_type)
|
|
83
|
+
if agent_identifier in self.agents:
|
|
84
|
+
structlogger.info(
|
|
85
|
+
"agent_manager.connect_agent.already_connected",
|
|
86
|
+
agent_id=str(agent_identifier),
|
|
87
|
+
agent_name=agent_name,
|
|
88
|
+
event_info=f"Agent {agent_identifier} already connected",
|
|
89
|
+
)
|
|
90
|
+
return
|
|
83
91
|
try:
|
|
84
92
|
# Create the agent client
|
|
85
93
|
client = AgentFactory.create_client(protocol_type, config)
|
|
@@ -118,14 +126,54 @@ class AgentManager(metaclass=Singleton):
|
|
|
118
126
|
"""
|
|
119
127
|
agent = self.get_agent(agent_name, protocol_type)
|
|
120
128
|
|
|
129
|
+
structlogger.debug(
|
|
130
|
+
"agent_manager.run_agent.input",
|
|
131
|
+
event_info="Processing agent input before sending...",
|
|
132
|
+
agent_name=agent_name,
|
|
133
|
+
protocol_type=protocol_type,
|
|
134
|
+
)
|
|
135
|
+
|
|
121
136
|
# Process input before sending
|
|
122
|
-
|
|
137
|
+
try:
|
|
138
|
+
processed_input = await agent.process_input(context)
|
|
139
|
+
except Exception as e:
|
|
140
|
+
structlogger.error(
|
|
141
|
+
"agent_manager.run_agent.process_input_failed",
|
|
142
|
+
agent_name=agent_name,
|
|
143
|
+
protocol_type=protocol_type,
|
|
144
|
+
event_info=(
|
|
145
|
+
f"Failed to process input for agent '{agent_name}'. "
|
|
146
|
+
"Please check your custom implementation."
|
|
147
|
+
),
|
|
148
|
+
error_message=str(e),
|
|
149
|
+
)
|
|
150
|
+
raise
|
|
123
151
|
|
|
124
152
|
# Send message to agent
|
|
125
153
|
output = await agent.run(processed_input)
|
|
126
154
|
|
|
155
|
+
structlogger.debug(
|
|
156
|
+
"agent_manager.run_agent.output",
|
|
157
|
+
event_info="Agent output received. Processing output...",
|
|
158
|
+
agent_name=agent_name,
|
|
159
|
+
protocol_type=protocol_type,
|
|
160
|
+
)
|
|
161
|
+
|
|
127
162
|
# Process output before returning
|
|
128
|
-
|
|
163
|
+
try:
|
|
164
|
+
processed_output = await agent.process_output(output)
|
|
165
|
+
except Exception as e:
|
|
166
|
+
structlogger.error(
|
|
167
|
+
"agent_manager.run_agent.process_output_failed",
|
|
168
|
+
agent_name=agent_name,
|
|
169
|
+
protocol_type=protocol_type,
|
|
170
|
+
event_info=(
|
|
171
|
+
f"Failed to process output for agent '{agent_name}'. "
|
|
172
|
+
"Please check your custom implementation."
|
|
173
|
+
),
|
|
174
|
+
error_message=str(e),
|
|
175
|
+
)
|
|
176
|
+
raise
|
|
129
177
|
|
|
130
178
|
return processed_output
|
|
131
179
|
|
rasa/agents/constants.py
CHANGED
|
@@ -18,6 +18,9 @@ TOOL_PROPERTIES_KEY = "properties"
|
|
|
18
18
|
TOOL_REQUIRED_KEY = "required"
|
|
19
19
|
TOOL_PROPERTY_TYPE_KEY = "type"
|
|
20
20
|
|
|
21
|
+
# MCP Tool Anthropic format related constants
|
|
22
|
+
TOOL_INPUT_SCHEMA_KEY = "input_schema"
|
|
23
|
+
|
|
21
24
|
# MCP Message related constants
|
|
22
25
|
KEY_ROLE = "role"
|
|
23
26
|
KEY_CONTENT = "content"
|
rasa/agents/core/types.py
CHANGED
|
@@ -68,3 +68,14 @@ class AgentStatus(Enum):
|
|
|
68
68
|
INPUT_REQUIRED = "input_required"
|
|
69
69
|
FATAL_ERROR = "fatal_error"
|
|
70
70
|
RECOVERABLE_ERROR = "recoverable_error"
|
|
71
|
+
|
|
72
|
+
def __str__(self) -> str:
|
|
73
|
+
return self.value
|
|
74
|
+
|
|
75
|
+
def __repr__(self) -> str:
|
|
76
|
+
return f"AgentStatus.{self.value}"
|
|
77
|
+
|
|
78
|
+
def __eq__(self, other: object) -> bool:
|
|
79
|
+
if isinstance(other, AgentStatus):
|
|
80
|
+
return self.value == other.value
|
|
81
|
+
return False
|
|
@@ -72,6 +72,10 @@ class A2AAgent(AgentProtocol):
|
|
|
72
72
|
"application/json",
|
|
73
73
|
]
|
|
74
74
|
|
|
75
|
+
# ============================================================================
|
|
76
|
+
# Initialization & Setup
|
|
77
|
+
# ============================================================================
|
|
78
|
+
|
|
75
79
|
def __init__(
|
|
76
80
|
self,
|
|
77
81
|
name: str,
|
|
@@ -128,6 +132,10 @@ class A2AAgent(AgentProtocol):
|
|
|
128
132
|
def protocol_type(self) -> ProtocolType:
|
|
129
133
|
return ProtocolType.A2A
|
|
130
134
|
|
|
135
|
+
# ============================================================================
|
|
136
|
+
# Connection Management
|
|
137
|
+
# ============================================================================
|
|
138
|
+
|
|
131
139
|
async def connect(self) -> None:
|
|
132
140
|
"""Fetch the AgentCard and initialize the A2A client."""
|
|
133
141
|
from rasa.nlu.utils import is_url
|
|
@@ -141,7 +149,8 @@ class A2AAgent(AgentProtocol):
|
|
|
141
149
|
structlogger.debug(
|
|
142
150
|
"a2a_agent.from_config",
|
|
143
151
|
event_info=f"Loaded agent card from {self._agent_card_path}",
|
|
144
|
-
agent_card=self.agent_card,
|
|
152
|
+
agent_card=self.agent_card.model_dump(),
|
|
153
|
+
json_formatting=["agent_card"],
|
|
145
154
|
)
|
|
146
155
|
|
|
147
156
|
try:
|
|
@@ -174,6 +183,10 @@ class A2AAgent(AgentProtocol):
|
|
|
174
183
|
"""We don't need to explicitly disconnect the A2A client"""
|
|
175
184
|
return
|
|
176
185
|
|
|
186
|
+
# ============================================================================
|
|
187
|
+
# Core Protocol Methods
|
|
188
|
+
# ============================================================================
|
|
189
|
+
|
|
177
190
|
async def process_input(self, agent_input: AgentInput) -> AgentInput:
|
|
178
191
|
"""Pre-process the input before sending it to the agent."""
|
|
179
192
|
# A2A-specific input processing logic
|
|
@@ -272,6 +285,10 @@ class A2AAgent(AgentProtocol):
|
|
|
272
285
|
# A2A-specific output processing logic
|
|
273
286
|
return output
|
|
274
287
|
|
|
288
|
+
# ============================================================================
|
|
289
|
+
# Message Processing & Response Handling
|
|
290
|
+
# ============================================================================
|
|
291
|
+
|
|
275
292
|
def _handle_send_message_response(
|
|
276
293
|
self, agent_input: AgentInput, response: ClientEvent | Message
|
|
277
294
|
) -> Optional[AgentOutput]:
|
|
@@ -340,8 +357,9 @@ class A2AAgent(AgentProtocol):
|
|
|
340
357
|
structlogger.debug(
|
|
341
358
|
"a2a_agent.run.client_event_received",
|
|
342
359
|
event_info="Received client event from A2A",
|
|
343
|
-
task=task,
|
|
344
|
-
update_event=update_event,
|
|
360
|
+
task=task.model_dump() if task else None,
|
|
361
|
+
update_event=update_event.model_dump() if update_event else None,
|
|
362
|
+
json_formatting=["task", "update_event"],
|
|
345
363
|
)
|
|
346
364
|
|
|
347
365
|
return self._handle_task(agent_input=agent_input, task=task)
|
|
@@ -353,7 +371,8 @@ class A2AAgent(AgentProtocol):
|
|
|
353
371
|
"a2a_agent.run.message_received",
|
|
354
372
|
event_info="Received message from A2A",
|
|
355
373
|
agent_name=self._name,
|
|
356
|
-
message=message,
|
|
374
|
+
message=message.model_dump(),
|
|
375
|
+
json_formatting=["message"],
|
|
357
376
|
)
|
|
358
377
|
metadata = agent_input.metadata or {}
|
|
359
378
|
metadata[A2A_AGENT_CONTEXT_ID_KEY] = message.context_id
|
|
@@ -471,6 +490,10 @@ class A2AAgent(AgentProtocol):
|
|
|
471
490
|
metadata=metadata,
|
|
472
491
|
)
|
|
473
492
|
|
|
493
|
+
# ============================================================================
|
|
494
|
+
# Message Preparation & Formatting
|
|
495
|
+
# ============================================================================
|
|
496
|
+
|
|
474
497
|
@staticmethod
|
|
475
498
|
def _prepare_message(agent_input: AgentInput) -> Message:
|
|
476
499
|
parts: List[Part] = []
|
|
@@ -503,10 +526,15 @@ class A2AAgent(AgentProtocol):
|
|
|
503
526
|
"a2a_agent.prepare_message",
|
|
504
527
|
event_info="Prepared message to send to A2A server",
|
|
505
528
|
agent_name=agent_input.id,
|
|
506
|
-
message=agent_message,
|
|
529
|
+
message=agent_message.model_dump(),
|
|
530
|
+
json_formatting=["message"],
|
|
507
531
|
)
|
|
508
532
|
return agent_message
|
|
509
533
|
|
|
534
|
+
# ============================================================================
|
|
535
|
+
# Task Management & Polling
|
|
536
|
+
# ============================================================================
|
|
537
|
+
|
|
510
538
|
async def _pool_task_until_terminal(
|
|
511
539
|
self,
|
|
512
540
|
agent_input: AgentInput,
|
|
@@ -589,6 +617,10 @@ class A2AAgent(AgentProtocol):
|
|
|
589
617
|
error_message=f"Polling error: {exception!s}",
|
|
590
618
|
)
|
|
591
619
|
|
|
620
|
+
# ============================================================================
|
|
621
|
+
# Response Generation & Formatting
|
|
622
|
+
# ============================================================================
|
|
623
|
+
|
|
592
624
|
@staticmethod
|
|
593
625
|
def _generate_response_message_from_parts(parts: Optional[List[Part]]) -> str:
|
|
594
626
|
"""Convert a list of Part objects to a single string message."""
|
|
@@ -677,6 +709,10 @@ class A2AAgent(AgentProtocol):
|
|
|
677
709
|
|
|
678
710
|
return previous_structured_results
|
|
679
711
|
|
|
712
|
+
# ============================================================================
|
|
713
|
+
# Agent Card Management
|
|
714
|
+
# ============================================================================
|
|
715
|
+
|
|
680
716
|
@staticmethod
|
|
681
717
|
def _load_agent_card_from_file(agent_card_path: str) -> AgentCard:
|
|
682
718
|
"""Load agent card from JSON file."""
|
|
@@ -760,6 +796,10 @@ class A2AAgent(AgentProtocol):
|
|
|
760
796
|
f"{max_retries} attempts."
|
|
761
797
|
)
|
|
762
798
|
|
|
799
|
+
# ============================================================================
|
|
800
|
+
# Client Initialization & Health Checks
|
|
801
|
+
# ============================================================================
|
|
802
|
+
|
|
763
803
|
def _init_client(self) -> Client:
|
|
764
804
|
_agent_manager = AgentAuthManager.load_auth(self._auth_config)
|
|
765
805
|
auth_strategy = _agent_manager.get_auth() if _agent_manager else None
|
|
@@ -184,17 +184,26 @@ class MCPBaseAgent(AgentProtocol):
|
|
|
184
184
|
"""Add custom tool definitions and their executors for MCP agents.
|
|
185
185
|
|
|
186
186
|
This method can be overridden to provide custom tools that the agent
|
|
187
|
-
can use during its operation.
|
|
188
|
-
|
|
187
|
+
can use during its operation. Each tool definition follows the LiteLLM JSON
|
|
188
|
+
format and must include:
|
|
189
|
+
- "type": should always be "function" for tools.
|
|
190
|
+
- "function" → the tool metadata (name, description, and parameters).
|
|
191
|
+
- "tool_executor" → a coroutine method that actually performs the tool's action.
|
|
189
192
|
|
|
190
|
-
Refer:
|
|
193
|
+
Refer:
|
|
194
|
+
- LiteLLM JSON Format - https://docs.litellm.ai/docs/completion/function_call#full-code---parallel-function-calling-with-gpt-35-turbo-1106
|
|
195
|
+
- OpenAI Tool JSON Format - https://platform.openai.com/docs/guides/tools?tool-type=function-calling
|
|
191
196
|
|
|
192
197
|
Note:
|
|
193
|
-
|
|
198
|
+
- In LiteLLM, the tool metadata is wrapped inside the "function" key.
|
|
199
|
+
- This differs from OpenAI's format, where the metadata (name, description,
|
|
200
|
+
parameters) sits at the top level. Be careful when copying examples from
|
|
201
|
+
OpenAI docs.
|
|
202
|
+
- The tool executor method should be a coroutine function that returns an
|
|
194
203
|
AgentToolResult object.
|
|
195
204
|
|
|
196
205
|
Returns:
|
|
197
|
-
A list of
|
|
206
|
+
A list of tool definitions paired with their executors.
|
|
198
207
|
|
|
199
208
|
Example:
|
|
200
209
|
```python
|
|
@@ -112,7 +112,7 @@ class MCPOpenAgent(MCPBaseAgent):
|
|
|
112
112
|
cls, agent_input: AgentInput
|
|
113
113
|
) -> List[AgentToolSchema]:
|
|
114
114
|
"""Get agentic specific built-in tools."""
|
|
115
|
-
return [AgentToolSchema.
|
|
115
|
+
return [AgentToolSchema.from_litellm_json_format(cls.get_task_completed_tool())]
|
|
116
116
|
|
|
117
117
|
def _run_task_completed_tool(
|
|
118
118
|
self,
|
|
@@ -145,14 +145,22 @@ class MCPOpenAgent(MCPBaseAgent):
|
|
|
145
145
|
tool_results: Dict[str, AgentToolResult] = {}
|
|
146
146
|
# Convert available tools to OpenAI JSON format
|
|
147
147
|
tools_in_openai_format = [
|
|
148
|
-
tool.
|
|
148
|
+
tool.to_litellm_json_format()
|
|
149
149
|
for tool in self.get_available_tools(agent_input)
|
|
150
150
|
]
|
|
151
151
|
|
|
152
152
|
for iteration in range(self.MAX_ITERATIONS):
|
|
153
153
|
try:
|
|
154
|
+
structlogger.debug(
|
|
155
|
+
"mcp_task_agent.send_message.iteration",
|
|
156
|
+
event_info=(
|
|
157
|
+
f"Starting iteration {iteration + 1} for agent {self._name}"
|
|
158
|
+
),
|
|
159
|
+
agent_id=str(make_agent_identifier(self._name, self.protocol_type)),
|
|
160
|
+
highlight=True,
|
|
161
|
+
)
|
|
154
162
|
# Make the LLM call using the llm_client
|
|
155
|
-
structlogger.
|
|
163
|
+
structlogger.debug(
|
|
156
164
|
"mcp_open_agent.send_message.sending_message_to_llm",
|
|
157
165
|
messages=messages,
|
|
158
166
|
event_info=f"Sending message to LLM (iteration {iteration + 1})",
|
|
@@ -182,8 +190,10 @@ class MCPOpenAgent(MCPBaseAgent):
|
|
|
182
190
|
id=agent_input.id,
|
|
183
191
|
status=AgentStatus.RECOVERABLE_ERROR,
|
|
184
192
|
error_message=event_info,
|
|
185
|
-
structured_results=
|
|
186
|
-
|
|
193
|
+
structured_results=(
|
|
194
|
+
self._get_structured_results_for_agent_output(
|
|
195
|
+
agent_input, tool_results
|
|
196
|
+
)
|
|
187
197
|
),
|
|
188
198
|
)
|
|
189
199
|
|
|
@@ -193,8 +203,10 @@ class MCPOpenAgent(MCPBaseAgent):
|
|
|
193
203
|
id=agent_input.id,
|
|
194
204
|
status=AgentStatus.INPUT_REQUIRED,
|
|
195
205
|
response_message=llm_response.choices[0],
|
|
196
|
-
structured_results=
|
|
197
|
-
|
|
206
|
+
structured_results=(
|
|
207
|
+
self._get_structured_results_for_agent_output(
|
|
208
|
+
agent_input, tool_results
|
|
209
|
+
)
|
|
198
210
|
),
|
|
199
211
|
)
|
|
200
212
|
|
|
@@ -205,18 +217,16 @@ class MCPOpenAgent(MCPBaseAgent):
|
|
|
205
217
|
self._get_assistant_message_with_tool_calls(llm_response)
|
|
206
218
|
)
|
|
207
219
|
for tool_call in llm_response.tool_calls:
|
|
208
|
-
structlogger.
|
|
220
|
+
structlogger.debug(
|
|
209
221
|
"mcp_open_agent.send_message.tool_call",
|
|
210
|
-
event_info=
|
|
211
|
-
f"Processing tool call `{tool_call.tool_name}` with "
|
|
212
|
-
f"args: {tool_call.tool_args}"
|
|
213
|
-
),
|
|
222
|
+
event_info=f"Processing tool call {tool_call.tool_name}",
|
|
214
223
|
tool_name=tool_call.tool_name,
|
|
215
224
|
tool_args=json.dumps(tool_call.tool_args),
|
|
216
225
|
agent_name=self._name,
|
|
217
226
|
agent_id=str(
|
|
218
227
|
make_agent_identifier(self._name, self.protocol_type)
|
|
219
228
|
),
|
|
229
|
+
json_formatting=["tool_args"],
|
|
220
230
|
)
|
|
221
231
|
|
|
222
232
|
# Agent signals task completion.
|
|
@@ -234,7 +244,11 @@ class MCPOpenAgent(MCPBaseAgent):
|
|
|
234
244
|
|
|
235
245
|
structlogger.debug(
|
|
236
246
|
"mcp_open_agent.send_message.tool_output",
|
|
237
|
-
|
|
247
|
+
event_info=(
|
|
248
|
+
f"Tool output for tool call {tool_call.tool_name}"
|
|
249
|
+
),
|
|
250
|
+
tool_output=tool_output.model_dump(),
|
|
251
|
+
json_formatting=["tool_output"],
|
|
238
252
|
agent_name=self._name,
|
|
239
253
|
agent_id=str(
|
|
240
254
|
make_agent_identifier(
|
|
@@ -84,7 +84,7 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
84
84
|
]
|
|
85
85
|
|
|
86
86
|
return [
|
|
87
|
-
AgentToolSchema.
|
|
87
|
+
AgentToolSchema.from_litellm_json_format(
|
|
88
88
|
cls.get_slot_specific_set_slot_tool(slot)
|
|
89
89
|
)
|
|
90
90
|
for slot in slot_definitions
|
|
@@ -109,12 +109,6 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
109
109
|
slot_name for slot_name in extracted_slot_names if slot_name in slot_names
|
|
110
110
|
]
|
|
111
111
|
|
|
112
|
-
structlogger.debug(
|
|
113
|
-
"mcp_task_agent.get_agent_specific_built_in_tools.slot_names",
|
|
114
|
-
exit_conditions=exit_conditions,
|
|
115
|
-
slot_names=valid_slot_names,
|
|
116
|
-
)
|
|
117
|
-
|
|
118
112
|
return valid_slot_names
|
|
119
113
|
|
|
120
114
|
@classmethod
|
|
@@ -173,13 +167,6 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
173
167
|
rendered_template = Template(condition).render(current_context)
|
|
174
168
|
predicate = Predicate(rendered_template)
|
|
175
169
|
condition_result = predicate.evaluate(current_context)
|
|
176
|
-
structlogger.debug(
|
|
177
|
-
"mcp_task_agent.is_exit_conditions_met.predicate.result",
|
|
178
|
-
predicate=predicate.description(),
|
|
179
|
-
condition_result=condition_result,
|
|
180
|
-
slots=slots,
|
|
181
|
-
rendered_template=rendered_template,
|
|
182
|
-
)
|
|
183
170
|
|
|
184
171
|
# All conditions must be met (AND logic)
|
|
185
172
|
if not condition_result:
|
|
@@ -196,11 +183,20 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
196
183
|
internal_error = str(e)
|
|
197
184
|
break
|
|
198
185
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
186
|
+
if internal_error:
|
|
187
|
+
structlogger.debug(
|
|
188
|
+
"mcp_task_agent.is_exit_conditions_met.result",
|
|
189
|
+
event_info="Failed to evaluate exit conditions - error occurred",
|
|
190
|
+
exit_conditions=exit_conditions,
|
|
191
|
+
error=internal_error,
|
|
192
|
+
)
|
|
193
|
+
else:
|
|
194
|
+
structlogger.debug(
|
|
195
|
+
"mcp_task_agent.is_exit_conditions_met.result",
|
|
196
|
+
event_info=f"Exit conditions met: {all_conditions_met}",
|
|
197
|
+
evaulation_result=all_conditions_met,
|
|
198
|
+
exit_conditions=exit_conditions,
|
|
199
|
+
)
|
|
204
200
|
|
|
205
201
|
return all_conditions_met, internal_error
|
|
206
202
|
|
|
@@ -275,15 +271,24 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
275
271
|
|
|
276
272
|
# Convert available tools to OpenAI JSON format
|
|
277
273
|
tools_in_openai_format = [
|
|
278
|
-
tool.
|
|
274
|
+
tool.to_litellm_json_format() for tool in _available_tools
|
|
279
275
|
]
|
|
280
276
|
|
|
281
277
|
for iteration in range(self.MAX_ITERATIONS):
|
|
282
278
|
try:
|
|
279
|
+
structlogger.debug(
|
|
280
|
+
"mcp_task_agent.send_message.iteration",
|
|
281
|
+
event_info=(
|
|
282
|
+
f"Starting iteration {iteration + 1} for agent {self._name}"
|
|
283
|
+
),
|
|
284
|
+
agent_id=str(make_agent_identifier(self._name, self.protocol_type)),
|
|
285
|
+
highlight=True,
|
|
286
|
+
)
|
|
283
287
|
# Make the LLM call using the llm_client
|
|
284
|
-
structlogger.
|
|
288
|
+
structlogger.debug(
|
|
285
289
|
"mcp_task_agent.send_message.sending_message_to_llm",
|
|
286
290
|
messages=messages,
|
|
291
|
+
json_formatting=["messages"],
|
|
287
292
|
event_info=f"Sending message to LLM (iteration {iteration + 1})",
|
|
288
293
|
agent_name=self._name,
|
|
289
294
|
agent_id=str(make_agent_identifier(self._name, self.protocol_type)),
|
|
@@ -311,8 +316,10 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
311
316
|
id=agent_input.id,
|
|
312
317
|
status=AgentStatus.RECOVERABLE_ERROR,
|
|
313
318
|
error_message=event_info,
|
|
314
|
-
structured_results=
|
|
315
|
-
|
|
319
|
+
structured_results=(
|
|
320
|
+
self._get_structured_results_for_agent_output(
|
|
321
|
+
agent_input, tool_results
|
|
322
|
+
)
|
|
316
323
|
),
|
|
317
324
|
)
|
|
318
325
|
|
|
@@ -322,8 +329,10 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
322
329
|
id=agent_input.id,
|
|
323
330
|
status=AgentStatus.INPUT_REQUIRED,
|
|
324
331
|
response_message=llm_response.choices[0],
|
|
325
|
-
structured_results=
|
|
326
|
-
|
|
332
|
+
structured_results=(
|
|
333
|
+
self._get_structured_results_for_agent_output(
|
|
334
|
+
agent_input, tool_results
|
|
335
|
+
)
|
|
327
336
|
),
|
|
328
337
|
)
|
|
329
338
|
|
|
@@ -334,14 +343,12 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
334
343
|
self._get_assistant_message_with_tool_calls(llm_response)
|
|
335
344
|
)
|
|
336
345
|
for tool_call in llm_response.tool_calls:
|
|
337
|
-
structlogger.
|
|
346
|
+
structlogger.debug(
|
|
338
347
|
"mcp_task_agent.send_message.tool_call",
|
|
339
|
-
event_info=
|
|
340
|
-
f"Processing tool call `{tool_call.tool_name}` with "
|
|
341
|
-
f"args: {tool_call.tool_args}"
|
|
342
|
-
),
|
|
348
|
+
event_info=f"Processing tool call {tool_call.tool_name}",
|
|
343
349
|
tool_name=tool_call.tool_name,
|
|
344
350
|
tool_args=json.dumps(tool_call.tool_args),
|
|
351
|
+
json_formatting=["tool_args"],
|
|
345
352
|
agent_name=self._name,
|
|
346
353
|
agent_id=str(
|
|
347
354
|
make_agent_identifier(self._name, self.protocol_type)
|
|
@@ -405,7 +412,11 @@ class MCPTaskAgent(MCPBaseAgent):
|
|
|
405
412
|
|
|
406
413
|
structlogger.debug(
|
|
407
414
|
"mcp_task_agent.send_message.tool_output",
|
|
408
|
-
|
|
415
|
+
event_info=(
|
|
416
|
+
f"Tool output for tool call {tool_call.tool_name}"
|
|
417
|
+
),
|
|
418
|
+
tool_output=tool_output.model_dump(),
|
|
419
|
+
json_formatting=["tool_output"],
|
|
409
420
|
tool_name=tool_call.tool_name,
|
|
410
421
|
agent_name=self._name,
|
|
411
422
|
agent_id=str(
|
|
@@ -50,8 +50,6 @@ class AgentToolResult(BaseModel):
|
|
|
50
50
|
)
|
|
51
51
|
# fallback to content if structured content is not available
|
|
52
52
|
elif tool_result.content:
|
|
53
|
-
# TODO try to parse the content using the output schema defined
|
|
54
|
-
# in the tool schema (if present)
|
|
55
53
|
return cls(
|
|
56
54
|
tool_name=tool_name,
|
|
57
55
|
result=str([content.model_dump() for content in tool_result.content]),
|
|
@@ -7,6 +7,7 @@ from rasa.agents.constants import (
|
|
|
7
7
|
TOOL_ADDITIONAL_PROPERTIES_KEY,
|
|
8
8
|
TOOL_DESCRIPTION_KEY,
|
|
9
9
|
TOOL_EXECUTOR_KEY,
|
|
10
|
+
TOOL_INPUT_SCHEMA_KEY,
|
|
10
11
|
TOOL_NAME_KEY,
|
|
11
12
|
TOOL_PARAMETERS_KEY,
|
|
12
13
|
TOOL_PROPERTIES_KEY,
|
|
@@ -42,9 +43,60 @@ class AgentToolSchema(BaseModel):
|
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
@classmethod
|
|
45
|
-
def
|
|
46
|
+
def from_litellm_json_format(cls, tool: Dict[str, Any]) -> "AgentToolSchema":
|
|
46
47
|
"""Convert OpenAI dict format to AgentToolSchema."""
|
|
48
|
+
references = (
|
|
49
|
+
"Refer: \n"
|
|
50
|
+
"- LiteLLM JSON Format - https://docs.litellm.ai/docs/completion/function_call#full-code---parallel-function-calling-with-gpt-35-turbo-1106\n"
|
|
51
|
+
"- OpenAI Tool JSON Format - https://platform.openai.com/docs/guides/tools?tool-type=function-calling\n"
|
|
52
|
+
)
|
|
53
|
+
expected_structure = (
|
|
54
|
+
"{\n"
|
|
55
|
+
" 'type': 'function',\n"
|
|
56
|
+
" 'function': {\n"
|
|
57
|
+
" 'name': 'string',\n"
|
|
58
|
+
" 'description': 'string',\n"
|
|
59
|
+
" 'parameters': {\n"
|
|
60
|
+
" 'type': 'object',\n"
|
|
61
|
+
" 'properties': {'string': 'string'},\n"
|
|
62
|
+
" 'required': ['string']\n"
|
|
63
|
+
" }\n"
|
|
64
|
+
" }\n"
|
|
65
|
+
"}"
|
|
66
|
+
)
|
|
67
|
+
if (
|
|
68
|
+
TOOL_NAME_KEY in tool
|
|
69
|
+
and TOOL_DESCRIPTION_KEY in tool
|
|
70
|
+
and TOOL_INPUT_SCHEMA_KEY in tool
|
|
71
|
+
):
|
|
72
|
+
raise ValueError(
|
|
73
|
+
"Anthropic Tool format is not supported yet. Please use the LiteLLM "
|
|
74
|
+
"Tool format, which is based on OpenAI's format.\n"
|
|
75
|
+
"The expected structure is:\n"
|
|
76
|
+
f"{expected_structure}\n"
|
|
77
|
+
f"{references}"
|
|
78
|
+
)
|
|
79
|
+
if not (TOOL_TYPE_FUNCTION_KEY in tool and TOOL_TYPE_KEY in tool):
|
|
80
|
+
raise ValueError(
|
|
81
|
+
"Invalid tool format. Expected a dictionary with 'type' and "
|
|
82
|
+
"'function' keys. Expected LiteLLM Tool format that is based on OpenAI "
|
|
83
|
+
"format which has the following structure: \n"
|
|
84
|
+
f"{expected_structure}\n"
|
|
85
|
+
f"{references}"
|
|
86
|
+
)
|
|
87
|
+
|
|
47
88
|
function_data = tool[TOOL_TYPE_FUNCTION_KEY]
|
|
89
|
+
|
|
90
|
+
if not (
|
|
91
|
+
TOOL_NAME_KEY in function_data and TOOL_DESCRIPTION_KEY in function_data
|
|
92
|
+
):
|
|
93
|
+
raise ValueError(
|
|
94
|
+
"Invalid tool format. 'function' must contain 'name' and "
|
|
95
|
+
"'description' keys. Expected LiteLLM Tool format that is based on "
|
|
96
|
+
"OpenAI format which has the following structure: \n"
|
|
97
|
+
f"{expected_structure}\n"
|
|
98
|
+
f"{references}"
|
|
99
|
+
)
|
|
48
100
|
parameters = function_data.get(TOOL_PARAMETERS_KEY, {})
|
|
49
101
|
|
|
50
102
|
if parameters:
|
|
@@ -104,7 +156,7 @@ class AgentToolSchema(BaseModel):
|
|
|
104
156
|
if TOOL_REQUIRED_KEY not in prop_schema:
|
|
105
157
|
prop_schema[TOOL_REQUIRED_KEY] = []
|
|
106
158
|
|
|
107
|
-
def
|
|
159
|
+
def to_litellm_json_format(self) -> Dict[str, Any]:
|
|
108
160
|
"""Convert AgentToolSchema to OpenAI format."""
|
|
109
161
|
# Ensure the schema is valid before conversion
|
|
110
162
|
return {
|
|
@@ -123,7 +175,7 @@ class CustomToolSchema(BaseModel):
|
|
|
123
175
|
@classmethod
|
|
124
176
|
def from_dict(cls, config: Dict[str, Any]) -> "CustomToolSchema":
|
|
125
177
|
"""Convert a custom tool config to CustomToolSchema."""
|
|
126
|
-
agent_tool_schema = AgentToolSchema.
|
|
178
|
+
agent_tool_schema = AgentToolSchema.from_litellm_json_format(config)
|
|
127
179
|
if TOOL_EXECUTOR_KEY not in config:
|
|
128
180
|
raise ValueError("Custom tool executor is required.")
|
|
129
181
|
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
You are a helpful assistant that should assist the user in the best possible way.
|
|
2
2
|
|
|
3
|
-
### Context
|
|
4
|
-
- Current date: {{ current_date }} (YYYY-MM-DD)
|
|
5
|
-
- Current time: {{ current_time }} (HH:MM:SS, 24-hour format)
|
|
6
|
-
- Current day: {{ current_day }} (Day of week)
|
|
7
|
-
|
|
8
3
|
### Primary Task
|
|
9
4
|
{{ description }}
|
|
10
5
|
|
|
@@ -16,5 +11,10 @@ You are a helpful assistant that should assist the user in the best possible way
|
|
|
16
11
|
* Do NOT call the `task_completed` tool unless you're absolutely certain that your primary task (NOT the slot corrections, updates, etc), described above, is fully completed. Focus on the task given in the task description above.
|
|
17
12
|
* Strictly avoid making up information or ability to take some action which is not available in `tool` provided.
|
|
18
13
|
|
|
14
|
+
### Context
|
|
15
|
+
- Current date: {{ current_date }} (YYYY-MM-DD)
|
|
16
|
+
- Current time: {{ current_time }} (HH:MM:SS, 24-hour format)
|
|
17
|
+
- Current day: {{ current_day }} (Day of week)
|
|
18
|
+
|
|
19
19
|
### Conversation history
|
|
20
|
-
{{ conversation_history }}
|
|
20
|
+
{{ conversation_history }}
|