rasa-pro 3.14.0.dev9__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_factory.py +2 -2
- 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 +76 -17
- rasa/agents/protocol/mcp/mcp_base_agent.py +29 -5
- rasa/agents/protocol/mcp/mcp_open_agent.py +27 -13
- rasa/agents/protocol/mcp/mcp_task_agent.py +46 -31
- rasa/agents/schemas/__init__.py +2 -1
- 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 -1
- rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +5 -0
- rasa/agents/utils.py +42 -3
- rasa/agents/validation.py +4 -4
- 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 +8 -6
- 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 -418
- rasa/core/policies/flows/mcp_tool_executor.py +35 -14
- 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/shared/agents/auth/agent_auth_manager.py +6 -3
- rasa/shared/agents/auth/auth_strategy/oauth2_auth_strategy.py +13 -5
- rasa/shared/core/constants.py +5 -1
- rasa/shared/utils/mcp/server_connection.py +1 -1
- 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.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/METADATA +99 -89
- {rasa_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/RECORD +171 -242
- 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.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev9.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_factory.py
CHANGED
|
@@ -40,7 +40,7 @@ class AgentFactory:
|
|
|
40
40
|
)
|
|
41
41
|
if not cls._is_valid_custom_agent(agent_class, protocol_type):
|
|
42
42
|
raise ValueError(
|
|
43
|
-
f"Agent class {agent_class} does not subclass the "
|
|
43
|
+
f"Agent class `{agent_class}` does not subclass the "
|
|
44
44
|
f"{cls._get_agent_class_from_protocol(protocol_type).__name__} "
|
|
45
45
|
f"agent class."
|
|
46
46
|
)
|
|
@@ -87,7 +87,7 @@ class AgentFactory:
|
|
|
87
87
|
protocol_class: The class that implements the protocol.
|
|
88
88
|
"""
|
|
89
89
|
if cls.is_protocol_supported(protocol_type):
|
|
90
|
-
raise ValueError(f"Protocol {protocol_type} already registered.")
|
|
90
|
+
raise ValueError(f"Protocol {protocol_type.name} already registered.")
|
|
91
91
|
cls._protocols[protocol_type] = protocol_class
|
|
92
92
|
|
|
93
93
|
@classmethod
|
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
|
|
@@ -50,6 +50,7 @@ from rasa.agents.core.agent_protocol import AgentProtocol
|
|
|
50
50
|
from rasa.agents.core.types import AgentStatus, ProtocolType
|
|
51
51
|
from rasa.agents.schemas import AgentInput, AgentOutput
|
|
52
52
|
from rasa.core.available_agents import AgentConfig
|
|
53
|
+
from rasa.shared.agents.auth.agent_auth_manager import AgentAuthManager
|
|
53
54
|
from rasa.shared.exceptions import (
|
|
54
55
|
AgentInitializationException,
|
|
55
56
|
InvalidParameterException,
|
|
@@ -71,6 +72,10 @@ class A2AAgent(AgentProtocol):
|
|
|
71
72
|
"application/json",
|
|
72
73
|
]
|
|
73
74
|
|
|
75
|
+
# ============================================================================
|
|
76
|
+
# Initialization & Setup
|
|
77
|
+
# ============================================================================
|
|
78
|
+
|
|
74
79
|
def __init__(
|
|
75
80
|
self,
|
|
76
81
|
name: str,
|
|
@@ -78,12 +83,14 @@ class A2AAgent(AgentProtocol):
|
|
|
78
83
|
agent_card_path: str,
|
|
79
84
|
timeout: int,
|
|
80
85
|
max_retries: int,
|
|
86
|
+
auth_config: Optional[Dict[str, Any]] = None,
|
|
81
87
|
) -> None:
|
|
82
88
|
self._name = name
|
|
83
89
|
self._description = description
|
|
84
90
|
self._agent_card_path = agent_card_path
|
|
85
91
|
self._timeout = timeout
|
|
86
92
|
self._max_retries = max_retries
|
|
93
|
+
self._auth_config = auth_config
|
|
87
94
|
|
|
88
95
|
self.agent_card: Optional[AgentCard] = None
|
|
89
96
|
self._client: Optional[Client] = None
|
|
@@ -111,18 +118,24 @@ class A2AAgent(AgentProtocol):
|
|
|
111
118
|
else AGENT_DEFAULT_MAX_RETRIES
|
|
112
119
|
)
|
|
113
120
|
|
|
121
|
+
_auth_config = config.configuration.auth if config.configuration else None
|
|
114
122
|
return cls(
|
|
115
123
|
name=config.agent.name,
|
|
116
124
|
description=config.agent.description,
|
|
117
125
|
agent_card_path=agent_card_path,
|
|
118
126
|
timeout=timeout,
|
|
119
127
|
max_retries=max_retries,
|
|
128
|
+
auth_config=_auth_config,
|
|
120
129
|
)
|
|
121
130
|
|
|
122
131
|
@property
|
|
123
132
|
def protocol_type(self) -> ProtocolType:
|
|
124
133
|
return ProtocolType.A2A
|
|
125
134
|
|
|
135
|
+
# ============================================================================
|
|
136
|
+
# Connection Management
|
|
137
|
+
# ============================================================================
|
|
138
|
+
|
|
126
139
|
async def connect(self) -> None:
|
|
127
140
|
"""Fetch the AgentCard and initialize the A2A client."""
|
|
128
141
|
from rasa.nlu.utils import is_url
|
|
@@ -136,7 +149,8 @@ class A2AAgent(AgentProtocol):
|
|
|
136
149
|
structlogger.debug(
|
|
137
150
|
"a2a_agent.from_config",
|
|
138
151
|
event_info=f"Loaded agent card from {self._agent_card_path}",
|
|
139
|
-
agent_card=self.agent_card,
|
|
152
|
+
agent_card=self.agent_card.model_dump(),
|
|
153
|
+
json_formatting=["agent_card"],
|
|
140
154
|
)
|
|
141
155
|
|
|
142
156
|
try:
|
|
@@ -169,6 +183,10 @@ class A2AAgent(AgentProtocol):
|
|
|
169
183
|
"""We don't need to explicitly disconnect the A2A client"""
|
|
170
184
|
return
|
|
171
185
|
|
|
186
|
+
# ============================================================================
|
|
187
|
+
# Core Protocol Methods
|
|
188
|
+
# ============================================================================
|
|
189
|
+
|
|
172
190
|
async def process_input(self, agent_input: AgentInput) -> AgentInput:
|
|
173
191
|
"""Pre-process the input before sending it to the agent."""
|
|
174
192
|
# A2A-specific input processing logic
|
|
@@ -267,6 +285,10 @@ class A2AAgent(AgentProtocol):
|
|
|
267
285
|
# A2A-specific output processing logic
|
|
268
286
|
return output
|
|
269
287
|
|
|
288
|
+
# ============================================================================
|
|
289
|
+
# Message Processing & Response Handling
|
|
290
|
+
# ============================================================================
|
|
291
|
+
|
|
270
292
|
def _handle_send_message_response(
|
|
271
293
|
self, agent_input: AgentInput, response: ClientEvent | Message
|
|
272
294
|
) -> Optional[AgentOutput]:
|
|
@@ -335,8 +357,9 @@ class A2AAgent(AgentProtocol):
|
|
|
335
357
|
structlogger.debug(
|
|
336
358
|
"a2a_agent.run.client_event_received",
|
|
337
359
|
event_info="Received client event from A2A",
|
|
338
|
-
task=task,
|
|
339
|
-
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"],
|
|
340
363
|
)
|
|
341
364
|
|
|
342
365
|
return self._handle_task(agent_input=agent_input, task=task)
|
|
@@ -348,7 +371,8 @@ class A2AAgent(AgentProtocol):
|
|
|
348
371
|
"a2a_agent.run.message_received",
|
|
349
372
|
event_info="Received message from A2A",
|
|
350
373
|
agent_name=self._name,
|
|
351
|
-
message=message,
|
|
374
|
+
message=message.model_dump(),
|
|
375
|
+
json_formatting=["message"],
|
|
352
376
|
)
|
|
353
377
|
metadata = agent_input.metadata or {}
|
|
354
378
|
metadata[A2A_AGENT_CONTEXT_ID_KEY] = message.context_id
|
|
@@ -442,6 +466,16 @@ class A2AAgent(AgentProtocol):
|
|
|
442
466
|
elif state == TaskState.submitted or state == TaskState.working:
|
|
443
467
|
# The task is still in progress, return None to continue waiting for updates
|
|
444
468
|
return None
|
|
469
|
+
elif state == TaskState.unknown:
|
|
470
|
+
# The task has an unknown state. Perhaps this is a transient condition.
|
|
471
|
+
# Return None to continue waiting for updates
|
|
472
|
+
structlogger.warning(
|
|
473
|
+
"a2a_agent.run_streaming_agent.unknown_task_state",
|
|
474
|
+
event_info="Task is in unknown state, continuing to wait for updates",
|
|
475
|
+
agent_name=self._name,
|
|
476
|
+
state=state,
|
|
477
|
+
)
|
|
478
|
+
return None
|
|
445
479
|
else:
|
|
446
480
|
structlogger.error(
|
|
447
481
|
"a2a_agent.run_streaming_agent.unexpected_task_state",
|
|
@@ -456,6 +490,10 @@ class A2AAgent(AgentProtocol):
|
|
|
456
490
|
metadata=metadata,
|
|
457
491
|
)
|
|
458
492
|
|
|
493
|
+
# ============================================================================
|
|
494
|
+
# Message Preparation & Formatting
|
|
495
|
+
# ============================================================================
|
|
496
|
+
|
|
459
497
|
@staticmethod
|
|
460
498
|
def _prepare_message(agent_input: AgentInput) -> Message:
|
|
461
499
|
parts: List[Part] = []
|
|
@@ -488,10 +526,15 @@ class A2AAgent(AgentProtocol):
|
|
|
488
526
|
"a2a_agent.prepare_message",
|
|
489
527
|
event_info="Prepared message to send to A2A server",
|
|
490
528
|
agent_name=agent_input.id,
|
|
491
|
-
message=agent_message,
|
|
529
|
+
message=agent_message.model_dump(),
|
|
530
|
+
json_formatting=["message"],
|
|
492
531
|
)
|
|
493
532
|
return agent_message
|
|
494
533
|
|
|
534
|
+
# ============================================================================
|
|
535
|
+
# Task Management & Polling
|
|
536
|
+
# ============================================================================
|
|
537
|
+
|
|
495
538
|
async def _pool_task_until_terminal(
|
|
496
539
|
self,
|
|
497
540
|
agent_input: AgentInput,
|
|
@@ -574,6 +617,10 @@ class A2AAgent(AgentProtocol):
|
|
|
574
617
|
error_message=f"Polling error: {exception!s}",
|
|
575
618
|
)
|
|
576
619
|
|
|
620
|
+
# ============================================================================
|
|
621
|
+
# Response Generation & Formatting
|
|
622
|
+
# ============================================================================
|
|
623
|
+
|
|
577
624
|
@staticmethod
|
|
578
625
|
def _generate_response_message_from_parts(parts: Optional[List[Part]]) -> str:
|
|
579
626
|
"""Convert a list of Part objects to a single string message."""
|
|
@@ -606,21 +653,21 @@ class A2AAgent(AgentProtocol):
|
|
|
606
653
|
In case of completed tasks, the final message might be in
|
|
607
654
|
the task status message or in the artifacts (or both).
|
|
608
655
|
"""
|
|
609
|
-
|
|
656
|
+
# We need to preserve the order of the message,
|
|
657
|
+
# but also make sure to remove any duplicates.
|
|
658
|
+
result: List[str] = []
|
|
610
659
|
if task.status.message:
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
task.status.message.parts
|
|
614
|
-
)
|
|
615
|
-
+ "\n"
|
|
660
|
+
message = A2AAgent._generate_response_message_from_parts(
|
|
661
|
+
task.status.message.parts
|
|
616
662
|
)
|
|
663
|
+
if message and message not in result:
|
|
664
|
+
result.append(message)
|
|
617
665
|
if task.artifacts:
|
|
618
666
|
for artifact in task.artifacts:
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
return result.strip()
|
|
667
|
+
message = A2AAgent._generate_response_message_from_parts(artifact.parts)
|
|
668
|
+
if message and message not in result:
|
|
669
|
+
result.append(message)
|
|
670
|
+
return "\n".join(result)
|
|
624
671
|
|
|
625
672
|
@staticmethod
|
|
626
673
|
def _generate_structured_results_from_artifacts(
|
|
@@ -662,6 +709,10 @@ class A2AAgent(AgentProtocol):
|
|
|
662
709
|
|
|
663
710
|
return previous_structured_results
|
|
664
711
|
|
|
712
|
+
# ============================================================================
|
|
713
|
+
# Agent Card Management
|
|
714
|
+
# ============================================================================
|
|
715
|
+
|
|
665
716
|
@staticmethod
|
|
666
717
|
def _load_agent_card_from_file(agent_card_path: str) -> AgentCard:
|
|
667
718
|
"""Load agent card from JSON file."""
|
|
@@ -745,10 +796,18 @@ class A2AAgent(AgentProtocol):
|
|
|
745
796
|
f"{max_retries} attempts."
|
|
746
797
|
)
|
|
747
798
|
|
|
799
|
+
# ============================================================================
|
|
800
|
+
# Client Initialization & Health Checks
|
|
801
|
+
# ============================================================================
|
|
802
|
+
|
|
748
803
|
def _init_client(self) -> Client:
|
|
804
|
+
_agent_manager = AgentAuthManager.load_auth(self._auth_config)
|
|
805
|
+
auth_strategy = _agent_manager.get_auth() if _agent_manager else None
|
|
749
806
|
factory = ClientFactory(
|
|
750
807
|
config=ClientConfig(
|
|
751
|
-
httpx_client=httpx.AsyncClient(
|
|
808
|
+
httpx_client=httpx.AsyncClient(
|
|
809
|
+
timeout=self._timeout, auth=auth_strategy
|
|
810
|
+
),
|
|
752
811
|
streaming=True,
|
|
753
812
|
supported_transports=[
|
|
754
813
|
TransportProtocol.jsonrpc,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from abc import abstractmethod
|
|
3
|
+
from datetime import datetime
|
|
3
4
|
from inspect import isawaitable
|
|
4
5
|
from typing import Any, Dict, List, Optional, Tuple
|
|
5
6
|
|
|
@@ -183,17 +184,26 @@ class MCPBaseAgent(AgentProtocol):
|
|
|
183
184
|
"""Add custom tool definitions and their executors for MCP agents.
|
|
184
185
|
|
|
185
186
|
This method can be overridden to provide custom tools that the agent
|
|
186
|
-
can use during its operation.
|
|
187
|
-
|
|
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.
|
|
188
192
|
|
|
189
|
-
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
|
|
190
196
|
|
|
191
197
|
Note:
|
|
192
|
-
|
|
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
|
|
193
203
|
AgentToolResult object.
|
|
194
204
|
|
|
195
205
|
Returns:
|
|
196
|
-
A list of
|
|
206
|
+
A list of tool definitions paired with their executors.
|
|
197
207
|
|
|
198
208
|
Example:
|
|
199
209
|
```python
|
|
@@ -493,11 +503,25 @@ class MCPBaseAgent(AgentProtocol):
|
|
|
493
503
|
# LLM & Prompt Management
|
|
494
504
|
# ============================================================================
|
|
495
505
|
|
|
506
|
+
def _get_current_date_time_day(self) -> Tuple[str, str, str]:
|
|
507
|
+
"""Get the current date, time, and day in standard formats."""
|
|
508
|
+
now = datetime.now()
|
|
509
|
+
current_date = now.strftime("%Y-%m-%d") # e.g. 2025-09-14
|
|
510
|
+
current_time = now.strftime("%H:%M:%S") # e.g. 16:45:12
|
|
511
|
+
current_day = now.strftime("%A") # e.g. Sunday
|
|
512
|
+
return current_date, current_time, current_day
|
|
513
|
+
|
|
496
514
|
def render_prompt_template(self, context: AgentInput) -> str:
|
|
497
515
|
"""Render the prompt template with the provided inputs."""
|
|
516
|
+
# Current date, time, and weekday in standard formats
|
|
517
|
+
current_date, current_time, current_day = self._get_current_date_time_day()
|
|
518
|
+
|
|
498
519
|
return Template(self.prompt_template).render(
|
|
499
520
|
**context.model_dump(exclude={"id", "timestamp", "events"}),
|
|
500
521
|
description=self._description,
|
|
522
|
+
current_date=current_date,
|
|
523
|
+
current_time=current_time,
|
|
524
|
+
current_day=current_day,
|
|
501
525
|
)
|
|
502
526
|
|
|
503
527
|
def build_messages_for_llm_request(
|
|
@@ -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(
|