vellum-ai 0.14.41__py3-none-any.whl → 1.11.2__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 vellum-ai might be problematic. Click here for more details.
- vellum/__init__.py +281 -8
- vellum/client/README.md +70 -17
- vellum/client/__init__.py +598 -1371
- vellum/client/core/__init__.py +5 -0
- vellum/client/core/api_error.py +13 -5
- vellum/client/core/client_wrapper.py +31 -5
- vellum/client/core/file.py +13 -8
- vellum/client/core/force_multipart.py +16 -0
- vellum/client/core/http_client.py +76 -20
- vellum/client/core/http_response.py +55 -0
- vellum/client/core/jsonable_encoder.py +0 -1
- vellum/client/core/pydantic_utilities.py +95 -119
- vellum/client/core/request_options.py +3 -0
- vellum/client/core/serialization.py +7 -3
- vellum/client/errors/__init__.py +14 -1
- vellum/client/errors/bad_request_error.py +4 -3
- vellum/client/errors/forbidden_error.py +4 -3
- vellum/client/errors/internal_server_error.py +4 -3
- vellum/client/errors/misdirected_request_error.py +11 -0
- vellum/client/errors/not_found_error.py +4 -3
- vellum/client/errors/too_many_requests_error.py +11 -0
- vellum/client/errors/unauthorized_error.py +11 -0
- vellum/client/raw_client.py +2725 -0
- vellum/client/reference.md +2489 -1038
- vellum/client/resources/__init__.py +16 -2
- vellum/client/resources/ad_hoc/__init__.py +2 -0
- vellum/client/resources/ad_hoc/client.py +173 -365
- vellum/client/resources/ad_hoc/raw_client.py +569 -0
- vellum/client/resources/container_images/__init__.py +2 -0
- vellum/client/resources/container_images/client.py +72 -185
- vellum/client/resources/container_images/raw_client.py +407 -0
- vellum/client/resources/deployments/__init__.py +2 -0
- vellum/client/resources/deployments/client.py +211 -424
- vellum/client/resources/deployments/raw_client.py +1002 -0
- vellum/client/resources/deployments/types/__init__.py +2 -0
- vellum/client/resources/document_indexes/__init__.py +2 -0
- vellum/client/resources/document_indexes/client.py +131 -365
- vellum/client/resources/document_indexes/raw_client.py +866 -0
- vellum/client/resources/document_indexes/types/__init__.py +2 -0
- vellum/client/resources/documents/__init__.py +2 -0
- vellum/client/resources/documents/client.py +93 -325
- vellum/client/resources/documents/raw_client.py +662 -0
- vellum/client/resources/{release_reviews → environments}/__init__.py +2 -0
- vellum/client/resources/environments/client.py +106 -0
- vellum/client/resources/environments/raw_client.py +95 -0
- vellum/client/resources/events/__init__.py +4 -0
- vellum/client/resources/events/client.py +201 -0
- vellum/client/resources/events/raw_client.py +211 -0
- vellum/client/resources/folder_entities/__init__.py +2 -0
- vellum/client/resources/folder_entities/client.py +56 -89
- vellum/client/resources/folder_entities/raw_client.py +276 -0
- vellum/client/resources/folder_entities/types/__init__.py +2 -0
- vellum/client/resources/integration_auth_configs/__init__.py +4 -0
- vellum/client/resources/integration_auth_configs/client.py +186 -0
- vellum/client/resources/integration_auth_configs/raw_client.py +171 -0
- vellum/client/resources/integration_providers/__init__.py +4 -0
- vellum/client/resources/integration_providers/client.py +299 -0
- vellum/client/resources/integration_providers/raw_client.py +275 -0
- vellum/client/resources/integrations/__init__.py +4 -0
- vellum/client/resources/integrations/client.py +466 -0
- vellum/client/resources/integrations/raw_client.py +557 -0
- vellum/client/resources/metric_definitions/__init__.py +2 -0
- vellum/client/resources/metric_definitions/client.py +60 -100
- vellum/client/resources/metric_definitions/raw_client.py +224 -0
- vellum/client/resources/ml_models/__init__.py +2 -0
- vellum/client/resources/ml_models/client.py +37 -46
- vellum/client/resources/ml_models/raw_client.py +102 -0
- vellum/client/resources/organizations/__init__.py +2 -0
- vellum/client/resources/organizations/client.py +37 -45
- vellum/client/resources/organizations/raw_client.py +95 -0
- vellum/client/resources/prompts/__init__.py +2 -0
- vellum/client/resources/prompts/client.py +210 -95
- vellum/client/resources/prompts/raw_client.py +353 -0
- vellum/client/resources/sandboxes/__init__.py +2 -0
- vellum/client/resources/sandboxes/client.py +69 -147
- vellum/client/resources/sandboxes/raw_client.py +392 -0
- vellum/client/resources/test_suite_runs/__init__.py +2 -0
- vellum/client/resources/test_suite_runs/client.py +65 -151
- vellum/client/resources/test_suite_runs/raw_client.py +354 -0
- vellum/client/resources/test_suites/__init__.py +2 -0
- vellum/client/resources/test_suites/client.py +162 -266
- vellum/client/resources/test_suites/raw_client.py +530 -0
- vellum/client/resources/uploaded_files/__init__.py +4 -0
- vellum/client/resources/uploaded_files/client.py +230 -0
- vellum/client/resources/uploaded_files/raw_client.py +316 -0
- vellum/client/resources/workflow_deployments/__init__.py +2 -0
- vellum/client/resources/workflow_deployments/client.py +312 -355
- vellum/client/resources/workflow_deployments/raw_client.py +1059 -0
- vellum/client/resources/workflow_deployments/types/__init__.py +2 -0
- vellum/client/resources/workflow_executions/__init__.py +4 -0
- vellum/client/resources/workflow_executions/client.py +140 -0
- vellum/client/resources/workflow_executions/raw_client.py +173 -0
- vellum/client/resources/workflow_sandboxes/__init__.py +2 -0
- vellum/client/resources/workflow_sandboxes/client.py +58 -117
- vellum/client/resources/workflow_sandboxes/raw_client.py +291 -0
- vellum/client/resources/workflow_sandboxes/types/__init__.py +2 -0
- vellum/client/resources/workflows/__init__.py +2 -0
- vellum/client/resources/workflows/client.py +258 -141
- vellum/client/resources/workflows/raw_client.py +547 -0
- vellum/client/resources/workspace_secrets/__init__.py +2 -0
- vellum/client/resources/workspace_secrets/client.py +43 -94
- vellum/client/resources/workspace_secrets/raw_client.py +219 -0
- vellum/client/resources/workspaces/__init__.py +2 -0
- vellum/client/resources/workspaces/client.py +37 -45
- vellum/client/resources/workspaces/raw_client.py +95 -0
- vellum/client/tests/__init__.py +0 -0
- vellum/client/tests/test_utils.py +34 -0
- vellum/client/types/__init__.py +254 -4
- vellum/client/types/ad_hoc_execute_prompt_event.py +3 -2
- vellum/client/types/ad_hoc_expand_meta.py +2 -2
- vellum/client/types/ad_hoc_fulfilled_prompt_execution_meta.py +3 -3
- vellum/client/types/ad_hoc_initiated_prompt_execution_meta.py +2 -2
- vellum/client/types/ad_hoc_rejected_prompt_execution_meta.py +3 -3
- vellum/client/types/ad_hoc_streaming_prompt_execution_meta.py +2 -2
- vellum/client/types/api_actor_type_enum.py +7 -0
- vellum/client/types/api_node_result.py +3 -3
- vellum/client/types/api_node_result_data.py +4 -4
- vellum/client/types/api_request_parent_context.py +18 -17
- vellum/client/types/api_version_enum.py +1 -1
- vellum/client/types/array_chat_message_content.py +3 -3
- vellum/client/types/array_chat_message_content_item.py +7 -4
- vellum/client/types/array_chat_message_content_item_request.py +7 -4
- vellum/client/types/array_chat_message_content_request.py +3 -3
- vellum/client/types/array_input.py +9 -8
- vellum/client/types/array_vellum_value.py +4 -4
- vellum/client/types/array_vellum_value_request.py +4 -4
- vellum/client/types/audio_chat_message_content.py +3 -3
- vellum/client/types/audio_chat_message_content_request.py +3 -3
- vellum/client/types/audio_input.py +30 -0
- vellum/client/types/audio_input_request.py +30 -0
- vellum/client/types/audio_prompt_block.py +4 -4
- vellum/client/types/audio_vellum_value.py +3 -3
- vellum/client/types/audio_vellum_value_request.py +3 -3
- vellum/client/types/auth_type_enum.py +5 -0
- vellum/client/types/base_output.py +4 -4
- vellum/client/types/basic_vectorizer_intfloat_multilingual_e_5_large.py +2 -2
- vellum/client/types/basic_vectorizer_intfloat_multilingual_e_5_large_request.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1_request.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1_request.py +2 -2
- vellum/client/types/build_status_enum.py +5 -0
- vellum/client/types/chat_history_input.py +3 -3
- vellum/client/types/chat_history_input_request.py +3 -3
- vellum/client/types/chat_history_vellum_value.py +3 -3
- vellum/client/types/chat_history_vellum_value_request.py +3 -3
- vellum/client/types/chat_message.py +4 -4
- vellum/client/types/chat_message_content.py +7 -4
- vellum/client/types/chat_message_content_request.py +7 -4
- vellum/client/types/chat_message_prompt_block.py +7 -7
- vellum/client/types/chat_message_request.py +4 -4
- vellum/client/types/code_execution_node_array_result.py +8 -7
- vellum/client/types/code_execution_node_chat_history_result.py +3 -3
- vellum/client/types/code_execution_node_error_result.py +3 -3
- vellum/client/types/code_execution_node_function_call_result.py +3 -3
- vellum/client/types/code_execution_node_json_result.py +2 -2
- vellum/client/types/code_execution_node_number_result.py +2 -2
- vellum/client/types/code_execution_node_result.py +7 -6
- vellum/client/types/code_execution_node_result_data.py +7 -6
- vellum/client/types/code_execution_node_result_output.py +6 -5
- vellum/client/types/code_execution_node_search_results_result.py +3 -3
- vellum/client/types/code_execution_node_string_result.py +2 -2
- vellum/client/types/code_execution_package.py +3 -2
- vellum/client/types/code_executor_input.py +15 -6
- vellum/client/types/code_executor_response.py +8 -7
- vellum/client/types/code_executor_secret_input.py +3 -3
- vellum/client/types/code_resource_definition.py +3 -3
- vellum/client/types/compile_prompt_deployment_expand_meta_request.py +2 -2
- vellum/client/types/compile_prompt_meta.py +2 -2
- vellum/client/types/components_schemas_composio_execute_tool_request.py +5 -0
- vellum/client/types/components_schemas_composio_execute_tool_response.py +5 -0
- vellum/client/types/components_schemas_composio_integration_exec_config.py +5 -0
- vellum/client/types/components_schemas_composio_tool_definition.py +5 -0
- vellum/client/types/components_schemas_prompt_version_build_config_sandbox.py +5 -0
- vellum/client/types/components_schemas_slim_composio_tool_definition.py +5 -0
- vellum/client/types/composio_execute_tool_request.py +24 -0
- vellum/client/types/composio_execute_tool_response.py +24 -0
- vellum/client/types/composio_integration_exec_config.py +21 -0
- vellum/client/types/composio_tool_definition.py +30 -0
- vellum/client/types/conditional_node_result.py +3 -3
- vellum/client/types/conditional_node_result_data.py +2 -2
- vellum/client/types/container_image_build_config.py +21 -0
- vellum/client/types/container_image_container_image_tag.py +2 -2
- vellum/client/types/container_image_read.py +8 -4
- vellum/client/types/create_test_suite_test_case_request.py +6 -5
- vellum/client/types/create_workflow_event_request.py +7 -0
- vellum/client/types/dataset_row_push_request.py +20 -0
- vellum/client/types/delimiter_chunker_config.py +20 -0
- vellum/client/types/delimiter_chunker_config_request.py +20 -0
- vellum/client/types/delimiter_chunking.py +21 -0
- vellum/client/types/delimiter_chunking_request.py +21 -0
- vellum/client/types/deployment_history_item.py +7 -6
- vellum/client/types/deployment_provider_payload_response.py +4 -4
- vellum/client/types/deployment_read.py +14 -13
- vellum/client/types/deployment_release_tag_deployment_history_item.py +2 -2
- vellum/client/types/deployment_release_tag_read.py +4 -4
- vellum/client/types/deprecated_prompt_request_input.py +8 -0
- vellum/client/types/docker_service_token.py +2 -2
- vellum/client/types/document_chat_message_content.py +3 -3
- vellum/client/types/document_chat_message_content_request.py +3 -3
- vellum/client/types/document_document_to_document_index.py +9 -4
- vellum/client/types/document_index_chunking.py +5 -1
- vellum/client/types/document_index_chunking_request.py +3 -1
- vellum/client/types/document_index_indexing_config.py +4 -4
- vellum/client/types/document_index_indexing_config_request.py +4 -4
- vellum/client/types/document_index_read.py +4 -4
- vellum/client/types/document_input.py +30 -0
- vellum/client/types/document_input_request.py +30 -0
- vellum/client/types/document_prompt_block.py +4 -4
- vellum/client/types/document_read.py +9 -5
- vellum/client/types/document_vellum_value.py +3 -3
- vellum/client/types/document_vellum_value_request.py +3 -3
- vellum/client/types/enriched_normalized_completion.py +3 -3
- vellum/client/types/environment_display_config.py +19 -0
- vellum/client/types/environment_read.py +23 -0
- vellum/client/types/ephemeral_prompt_cache_config.py +3 -3
- vellum/client/types/error_detail_response.py +22 -0
- vellum/client/types/error_input.py +3 -3
- vellum/client/types/error_vellum_value.py +3 -3
- vellum/client/types/error_vellum_value_request.py +3 -3
- vellum/client/types/event_create_response.py +31 -0
- vellum/client/types/execute_api_request_bearer_token.py +1 -0
- vellum/client/types/execute_api_request_body.py +3 -1
- vellum/client/types/execute_api_request_headers_value.py +1 -0
- vellum/client/types/execute_api_response.py +6 -7
- vellum/client/types/execute_api_response_json.py +7 -0
- vellum/client/types/execute_prompt_event.py +3 -2
- vellum/client/types/execute_prompt_response.py +1 -0
- vellum/client/types/execute_workflow_async_response.py +26 -0
- vellum/client/types/execute_workflow_response.py +7 -6
- vellum/client/types/execute_workflow_workflow_result_event.py +1 -0
- vellum/client/types/execution_array_vellum_value.py +9 -8
- vellum/client/types/execution_audio_vellum_value.py +31 -0
- vellum/client/types/execution_chat_history_vellum_value.py +3 -3
- vellum/client/types/execution_document_vellum_value.py +31 -0
- vellum/client/types/execution_error_vellum_value.py +3 -3
- vellum/client/types/execution_function_call_vellum_value.py +3 -3
- vellum/client/types/execution_image_vellum_value.py +31 -0
- vellum/client/types/execution_json_vellum_value.py +3 -3
- vellum/client/types/execution_number_vellum_value.py +3 -3
- vellum/client/types/execution_search_results_vellum_value.py +3 -3
- vellum/client/types/execution_string_vellum_value.py +3 -3
- vellum/client/types/execution_thinking_vellum_value.py +31 -0
- vellum/client/types/execution_vellum_value.py +16 -5
- vellum/client/types/execution_video_vellum_value.py +31 -0
- vellum/client/types/external_input_descriptor.py +3 -3
- vellum/client/types/external_parent_context.py +38 -0
- vellum/client/types/external_test_case_execution.py +7 -6
- vellum/client/types/external_test_case_execution_request.py +7 -6
- vellum/client/types/fast_embed_vectorizer_baai_bge_small_en_v_15.py +23 -0
- vellum/client/types/fast_embed_vectorizer_baai_bge_small_en_v_15_request.py +23 -0
- vellum/client/types/folder_entity.py +5 -2
- vellum/client/types/folder_entity_dataset.py +26 -0
- vellum/client/types/folder_entity_dataset_data.py +25 -0
- vellum/client/types/folder_entity_document_index.py +3 -3
- vellum/client/types/folder_entity_document_index_data.py +5 -3
- vellum/client/types/folder_entity_folder.py +3 -3
- vellum/client/types/folder_entity_folder_data.py +2 -2
- vellum/client/types/folder_entity_prompt_sandbox.py +3 -3
- vellum/client/types/folder_entity_prompt_sandbox_data.py +4 -3
- vellum/client/types/folder_entity_test_suite.py +3 -3
- vellum/client/types/folder_entity_test_suite_data.py +3 -3
- vellum/client/types/folder_entity_workflow_sandbox.py +3 -3
- vellum/client/types/folder_entity_workflow_sandbox_data.py +6 -3
- vellum/client/types/fulfilled_ad_hoc_execute_prompt_event.py +4 -4
- vellum/client/types/fulfilled_execute_prompt_event.py +4 -4
- vellum/client/types/fulfilled_execute_prompt_response.py +3 -3
- vellum/client/types/fulfilled_execute_workflow_workflow_result_event.py +8 -9
- vellum/client/types/fulfilled_prompt_execution_meta.py +3 -3
- vellum/client/types/fulfilled_workflow_node_result_event.py +9 -8
- vellum/client/types/function_call.py +2 -2
- vellum/client/types/function_call_chat_message_content.py +3 -3
- vellum/client/types/function_call_chat_message_content_request.py +3 -3
- vellum/client/types/function_call_chat_message_content_value.py +2 -2
- vellum/client/types/function_call_chat_message_content_value_request.py +2 -2
- vellum/client/types/function_call_input.py +3 -3
- vellum/client/types/function_call_prompt_block.py +4 -4
- vellum/client/types/function_call_request.py +2 -2
- vellum/client/types/function_call_vellum_value.py +3 -3
- vellum/client/types/function_call_vellum_value_request.py +3 -3
- vellum/client/types/function_definition.py +9 -4
- vellum/client/types/generate_options_request.py +3 -3
- vellum/client/types/generate_request.py +2 -2
- vellum/client/types/generate_response.py +3 -3
- vellum/client/types/generate_result.py +3 -3
- vellum/client/types/generate_result_data.py +3 -3
- vellum/client/types/generate_result_error.py +3 -3
- vellum/client/types/generate_stream_response.py +3 -3
- vellum/client/types/generate_stream_result.py +4 -4
- vellum/client/types/generate_stream_result_data.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_config.py +2 -2
- vellum/client/types/google_vertex_ai_vectorizer_config_request.py +2 -2
- vellum/client/types/google_vertex_ai_vectorizer_gemini_embedding_001.py +21 -0
- vellum/client/types/google_vertex_ai_vectorizer_gemini_embedding_001_request.py +21 -0
- vellum/client/types/google_vertex_ai_vectorizer_text_embedding_004.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_embedding_004_request.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002_request.py +3 -3
- vellum/client/types/hkunlp_instructor_xl_vectorizer.py +3 -3
- vellum/client/types/hkunlp_instructor_xl_vectorizer_request.py +3 -3
- vellum/client/types/image_chat_message_content.py +3 -3
- vellum/client/types/image_chat_message_content_request.py +3 -3
- vellum/client/types/image_input.py +30 -0
- vellum/client/types/image_input_request.py +30 -0
- vellum/client/types/image_prompt_block.py +4 -4
- vellum/client/types/image_vellum_value.py +3 -3
- vellum/client/types/image_vellum_value_request.py +3 -3
- vellum/client/types/indexing_config_vectorizer.py +11 -4
- vellum/client/types/indexing_config_vectorizer_request.py +11 -4
- vellum/client/types/initiated_ad_hoc_execute_prompt_event.py +3 -3
- vellum/client/types/initiated_execute_prompt_event.py +3 -3
- vellum/client/types/initiated_prompt_execution_meta.py +2 -2
- vellum/client/types/initiated_workflow_node_result_event.py +9 -8
- vellum/client/types/instructor_vectorizer_config.py +2 -2
- vellum/client/types/instructor_vectorizer_config_request.py +2 -2
- vellum/client/types/integration.py +27 -0
- vellum/client/types/integration_auth_config_integration.py +23 -0
- vellum/client/types/integration_auth_config_integration_credential.py +19 -0
- vellum/client/types/integration_credential_access_type.py +5 -0
- vellum/client/types/integration_name.py +85 -0
- vellum/client/types/integration_provider.py +5 -0
- vellum/client/types/integration_read.py +30 -0
- vellum/client/types/integration_trigger_context.py +39 -0
- vellum/client/types/invoked_port.py +2 -2
- vellum/client/types/jinja_prompt_block.py +4 -4
- vellum/client/types/json_input.py +3 -3
- vellum/client/types/json_input_request.py +3 -3
- vellum/client/types/json_vellum_value.py +2 -2
- vellum/client/types/json_vellum_value_request.py +2 -2
- vellum/client/types/logical_operator.py +4 -0
- vellum/client/types/map_node_result.py +3 -3
- vellum/client/types/map_node_result_data.py +3 -3
- vellum/client/types/merge_node_result.py +3 -3
- vellum/client/types/merge_node_result_data.py +2 -2
- vellum/client/types/metadata_filter_config_request.py +9 -8
- vellum/client/types/metadata_filter_rule_request.py +5 -5
- vellum/client/types/metadata_filters_request.py +1 -0
- vellum/client/types/metric_definition_execution.py +7 -6
- vellum/client/types/metric_definition_history_item.py +7 -6
- vellum/client/types/metric_definition_input.py +3 -2
- vellum/client/types/metric_node_result.py +2 -2
- vellum/client/types/ml_model_read.py +6 -3
- vellum/client/types/ml_model_usage.py +2 -2
- vellum/client/types/ml_model_usage_wrapper.py +4 -4
- vellum/client/types/named_scenario_input_audio_variable_value_request.py +22 -0
- vellum/client/types/named_scenario_input_chat_history_variable_value_request.py +3 -3
- vellum/client/types/named_scenario_input_document_variable_value_request.py +22 -0
- vellum/client/types/named_scenario_input_image_variable_value_request.py +22 -0
- vellum/client/types/named_scenario_input_json_variable_value_request.py +2 -2
- vellum/client/types/named_scenario_input_request.py +11 -2
- vellum/client/types/named_scenario_input_string_variable_value_request.py +2 -2
- vellum/client/types/named_scenario_input_video_variable_value_request.py +22 -0
- vellum/client/types/named_test_case_array_variable_value.py +8 -7
- vellum/client/types/named_test_case_array_variable_value_request.py +8 -9
- vellum/client/types/named_test_case_audio_variable_value.py +26 -0
- vellum/client/types/named_test_case_audio_variable_value_request.py +26 -0
- vellum/client/types/named_test_case_chat_history_variable_value.py +3 -3
- vellum/client/types/named_test_case_chat_history_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_document_variable_value.py +22 -0
- vellum/client/types/named_test_case_document_variable_value_request.py +22 -0
- vellum/client/types/named_test_case_error_variable_value.py +3 -3
- vellum/client/types/named_test_case_error_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_function_call_variable_value.py +3 -3
- vellum/client/types/named_test_case_function_call_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_image_variable_value.py +22 -0
- vellum/client/types/named_test_case_image_variable_value_request.py +22 -0
- vellum/client/types/named_test_case_json_variable_value.py +2 -2
- vellum/client/types/named_test_case_json_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_number_variable_value.py +2 -2
- vellum/client/types/named_test_case_number_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_search_results_variable_value.py +3 -3
- vellum/client/types/named_test_case_search_results_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_string_variable_value.py +2 -2
- vellum/client/types/named_test_case_string_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_variable_value.py +14 -5
- vellum/client/types/named_test_case_variable_value_request.py +14 -5
- vellum/client/types/named_test_case_video_variable_value.py +22 -0
- vellum/client/types/named_test_case_video_variable_value_request.py +22 -0
- vellum/client/types/node_execution_fulfilled_body.py +4 -4
- vellum/client/types/node_execution_fulfilled_event.py +21 -23
- vellum/client/types/node_execution_initiated_body.py +3 -3
- vellum/client/types/node_execution_initiated_event.py +21 -23
- vellum/client/types/node_execution_paused_body.py +3 -3
- vellum/client/types/node_execution_paused_event.py +21 -23
- vellum/client/types/node_execution_rejected_body.py +5 -4
- vellum/client/types/node_execution_rejected_event.py +21 -23
- vellum/client/types/node_execution_resumed_body.py +3 -3
- vellum/client/types/node_execution_resumed_event.py +21 -23
- vellum/client/types/node_execution_span.py +20 -20
- vellum/client/types/node_execution_span_attributes.py +4 -2
- vellum/client/types/node_execution_streaming_body.py +4 -4
- vellum/client/types/node_execution_streaming_event.py +21 -23
- vellum/client/types/node_input_compiled_array_value.py +8 -7
- vellum/client/types/node_input_compiled_audio_value.py +23 -0
- vellum/client/types/node_input_compiled_chat_history_value.py +3 -3
- vellum/client/types/node_input_compiled_document_value.py +23 -0
- vellum/client/types/node_input_compiled_error_value.py +3 -3
- vellum/client/types/node_input_compiled_function_call_value.py +3 -3
- vellum/client/types/node_input_compiled_image_value.py +23 -0
- vellum/client/types/node_input_compiled_json_value.py +2 -2
- vellum/client/types/node_input_compiled_number_value.py +2 -2
- vellum/client/types/node_input_compiled_search_results_value.py +3 -3
- vellum/client/types/node_input_compiled_secret_value.py +3 -3
- vellum/client/types/node_input_compiled_string_value.py +2 -2
- vellum/client/types/node_input_compiled_video_value.py +23 -0
- vellum/client/types/node_input_variable_compiled_value.py +14 -5
- vellum/client/types/node_output_compiled_array_value.py +9 -8
- vellum/client/types/node_output_compiled_chat_history_value.py +3 -3
- vellum/client/types/node_output_compiled_error_value.py +3 -3
- vellum/client/types/node_output_compiled_function_call_value.py +3 -3
- vellum/client/types/node_output_compiled_json_value.py +3 -3
- vellum/client/types/node_output_compiled_number_value.py +3 -3
- vellum/client/types/node_output_compiled_search_results_value.py +3 -3
- vellum/client/types/node_output_compiled_string_value.py +3 -3
- vellum/client/types/node_output_compiled_thinking_value.py +28 -0
- vellum/client/types/node_output_compiled_value.py +8 -5
- vellum/client/types/node_parent_context.py +15 -18
- vellum/client/types/normalized_log_probs.py +3 -3
- vellum/client/types/normalized_token_log_probs.py +2 -2
- vellum/client/types/number_input.py +3 -3
- vellum/client/types/number_vellum_value.py +2 -2
- vellum/client/types/number_vellum_value_request.py +2 -2
- vellum/client/types/open_ai_vectorizer_config.py +3 -3
- vellum/client/types/open_ai_vectorizer_config_request.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_large.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_large_request.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_small.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_small_request.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_ada_002.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_ada_002_request.py +3 -3
- vellum/client/types/organization_read.py +6 -3
- vellum/client/types/paginated_container_image_read_list.py +3 -3
- vellum/client/types/paginated_deployment_release_tag_read_list.py +3 -3
- vellum/client/types/paginated_document_index_read_list.py +3 -3
- vellum/client/types/paginated_folder_entity_list.py +3 -3
- vellum/client/types/paginated_slim_deployment_read_list.py +7 -6
- vellum/client/types/paginated_slim_document_list.py +3 -3
- vellum/client/types/paginated_slim_integration_auth_config_read_list.py +23 -0
- vellum/client/types/paginated_slim_integration_read_list.py +23 -0
- vellum/client/types/paginated_slim_tool_definition_list.py +23 -0
- vellum/client/types/paginated_slim_workflow_deployment_list.py +7 -6
- vellum/client/types/paginated_test_suite_run_execution_list.py +7 -6
- vellum/client/types/paginated_test_suite_test_case_list.py +7 -6
- vellum/client/types/paginated_workflow_deployment_release_list.py +30 -0
- vellum/client/types/paginated_workflow_release_tag_read_list.py +3 -3
- vellum/client/types/paginated_workflow_sandbox_example_list.py +3 -3
- vellum/client/types/parent_context.py +21 -11
- vellum/client/types/pdf_search_result_meta_source.py +2 -2
- vellum/client/types/pdf_search_result_meta_source_request.py +2 -2
- vellum/client/types/plain_text_prompt_block.py +4 -4
- vellum/client/types/price.py +3 -3
- vellum/client/types/private_vectorizer.py +23 -0
- vellum/client/types/private_vectorizer_request.py +23 -0
- vellum/client/types/processing_failure_reason_enum.py +3 -1
- vellum/client/types/prompt_block.py +9 -6
- vellum/client/types/prompt_deployment_expand_meta_request.py +2 -2
- vellum/client/types/prompt_deployment_input_request.py +16 -3
- vellum/client/types/prompt_deployment_parent_context.py +14 -17
- vellum/client/types/prompt_deployment_release.py +6 -6
- vellum/client/types/prompt_deployment_release_prompt_deployment.py +2 -2
- vellum/client/types/prompt_deployment_release_prompt_version.py +7 -2
- vellum/client/types/prompt_exec_config.py +12 -12
- vellum/client/types/prompt_execution_meta.py +3 -3
- vellum/client/types/prompt_node_execution_meta.py +3 -3
- vellum/client/types/prompt_node_result.py +3 -3
- vellum/client/types/prompt_node_result_data.py +3 -3
- vellum/client/types/prompt_output.py +7 -3
- vellum/client/types/prompt_parameters.py +2 -2
- vellum/client/types/prompt_push_response.py +20 -0
- vellum/client/types/prompt_request_audio_input.py +26 -0
- vellum/client/types/prompt_request_chat_history_input.py +3 -3
- vellum/client/types/prompt_request_document_input.py +26 -0
- vellum/client/types/prompt_request_image_input.py +26 -0
- vellum/client/types/prompt_request_input.py +16 -3
- vellum/client/types/prompt_request_json_input.py +3 -3
- vellum/client/types/prompt_request_string_input.py +3 -3
- vellum/client/types/prompt_request_video_input.py +26 -0
- vellum/client/types/prompt_settings.py +3 -2
- vellum/client/types/prompt_version_build_config_sandbox.py +22 -0
- vellum/client/types/raw_prompt_execution_overrides_request.py +2 -2
- vellum/client/types/reducto_chunker_config.py +2 -2
- vellum/client/types/reducto_chunker_config_request.py +2 -2
- vellum/client/types/reducto_chunking.py +3 -3
- vellum/client/types/reducto_chunking_request.py +3 -3
- vellum/client/types/rejected_ad_hoc_execute_prompt_event.py +4 -4
- vellum/client/types/rejected_execute_prompt_event.py +4 -4
- vellum/client/types/rejected_execute_prompt_response.py +3 -3
- vellum/client/types/rejected_execute_workflow_workflow_result_event.py +4 -4
- vellum/client/types/rejected_prompt_execution_meta.py +3 -3
- vellum/client/types/rejected_workflow_node_result_event.py +9 -8
- vellum/client/types/release_created_by.py +2 -2
- vellum/client/types/release_environment.py +2 -2
- vellum/client/types/release_release_tag.py +3 -3
- vellum/client/types/release_review_reviewer.py +2 -2
- vellum/client/types/release_tag_release.py +2 -2
- vellum/client/types/replace_test_suite_test_case_request.py +6 -5
- vellum/client/types/rich_text_child_block.py +2 -1
- vellum/client/types/rich_text_prompt_block.py +4 -4
- vellum/client/types/sandbox_scenario.py +3 -3
- vellum/client/types/scenario_input.py +14 -3
- vellum/client/types/scenario_input_audio_variable_value.py +22 -0
- vellum/client/types/scenario_input_chat_history_variable_value.py +3 -3
- vellum/client/types/scenario_input_document_variable_value.py +22 -0
- vellum/client/types/scenario_input_image_variable_value.py +22 -0
- vellum/client/types/scenario_input_json_variable_value.py +2 -2
- vellum/client/types/scenario_input_string_variable_value.py +2 -2
- vellum/client/types/scenario_input_video_variable_value.py +22 -0
- vellum/client/types/scheduled_trigger_context.py +39 -0
- vellum/client/types/search_filters_request.py +8 -9
- vellum/client/types/search_node_result.py +3 -3
- vellum/client/types/search_node_result_data.py +3 -3
- vellum/client/types/search_request_options_request.py +10 -11
- vellum/client/types/search_response.py +3 -3
- vellum/client/types/search_result.py +3 -3
- vellum/client/types/search_result_document.py +2 -2
- vellum/client/types/search_result_document_request.py +2 -2
- vellum/client/types/search_result_merging_request.py +2 -2
- vellum/client/types/search_result_meta.py +3 -3
- vellum/client/types/search_result_meta_request.py +3 -3
- vellum/client/types/search_result_request.py +3 -3
- vellum/client/types/search_results_input.py +3 -3
- vellum/client/types/search_results_vellum_value.py +3 -3
- vellum/client/types/search_results_vellum_value_request.py +3 -3
- vellum/client/types/search_weights_request.py +2 -2
- vellum/client/types/secret_type_enum.py +3 -1
- vellum/client/types/sentence_chunker_config.py +2 -2
- vellum/client/types/sentence_chunker_config_request.py +2 -2
- vellum/client/types/sentence_chunking.py +3 -3
- vellum/client/types/sentence_chunking_request.py +3 -3
- vellum/client/types/slim_composio_tool_definition.py +24 -0
- vellum/client/types/slim_deployment_read.py +12 -11
- vellum/client/types/slim_document.py +6 -5
- vellum/client/types/slim_document_document_to_document_index.py +9 -4
- vellum/client/types/slim_integration_auth_config_read.py +36 -0
- vellum/client/types/slim_integration_read.py +25 -0
- vellum/client/types/slim_release_review.py +4 -4
- vellum/client/types/slim_workflow_deployment.py +13 -12
- vellum/client/types/slim_workflow_execution_read.py +21 -24
- vellum/client/types/span_link.py +16 -19
- vellum/client/types/span_link_type_enum.py +1 -1
- vellum/client/types/streaming_ad_hoc_execute_prompt_event.py +4 -4
- vellum/client/types/streaming_execute_prompt_event.py +3 -3
- vellum/client/types/streaming_prompt_execution_meta.py +2 -2
- vellum/client/types/streaming_workflow_node_result_event.py +9 -8
- vellum/client/types/string_chat_message_content.py +2 -2
- vellum/client/types/string_chat_message_content_request.py +2 -2
- vellum/client/types/string_input.py +3 -3
- vellum/client/types/string_input_request.py +3 -3
- vellum/client/types/string_vellum_value.py +2 -2
- vellum/client/types/string_vellum_value_request.py +2 -2
- vellum/client/types/submit_completion_actual_request.py +3 -3
- vellum/client/types/submit_workflow_execution_actual_request.py +3 -2
- vellum/client/types/subworkflow_node_result.py +3 -3
- vellum/client/types/subworkflow_node_result_data.py +2 -2
- vellum/client/types/templating_node_array_result.py +8 -7
- vellum/client/types/templating_node_chat_history_result.py +3 -3
- vellum/client/types/templating_node_error_result.py +3 -3
- vellum/client/types/templating_node_function_call_result.py +3 -3
- vellum/client/types/templating_node_json_result.py +2 -2
- vellum/client/types/templating_node_number_result.py +2 -2
- vellum/client/types/templating_node_result.py +7 -6
- vellum/client/types/templating_node_result_data.py +7 -6
- vellum/client/types/templating_node_result_output.py +6 -5
- vellum/client/types/templating_node_search_results_result.py +3 -3
- vellum/client/types/templating_node_string_result.py +2 -2
- vellum/client/types/terminal_node_array_result.py +8 -7
- vellum/client/types/terminal_node_chat_history_result.py +2 -2
- vellum/client/types/terminal_node_error_result.py +2 -2
- vellum/client/types/terminal_node_function_call_result.py +2 -2
- vellum/client/types/terminal_node_json_result.py +2 -2
- vellum/client/types/terminal_node_number_result.py +2 -2
- vellum/client/types/terminal_node_result.py +7 -6
- vellum/client/types/terminal_node_result_data.py +7 -6
- vellum/client/types/terminal_node_result_output.py +6 -5
- vellum/client/types/terminal_node_search_results_result.py +2 -2
- vellum/client/types/terminal_node_string_result.py +2 -2
- vellum/client/types/test_case_array_variable_value.py +8 -7
- vellum/client/types/test_case_audio_variable_value.py +27 -0
- vellum/client/types/test_case_chat_history_variable_value.py +3 -3
- vellum/client/types/test_case_document_variable_value.py +27 -0
- vellum/client/types/test_case_error_variable_value.py +3 -3
- vellum/client/types/test_case_function_call_variable_value.py +3 -3
- vellum/client/types/test_case_image_variable_value.py +27 -0
- vellum/client/types/test_case_json_variable_value.py +2 -2
- vellum/client/types/test_case_number_variable_value.py +2 -2
- vellum/client/types/test_case_search_results_variable_value.py +3 -3
- vellum/client/types/test_case_string_variable_value.py +2 -2
- vellum/client/types/test_case_variable_value.py +14 -5
- vellum/client/types/test_case_video_variable_value.py +27 -0
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config.py +3 -3
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_exec_config.py +2 -1
- vellum/client/types/test_suite_run_exec_config_request.py +2 -1
- vellum/client/types/test_suite_run_execution.py +8 -7
- vellum/client/types/test_suite_run_execution_array_output.py +8 -7
- vellum/client/types/test_suite_run_execution_chat_history_output.py +3 -3
- vellum/client/types/test_suite_run_execution_error_output.py +3 -3
- vellum/client/types/test_suite_run_execution_function_call_output.py +3 -3
- vellum/client/types/test_suite_run_execution_json_output.py +2 -2
- vellum/client/types/test_suite_run_execution_metric_definition.py +2 -2
- vellum/client/types/test_suite_run_execution_metric_result.py +8 -7
- vellum/client/types/test_suite_run_execution_number_output.py +2 -2
- vellum/client/types/test_suite_run_execution_output.py +6 -5
- vellum/client/types/test_suite_run_execution_search_results_output.py +3 -3
- vellum/client/types/test_suite_run_execution_string_output.py +2 -2
- vellum/client/types/test_suite_run_external_exec_config.py +7 -6
- vellum/client/types/test_suite_run_external_exec_config_data.py +7 -6
- vellum/client/types/test_suite_run_external_exec_config_data_request.py +7 -8
- vellum/client/types/test_suite_run_external_exec_config_request.py +7 -8
- vellum/client/types/test_suite_run_metric_array_output.py +8 -7
- vellum/client/types/test_suite_run_metric_error_output.py +3 -3
- vellum/client/types/test_suite_run_metric_json_output.py +2 -2
- vellum/client/types/test_suite_run_metric_number_output.py +2 -2
- vellum/client/types/test_suite_run_metric_output.py +5 -4
- vellum/client/types/test_suite_run_metric_string_output.py +2 -2
- vellum/client/types/test_suite_run_progress.py +2 -2
- vellum/client/types/test_suite_run_prompt_sandbox_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_read.py +9 -8
- vellum/client/types/test_suite_run_test_suite.py +2 -2
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config.py +3 -3
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -3
- vellum/client/types/test_suite_test_case.py +7 -6
- vellum/client/types/test_suite_test_case_bulk_operation_request.py +2 -1
- vellum/client/types/test_suite_test_case_bulk_result.py +2 -1
- vellum/client/types/test_suite_test_case_create_bulk_operation_request.py +7 -8
- vellum/client/types/test_suite_test_case_created_bulk_result.py +3 -3
- vellum/client/types/test_suite_test_case_created_bulk_result_data.py +2 -2
- vellum/client/types/test_suite_test_case_delete_bulk_operation_data_request.py +2 -2
- vellum/client/types/test_suite_test_case_delete_bulk_operation_request.py +3 -3
- vellum/client/types/test_suite_test_case_deleted_bulk_result.py +3 -3
- vellum/client/types/test_suite_test_case_deleted_bulk_result_data.py +2 -2
- vellum/client/types/test_suite_test_case_rejected_bulk_result.py +2 -2
- vellum/client/types/test_suite_test_case_replace_bulk_operation_request.py +7 -8
- vellum/client/types/test_suite_test_case_replaced_bulk_result.py +3 -3
- vellum/client/types/test_suite_test_case_replaced_bulk_result_data.py +2 -2
- vellum/client/types/test_suite_test_case_upsert_bulk_operation_request.py +7 -8
- vellum/client/types/thinking_vellum_value.py +25 -0
- vellum/client/types/thinking_vellum_value_request.py +25 -0
- vellum/client/types/token_overlapping_window_chunker_config.py +2 -2
- vellum/client/types/token_overlapping_window_chunker_config_request.py +2 -2
- vellum/client/types/token_overlapping_window_chunking.py +3 -3
- vellum/client/types/token_overlapping_window_chunking_request.py +3 -3
- vellum/client/types/update_active_workspace_response.py +32 -0
- vellum/client/types/upload_document_response.py +3 -3
- vellum/client/types/uploaded_file_read.py +27 -0
- vellum/client/types/upsert_test_suite_test_case_request.py +6 -5
- vellum/client/types/variable_prompt_block.py +11 -4
- vellum/client/types/vellum_audio.py +5 -4
- vellum/client/types/vellum_audio_request.py +3 -3
- vellum/client/types/vellum_code_resource_definition.py +7 -2
- vellum/client/types/vellum_document.py +9 -4
- vellum/client/types/vellum_document_request.py +7 -3
- vellum/client/types/vellum_error.py +5 -4
- vellum/client/types/vellum_error_code_enum.py +6 -0
- vellum/client/types/vellum_error_request.py +5 -4
- vellum/client/types/vellum_image.py +9 -4
- vellum/client/types/vellum_image_request.py +7 -3
- vellum/client/types/vellum_node_execution_event.py +4 -3
- vellum/client/types/vellum_sdk_error.py +4 -3
- vellum/client/types/vellum_sdk_error_code_enum.py +5 -0
- vellum/client/types/vellum_secret.py +2 -2
- vellum/client/types/vellum_span.py +2 -1
- vellum/client/types/vellum_value.py +13 -8
- vellum/client/types/vellum_value_logical_condition_group_request.py +6 -9
- vellum/client/types/vellum_value_logical_condition_request.py +10 -9
- vellum/client/types/vellum_value_logical_expression_request.py +2 -1
- vellum/client/types/vellum_value_request.py +13 -8
- vellum/client/types/vellum_variable.py +10 -9
- vellum/client/types/vellum_variable_extensions.py +3 -2
- vellum/client/types/vellum_variable_type.py +3 -1
- vellum/client/types/vellum_video.py +25 -0
- vellum/client/types/vellum_video_request.py +24 -0
- vellum/client/types/vellum_workflow_execution_event.py +4 -3
- vellum/client/types/video_chat_message_content.py +25 -0
- vellum/client/types/video_chat_message_content_request.py +25 -0
- vellum/client/types/video_input.py +30 -0
- vellum/client/types/video_input_request.py +30 -0
- vellum/client/types/video_prompt_block.py +29 -0
- vellum/client/types/video_vellum_value.py +25 -0
- vellum/client/types/video_vellum_value_request.py +25 -0
- vellum/client/types/workflow_deployment_display_data.py +27 -0
- vellum/client/types/workflow_deployment_event_executions_response.py +17 -34
- vellum/client/types/workflow_deployment_history_item.py +7 -6
- vellum/client/types/workflow_deployment_parent_context.py +14 -17
- vellum/client/types/workflow_deployment_read.py +19 -12
- vellum/client/types/workflow_deployment_release.py +10 -9
- vellum/client/types/workflow_deployment_release_workflow_deployment.py +2 -2
- vellum/client/types/workflow_deployment_release_workflow_version.py +7 -6
- vellum/client/types/workflow_display_icon.py +24 -0
- vellum/client/types/workflow_error.py +1 -0
- vellum/client/types/workflow_event.py +37 -0
- vellum/client/types/workflow_event_error.py +5 -3
- vellum/client/types/workflow_event_execution_read.py +23 -29
- vellum/client/types/workflow_execution_actual.py +8 -7
- vellum/client/types/workflow_execution_actual_chat_history_request.py +2 -2
- vellum/client/types/workflow_execution_actual_json_request.py +2 -2
- vellum/client/types/workflow_execution_actual_string_request.py +2 -2
- vellum/client/types/workflow_execution_detail.py +51 -0
- vellum/client/types/workflow_execution_event_error_code.py +5 -0
- vellum/client/types/workflow_execution_fulfilled_body.py +5 -3
- vellum/client/types/workflow_execution_fulfilled_event.py +21 -23
- vellum/client/types/workflow_execution_initiated_body.py +3 -12
- vellum/client/types/workflow_execution_initiated_event.py +21 -27
- vellum/client/types/workflow_execution_node_result_event.py +7 -6
- vellum/client/types/workflow_execution_paused_body.py +4 -4
- vellum/client/types/workflow_execution_paused_event.py +21 -23
- vellum/client/types/workflow_execution_rejected_body.py +5 -4
- vellum/client/types/workflow_execution_rejected_event.py +21 -23
- vellum/client/types/workflow_execution_resumed_body.py +3 -3
- vellum/client/types/workflow_execution_resumed_event.py +21 -23
- vellum/client/types/workflow_execution_snapshotted_body.py +4 -3
- vellum/client/types/workflow_execution_snapshotted_event.py +21 -25
- vellum/client/types/workflow_execution_span.py +19 -23
- vellum/client/types/workflow_execution_span_attributes.py +3 -2
- vellum/client/types/workflow_execution_streaming_body.py +4 -4
- vellum/client/types/workflow_execution_streaming_event.py +21 -23
- vellum/client/types/workflow_execution_usage_calculation_error.py +21 -0
- vellum/client/types/workflow_execution_usage_calculation_error_code_enum.py +7 -0
- vellum/client/types/workflow_execution_usage_calculation_fulfilled_body.py +3 -3
- vellum/client/types/workflow_execution_usage_result.py +24 -0
- vellum/client/types/workflow_execution_view_online_eval_metric_result.py +7 -8
- vellum/client/types/workflow_execution_workflow_result_event.py +7 -6
- vellum/client/types/workflow_expand_meta_request.py +2 -2
- vellum/client/types/workflow_initialization_error.py +2 -2
- vellum/client/types/workflow_input.py +31 -0
- vellum/client/types/workflow_node_result_data.py +8 -7
- vellum/client/types/workflow_node_result_event.py +3 -2
- vellum/client/types/workflow_output.py +12 -5
- vellum/client/types/workflow_output_array.py +9 -8
- vellum/client/types/workflow_output_audio.py +31 -0
- vellum/client/types/workflow_output_chat_history.py +3 -3
- vellum/client/types/workflow_output_document.py +31 -0
- vellum/client/types/workflow_output_error.py +3 -3
- vellum/client/types/workflow_output_function_call.py +3 -3
- vellum/client/types/workflow_output_image.py +3 -3
- vellum/client/types/workflow_output_json.py +3 -3
- vellum/client/types/workflow_output_number.py +3 -3
- vellum/client/types/workflow_output_search_results.py +3 -3
- vellum/client/types/workflow_output_string.py +3 -3
- vellum/client/types/workflow_output_video.py +31 -0
- vellum/client/types/workflow_parent_context.py +15 -18
- vellum/client/types/workflow_push_deployment_config_request.py +3 -2
- vellum/client/types/workflow_push_response.py +2 -2
- vellum/client/types/workflow_release_tag_read.py +4 -4
- vellum/client/types/workflow_release_tag_workflow_deployment_history_item.py +2 -2
- vellum/client/types/workflow_request_audio_input_request.py +30 -0
- vellum/client/types/workflow_request_chat_history_input_request.py +3 -3
- vellum/client/types/workflow_request_document_input_request.py +30 -0
- vellum/client/types/workflow_request_image_input_request.py +30 -0
- vellum/client/types/workflow_request_input_request.py +11 -2
- vellum/client/types/workflow_request_json_input_request.py +3 -3
- vellum/client/types/workflow_request_number_input_request.py +3 -3
- vellum/client/types/workflow_request_string_input_request.py +3 -3
- vellum/client/types/workflow_request_video_input_request.py +30 -0
- vellum/client/types/workflow_resolved_state.py +31 -0
- vellum/client/types/workflow_result_event.py +11 -10
- vellum/client/types/workflow_result_event_output_data.py +7 -6
- vellum/client/types/workflow_result_event_output_data_array.py +9 -8
- vellum/client/types/workflow_result_event_output_data_chat_history.py +3 -3
- vellum/client/types/workflow_result_event_output_data_error.py +3 -3
- vellum/client/types/workflow_result_event_output_data_function_call.py +3 -3
- vellum/client/types/workflow_result_event_output_data_json.py +3 -3
- vellum/client/types/workflow_result_event_output_data_number.py +3 -3
- vellum/client/types/workflow_result_event_output_data_search_results.py +3 -3
- vellum/client/types/workflow_result_event_output_data_string.py +3 -3
- vellum/client/types/workflow_result_event_state.py +7 -0
- vellum/client/types/workflow_sandbox_display_data.py +27 -0
- vellum/client/types/workflow_sandbox_example.py +4 -2
- vellum/client/types/workflow_sandbox_parent_context.py +14 -17
- vellum/client/types/workflow_stream_event.py +2 -1
- vellum/client/types/workspace_display_config.py +19 -0
- vellum/client/types/workspace_read.py +5 -3
- vellum/client/types/workspace_secret_read.py +3 -3
- vellum/client/utils.py +24 -0
- vellum/{types/node_event_display_context.py → core/force_multipart.py} +1 -1
- vellum/core/http_response.py +3 -0
- vellum/errors/misdirected_request_error.py +3 -0
- vellum/errors/too_many_requests_error.py +3 -0
- vellum/errors/unauthorized_error.py +3 -0
- vellum/evaluations/resources.py +5 -5
- vellum/plugins/pydantic.py +14 -3
- vellum/plugins/tests/__init__.py +0 -0
- vellum/plugins/tests/test_pydantic.py +30 -0
- vellum/plugins/vellum_mypy.py +31 -23
- vellum/prompts/__init__.py +3 -0
- vellum/prompts/blocks/__init__.py +3 -0
- vellum/prompts/blocks/compilation.py +29 -11
- vellum/prompts/blocks/helpers.py +31 -0
- vellum/prompts/blocks/tests/test_compilation.py +64 -0
- vellum/raw_client.py +3 -0
- vellum/resources/ad_hoc/raw_client.py +3 -0
- vellum/resources/container_images/raw_client.py +3 -0
- vellum/resources/deployments/raw_client.py +3 -0
- vellum/resources/document_indexes/raw_client.py +3 -0
- vellum/resources/documents/raw_client.py +3 -0
- vellum/resources/{release_reviews → environments}/__init__.py +1 -1
- vellum/resources/{release_reviews → environments}/client.py +1 -1
- vellum/resources/environments/raw_client.py +3 -0
- vellum/resources/events/__init__.py +3 -0
- vellum/resources/events/client.py +3 -0
- vellum/resources/events/raw_client.py +3 -0
- vellum/{types/workflow_event_display_context.py → resources/folder_entities/raw_client.py} +1 -1
- vellum/resources/integration_auth_configs/__init__.py +3 -0
- vellum/resources/integration_auth_configs/client.py +3 -0
- vellum/resources/integration_auth_configs/raw_client.py +3 -0
- vellum/resources/integration_providers/__init__.py +3 -0
- vellum/resources/integration_providers/client.py +3 -0
- vellum/resources/integration_providers/raw_client.py +3 -0
- vellum/resources/integrations/__init__.py +3 -0
- vellum/resources/integrations/client.py +3 -0
- vellum/resources/integrations/raw_client.py +3 -0
- vellum/resources/metric_definitions/raw_client.py +3 -0
- vellum/resources/ml_models/raw_client.py +3 -0
- vellum/resources/organizations/raw_client.py +3 -0
- vellum/resources/prompts/raw_client.py +3 -0
- vellum/resources/sandboxes/raw_client.py +3 -0
- vellum/resources/test_suite_runs/raw_client.py +3 -0
- vellum/resources/test_suites/raw_client.py +3 -0
- vellum/resources/uploaded_files/__init__.py +3 -0
- vellum/resources/uploaded_files/client.py +3 -0
- vellum/resources/uploaded_files/raw_client.py +3 -0
- vellum/resources/workflow_deployments/raw_client.py +3 -0
- vellum/resources/workflow_executions/__init__.py +3 -0
- vellum/resources/workflow_executions/client.py +3 -0
- vellum/resources/workflow_executions/raw_client.py +3 -0
- vellum/resources/workflow_sandboxes/raw_client.py +3 -0
- vellum/resources/workflows/raw_client.py +3 -0
- vellum/resources/workspace_secrets/raw_client.py +3 -0
- vellum/resources/workspaces/raw_client.py +3 -0
- vellum/types/api_actor_type_enum.py +3 -0
- vellum/types/audio_input.py +3 -0
- vellum/types/audio_input_request.py +3 -0
- vellum/types/auth_type_enum.py +3 -0
- vellum/types/build_status_enum.py +3 -0
- vellum/types/components_schemas_composio_execute_tool_request.py +3 -0
- vellum/types/components_schemas_composio_execute_tool_response.py +3 -0
- vellum/types/components_schemas_composio_integration_exec_config.py +3 -0
- vellum/types/components_schemas_composio_tool_definition.py +3 -0
- vellum/types/components_schemas_prompt_version_build_config_sandbox.py +3 -0
- vellum/types/components_schemas_slim_composio_tool_definition.py +3 -0
- vellum/types/composio_execute_tool_request.py +3 -0
- vellum/types/composio_execute_tool_response.py +3 -0
- vellum/types/composio_integration_exec_config.py +3 -0
- vellum/types/composio_tool_definition.py +3 -0
- vellum/types/container_image_build_config.py +3 -0
- vellum/types/create_workflow_event_request.py +3 -0
- vellum/types/dataset_row_push_request.py +3 -0
- vellum/types/delimiter_chunker_config.py +3 -0
- vellum/types/delimiter_chunker_config_request.py +3 -0
- vellum/types/delimiter_chunking.py +3 -0
- vellum/types/delimiter_chunking_request.py +3 -0
- vellum/types/deprecated_prompt_request_input.py +3 -0
- vellum/types/document_input.py +3 -0
- vellum/types/document_input_request.py +3 -0
- vellum/types/environment_display_config.py +3 -0
- vellum/types/environment_read.py +3 -0
- vellum/types/error_detail_response.py +3 -0
- vellum/types/event_create_response.py +3 -0
- vellum/types/execute_api_response_json.py +3 -0
- vellum/types/execute_workflow_async_response.py +3 -0
- vellum/types/execution_audio_vellum_value.py +3 -0
- vellum/types/execution_document_vellum_value.py +3 -0
- vellum/types/execution_image_vellum_value.py +3 -0
- vellum/types/execution_thinking_vellum_value.py +3 -0
- vellum/types/execution_video_vellum_value.py +3 -0
- vellum/types/external_parent_context.py +3 -0
- vellum/types/fast_embed_vectorizer_baai_bge_small_en_v_15.py +3 -0
- vellum/types/fast_embed_vectorizer_baai_bge_small_en_v_15_request.py +3 -0
- vellum/types/folder_entity_dataset.py +3 -0
- vellum/types/folder_entity_dataset_data.py +3 -0
- vellum/types/google_vertex_ai_vectorizer_gemini_embedding_001.py +3 -0
- vellum/types/google_vertex_ai_vectorizer_gemini_embedding_001_request.py +3 -0
- vellum/types/image_input.py +3 -0
- vellum/types/image_input_request.py +3 -0
- vellum/types/integration.py +3 -0
- vellum/types/integration_auth_config_integration.py +3 -0
- vellum/types/integration_auth_config_integration_credential.py +3 -0
- vellum/types/integration_credential_access_type.py +3 -0
- vellum/types/integration_name.py +3 -0
- vellum/types/integration_provider.py +3 -0
- vellum/types/integration_read.py +3 -0
- vellum/types/integration_trigger_context.py +3 -0
- vellum/types/named_scenario_input_audio_variable_value_request.py +3 -0
- vellum/types/named_scenario_input_document_variable_value_request.py +3 -0
- vellum/types/named_scenario_input_image_variable_value_request.py +3 -0
- vellum/types/named_scenario_input_video_variable_value_request.py +3 -0
- vellum/types/named_test_case_audio_variable_value.py +3 -0
- vellum/types/named_test_case_audio_variable_value_request.py +3 -0
- vellum/types/named_test_case_document_variable_value.py +3 -0
- vellum/types/named_test_case_document_variable_value_request.py +3 -0
- vellum/types/named_test_case_image_variable_value.py +3 -0
- vellum/types/named_test_case_image_variable_value_request.py +3 -0
- vellum/types/named_test_case_video_variable_value.py +3 -0
- vellum/types/named_test_case_video_variable_value_request.py +3 -0
- vellum/types/node_input_compiled_audio_value.py +3 -0
- vellum/types/node_input_compiled_document_value.py +3 -0
- vellum/types/node_input_compiled_image_value.py +3 -0
- vellum/types/node_input_compiled_video_value.py +3 -0
- vellum/types/node_output_compiled_thinking_value.py +3 -0
- vellum/types/paginated_slim_integration_auth_config_read_list.py +3 -0
- vellum/types/paginated_slim_integration_read_list.py +3 -0
- vellum/types/paginated_slim_tool_definition_list.py +3 -0
- vellum/types/paginated_workflow_deployment_release_list.py +3 -0
- vellum/types/private_vectorizer.py +3 -0
- vellum/types/private_vectorizer_request.py +3 -0
- vellum/types/prompt_push_response.py +3 -0
- vellum/types/prompt_request_audio_input.py +3 -0
- vellum/types/prompt_request_document_input.py +3 -0
- vellum/types/prompt_request_image_input.py +3 -0
- vellum/types/prompt_request_video_input.py +3 -0
- vellum/types/prompt_version_build_config_sandbox.py +3 -0
- vellum/types/scenario_input_audio_variable_value.py +3 -0
- vellum/types/scenario_input_document_variable_value.py +3 -0
- vellum/types/scenario_input_image_variable_value.py +3 -0
- vellum/types/scenario_input_video_variable_value.py +3 -0
- vellum/types/scheduled_trigger_context.py +3 -0
- vellum/types/slim_composio_tool_definition.py +3 -0
- vellum/types/slim_integration_auth_config_read.py +3 -0
- vellum/types/slim_integration_read.py +3 -0
- vellum/types/test_case_audio_variable_value.py +3 -0
- vellum/types/test_case_document_variable_value.py +3 -0
- vellum/types/test_case_image_variable_value.py +3 -0
- vellum/types/test_case_video_variable_value.py +3 -0
- vellum/types/thinking_vellum_value.py +3 -0
- vellum/types/thinking_vellum_value_request.py +3 -0
- vellum/types/update_active_workspace_response.py +3 -0
- vellum/types/uploaded_file_read.py +3 -0
- vellum/types/vellum_video.py +3 -0
- vellum/types/vellum_video_request.py +3 -0
- vellum/types/video_chat_message_content.py +3 -0
- vellum/types/video_chat_message_content_request.py +3 -0
- vellum/types/video_input.py +3 -0
- vellum/types/video_input_request.py +3 -0
- vellum/types/video_prompt_block.py +3 -0
- vellum/types/video_vellum_value.py +3 -0
- vellum/types/video_vellum_value_request.py +3 -0
- vellum/types/workflow_deployment_display_data.py +3 -0
- vellum/types/workflow_display_icon.py +3 -0
- vellum/types/workflow_event.py +3 -0
- vellum/types/workflow_execution_detail.py +3 -0
- vellum/types/workflow_execution_usage_calculation_error.py +3 -0
- vellum/types/workflow_execution_usage_calculation_error_code_enum.py +3 -0
- vellum/types/workflow_execution_usage_result.py +3 -0
- vellum/types/workflow_input.py +3 -0
- vellum/types/workflow_output_audio.py +3 -0
- vellum/types/workflow_output_document.py +3 -0
- vellum/types/workflow_output_video.py +3 -0
- vellum/types/workflow_request_audio_input_request.py +3 -0
- vellum/types/workflow_request_document_input_request.py +3 -0
- vellum/types/workflow_request_image_input_request.py +3 -0
- vellum/types/workflow_request_video_input_request.py +3 -0
- vellum/types/workflow_resolved_state.py +3 -0
- vellum/types/workflow_result_event_state.py +3 -0
- vellum/types/workflow_sandbox_display_data.py +3 -0
- vellum/types/workspace_display_config.py +3 -0
- vellum/utils/files/__init__.py +18 -0
- vellum/utils/files/constants.py +47 -0
- vellum/utils/files/exceptions.py +25 -0
- vellum/utils/files/extensions.py +59 -0
- vellum/utils/files/mixin.py +109 -0
- vellum/utils/files/read.py +41 -0
- vellum/utils/files/stream.py +135 -0
- vellum/utils/files/tests/__init__.py +0 -0
- vellum/utils/files/tests/test_extensions.py +54 -0
- vellum/utils/files/tests/test_mixin.py +205 -0
- vellum/utils/files/tests/test_read.py +204 -0
- vellum/utils/files/tests/test_stream.py +199 -0
- vellum/utils/files/tests/test_upload.py +309 -0
- vellum/utils/files/tests/test_urls.py +252 -0
- vellum/utils/files/types.py +8 -0
- vellum/utils/files/upload.py +151 -0
- vellum/utils/files/urls.py +71 -0
- vellum/utils/json_encoder.py +95 -0
- vellum/utils/templating/custom_filters.py +4 -4
- vellum/utils/templating/render.py +4 -4
- vellum/utils/tests/__init__.py +0 -0
- vellum/utils/tests/test_json_encoder.py +92 -0
- vellum/utils/vellum_client.py +40 -0
- vellum/workflows/__init__.py +78 -0
- vellum/workflows/constants.py +7 -0
- vellum/workflows/context.py +27 -9
- vellum/workflows/descriptors/base.py +83 -2
- vellum/workflows/descriptors/exceptions.py +18 -1
- vellum/workflows/descriptors/tests/test_utils.py +57 -0
- vellum/workflows/descriptors/utils.py +27 -3
- vellum/workflows/edges/__init__.py +2 -0
- vellum/workflows/edges/trigger_edge.py +67 -0
- vellum/workflows/emitters/__init__.py +2 -0
- vellum/workflows/emitters/base.py +25 -0
- vellum/workflows/emitters/vellum_emitter.py +150 -0
- vellum/workflows/environment/__init__.py +2 -1
- vellum/workflows/environment/environment.py +10 -3
- vellum/workflows/errors/types.py +29 -2
- vellum/workflows/events/__init__.py +2 -0
- vellum/workflows/events/context.py +90 -0
- vellum/workflows/events/exception_handling.py +58 -0
- vellum/workflows/events/node.py +27 -11
- vellum/workflows/events/relational_threads.py +41 -0
- vellum/workflows/events/stream.py +28 -0
- vellum/workflows/events/tests/test_basic_workflow.py +50 -0
- vellum/workflows/events/tests/test_event.py +145 -20
- vellum/workflows/events/types.py +32 -4
- vellum/workflows/events/workflow.py +111 -8
- vellum/workflows/exceptions.py +46 -7
- vellum/workflows/executable.py +9 -0
- vellum/workflows/expressions/accessor.py +65 -11
- vellum/workflows/expressions/add.py +41 -0
- vellum/workflows/expressions/comparison_utils.py +38 -0
- vellum/workflows/expressions/concat.py +35 -0
- vellum/workflows/expressions/contains.py +7 -0
- vellum/workflows/expressions/greater_than.py +8 -1
- vellum/workflows/expressions/greater_than_or_equal_to.py +8 -1
- vellum/workflows/expressions/is_error.py +23 -0
- vellum/workflows/expressions/length.py +46 -0
- vellum/workflows/expressions/less_than.py +8 -1
- vellum/workflows/expressions/less_than_or_equal_to.py +8 -1
- vellum/workflows/expressions/minus.py +41 -0
- vellum/workflows/expressions/tests/test_accessor.py +248 -0
- vellum/workflows/expressions/tests/test_add.py +72 -0
- vellum/workflows/expressions/tests/test_concat.py +108 -0
- vellum/workflows/expressions/tests/test_contains.py +175 -0
- vellum/workflows/expressions/tests/test_expressions.py +145 -32
- vellum/workflows/expressions/tests/test_length.py +38 -0
- vellum/workflows/expressions/tests/test_minus.py +109 -0
- vellum/workflows/graph/graph.py +255 -8
- vellum/workflows/graph/tests/test_graph.py +300 -0
- vellum/workflows/inputs/__init__.py +2 -0
- vellum/workflows/inputs/base.py +75 -18
- vellum/workflows/inputs/dataset_row.py +81 -0
- vellum/workflows/inputs/tests/test_inputs.py +196 -1
- vellum/workflows/integrations/__init__.py +5 -0
- vellum/workflows/integrations/composio_service.py +158 -0
- vellum/workflows/integrations/mcp_service.py +282 -0
- vellum/workflows/integrations/tests/__init__.py +0 -0
- vellum/workflows/integrations/tests/test_mcp_service.py +273 -0
- vellum/workflows/integrations/tests/test_vellum_integration_service.py +299 -0
- vellum/workflows/integrations/vellum_integration_service.py +136 -0
- vellum/workflows/loaders/__init__.py +3 -0
- vellum/workflows/loaders/base.py +36 -0
- vellum/workflows/nodes/__init__.py +2 -0
- vellum/workflows/nodes/bases/base.py +238 -46
- vellum/workflows/nodes/bases/base_adornment_node.py +64 -1
- vellum/workflows/nodes/bases/tests/test_base_adornment_node.py +31 -0
- vellum/workflows/nodes/bases/tests/test_base_node.py +100 -4
- vellum/workflows/nodes/core/error_node/node.py +11 -2
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +29 -3
- vellum/workflows/nodes/core/inline_subworkflow_node/tests/test_node.py +35 -0
- vellum/workflows/nodes/core/map_node/node.py +103 -90
- vellum/workflows/nodes/core/map_node/tests/test_node.py +178 -0
- vellum/workflows/nodes/core/retry_node/node.py +8 -1
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +2 -3
- vellum/workflows/nodes/core/templating_node/node.py +7 -2
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +194 -1
- vellum/workflows/nodes/displayable/__init__.py +6 -0
- vellum/workflows/nodes/displayable/api_node/node.py +17 -1
- vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py +177 -3
- vellum/workflows/nodes/displayable/bases/api_node/node.py +70 -16
- vellum/workflows/nodes/displayable/bases/api_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/bases/api_node/tests/test_node.py +150 -0
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +68 -7
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +299 -27
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py +663 -20
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +84 -14
- vellum/workflows/nodes/displayable/bases/search_node.py +26 -3
- vellum/workflows/nodes/displayable/bases/tests/test_prompt_deployment_node.py +90 -0
- vellum/workflows/nodes/displayable/bases/utils.py +82 -5
- vellum/workflows/nodes/displayable/code_execution_node/node.py +46 -15
- vellum/workflows/nodes/displayable/code_execution_node/tests/{test_code_execution_node.py → test_node.py} +646 -5
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +28 -74
- vellum/workflows/nodes/displayable/conditional_node/node.py +8 -4
- vellum/workflows/nodes/displayable/final_output_node/node.py +80 -1
- vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py +96 -1
- vellum/workflows/nodes/displayable/guardrail_node/node.py +25 -5
- vellum/workflows/nodes/displayable/guardrail_node/test_node.py +29 -0
- vellum/workflows/nodes/displayable/inline_prompt_node/node.py +9 -36
- vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +3 -0
- vellum/workflows/nodes/displayable/merge_node/node.py +8 -1
- vellum/workflows/nodes/displayable/note_node/node.py +8 -1
- vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +7 -23
- vellum/workflows/nodes/displayable/search_node/node.py +18 -0
- vellum/workflows/nodes/displayable/search_node/tests/test_node.py +76 -0
- vellum/workflows/nodes/displayable/set_state_node/__init__.py +5 -0
- vellum/workflows/nodes/displayable/set_state_node/node.py +71 -0
- vellum/workflows/nodes/displayable/set_state_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/set_state_node/tests/test_node.py +212 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +220 -59
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/test_node.py +26 -1
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +4 -1
- vellum/workflows/nodes/displayable/tests/test_search_node_error_handling.py +329 -0
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +10 -16
- vellum/workflows/nodes/displayable/tool_calling_node/__init__.py +3 -0
- vellum/workflows/nodes/displayable/tool_calling_node/node.py +225 -0
- vellum/workflows/nodes/displayable/tool_calling_node/state.py +11 -0
- vellum/workflows/nodes/displayable/tool_calling_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/tool_calling_node/tests/test_composio_service.py +219 -0
- vellum/workflows/nodes/displayable/tool_calling_node/tests/test_node.py +802 -0
- vellum/workflows/nodes/displayable/tool_calling_node/tests/test_utils.py +316 -0
- vellum/workflows/nodes/displayable/tool_calling_node/utils.py +633 -0
- vellum/workflows/nodes/displayable/web_search_node/__init__.py +3 -0
- vellum/workflows/nodes/displayable/web_search_node/node.py +136 -0
- vellum/workflows/nodes/displayable/web_search_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/web_search_node/tests/test_node.py +246 -0
- vellum/workflows/nodes/experimental/__init__.py +1 -0
- vellum/workflows/nodes/mocks.py +40 -9
- vellum/workflows/nodes/tests/test_mocks.py +2 -2
- vellum/workflows/nodes/tests/test_utils.py +42 -26
- vellum/workflows/nodes/utils.py +70 -7
- vellum/workflows/outputs/base.py +53 -12
- vellum/workflows/ports/node_ports.py +6 -2
- vellum/workflows/ports/port.py +28 -3
- vellum/workflows/ports/tests/test_port.py +45 -0
- vellum/workflows/ports/utils.py +70 -17
- vellum/workflows/references/__init__.py +2 -0
- vellum/workflows/references/constant.py +4 -1
- vellum/workflows/references/environment_variable.py +27 -9
- vellum/workflows/references/output.py +3 -5
- vellum/workflows/references/trigger.py +77 -0
- vellum/workflows/references/workflow_input.py +5 -1
- vellum/workflows/resolvers/base.py +19 -1
- vellum/workflows/resolvers/resolver.py +71 -0
- vellum/workflows/resolvers/tests/test_resolver.py +168 -0
- vellum/workflows/resolvers/types.py +11 -0
- vellum/workflows/runner/runner.py +659 -154
- vellum/workflows/sandbox.py +55 -9
- vellum/workflows/state/base.py +192 -64
- vellum/workflows/state/context.py +225 -6
- vellum/workflows/state/delta.py +20 -0
- vellum/workflows/state/encoder.py +2 -62
- vellum/workflows/state/tests/test_state.py +24 -9
- vellum/workflows/tests/test_dataset_row.py +190 -0
- vellum/workflows/tests/test_sandbox.py +137 -0
- vellum/workflows/tests/triggers/test_integration_trigger.py +156 -0
- vellum/workflows/triggers/__init__.py +6 -0
- vellum/workflows/triggers/base.py +391 -0
- vellum/workflows/triggers/integration.py +186 -0
- vellum/workflows/triggers/manual.py +37 -0
- vellum/workflows/triggers/schedule.py +18 -0
- vellum/workflows/triggers/tests/__init__.py +1 -0
- vellum/workflows/triggers/tests/test_base_trigger_display.py +147 -0
- vellum/workflows/triggers/tests/test_integration.py +155 -0
- vellum/workflows/types/__init__.py +2 -1
- vellum/workflows/types/code_execution_node_wrappers.py +105 -0
- vellum/workflows/types/core.py +5 -0
- vellum/workflows/types/definition.py +168 -2
- vellum/workflows/types/generics.py +5 -0
- vellum/workflows/types/tests/test_definition.py +183 -0
- vellum/workflows/types/tests/test_utils.py +14 -3
- vellum/workflows/types/utils.py +64 -13
- vellum/workflows/utils/files.py +28 -0
- vellum/workflows/utils/functions.py +284 -17
- vellum/workflows/utils/hmac.py +44 -0
- vellum/workflows/utils/names.py +32 -4
- vellum/workflows/utils/pydantic_schema.py +38 -0
- vellum/workflows/utils/tests/test_functions.py +516 -5
- vellum/workflows/utils/tests/test_names.py +9 -0
- vellum/workflows/utils/tests/test_vellum_variables.py +32 -2
- vellum/workflows/utils/uuids.py +35 -0
- vellum/workflows/utils/vellum_variables.py +131 -7
- vellum/workflows/utils/zip.py +46 -0
- vellum/workflows/vellum_client.py +3 -21
- vellum/workflows/workflows/base.py +363 -39
- vellum/workflows/workflows/event_filters.py +13 -0
- vellum/workflows/workflows/tests/test_base_workflow.py +122 -10
- vellum/workflows/workflows/tests/test_event_filters.py +126 -0
- {vellum_ai-0.14.41.dist-info → vellum_ai-1.11.2.dist-info}/METADATA +12 -13
- vellum_ai-1.11.2.dist-info/RECORD +2177 -0
- vellum_ai-1.11.2.dist-info/entry_points.txt +4 -0
- vellum_cli/__init__.py +42 -4
- vellum_cli/config.py +12 -5
- vellum_cli/image_push.py +120 -10
- vellum_cli/logger.py +11 -0
- vellum_cli/move.py +56 -0
- vellum_cli/ping.py +6 -0
- vellum_cli/pull.py +78 -14
- vellum_cli/push.py +149 -61
- vellum_cli/tests/conftest.py +6 -0
- vellum_cli/tests/test_image_push.py +295 -8
- vellum_cli/tests/test_image_push_error_handling.py +258 -0
- vellum_cli/tests/test_init.py +7 -24
- vellum_cli/tests/test_move.py +154 -0
- vellum_cli/tests/test_ping.py +15 -0
- vellum_cli/tests/test_pull.py +133 -57
- vellum_cli/tests/test_push.py +708 -19
- vellum_ee/assets/node-definitions.json +1135 -0
- vellum_ee/scripts/generate_node_definitions.py +89 -0
- vellum_ee/workflows/display/base.py +29 -55
- vellum_ee/workflows/display/editor/types.py +3 -0
- vellum_ee/workflows/display/exceptions.py +3 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +211 -218
- vellum_ee/workflows/display/nodes/get_node_display_class.py +1 -25
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +149 -3
- vellum_ee/workflows/display/nodes/vellum/__init__.py +2 -0
- vellum_ee/workflows/display/nodes/vellum/api_node.py +37 -12
- vellum_ee/workflows/display/nodes/vellum/base_adornment_node.py +3 -3
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +30 -8
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +19 -7
- vellum_ee/workflows/display/nodes/vellum/error_node.py +23 -19
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +9 -19
- vellum_ee/workflows/display/nodes/vellum/function_node.py +14 -0
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +4 -4
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +114 -29
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +35 -9
- vellum_ee/workflows/display/nodes/vellum/map_node.py +44 -25
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +2 -4
- vellum_ee/workflows/display/nodes/vellum/note_node.py +2 -3
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +28 -17
- vellum_ee/workflows/display/nodes/vellum/retry_node.py +6 -7
- vellum_ee/workflows/display/nodes/vellum/search_node.py +84 -18
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +26 -14
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +5 -5
- vellum_ee/workflows/display/nodes/vellum/tests/test_api_node.py +65 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +219 -3
- vellum_ee/workflows/display/nodes/vellum/tests/test_error_node.py +4 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_final_output_node.py +80 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_inline_subworkflow_node.py +88 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_deployment_node.py +177 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_node.py +207 -6
- vellum_ee/workflows/display/nodes/vellum/tests/test_retry_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_search_node.py +104 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_subworkflow_deployment_node.py +110 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_templating_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +694 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_try_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +8 -9
- vellum_ee/workflows/display/nodes/vellum/try_node.py +6 -7
- vellum_ee/workflows/display/tests/test_base_workflow_display.py +427 -8
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +150 -125
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +277 -87
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +21 -17
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +76 -64
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +69 -12
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +68 -46
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +92 -80
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +320 -170
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_default_state_serialization.py +14 -15
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +14 -12
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +28 -18
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +20 -16
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +621 -5
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +73 -43
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +51 -32
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +37 -33
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +367 -36
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +40 -36
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_set_state_node_serialization.py +86 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +25 -21
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +22 -18
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +14 -10
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_composio_serialization.py +87 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +313 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +65 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_parent_input.py +89 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +224 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_vellum_integration_serialization.py +68 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +107 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_chat_message_dict_reference_serialization.py +108 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +20 -65
- vellum_ee/workflows/display/tests/workflow_serialization/test_final_output_node_map_reference_serialization.py +88 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_integration_trigger_serialization.py +306 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_integration_trigger_with_entrypoint_node_id.py +88 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_list_vellum_document_serialization.py +65 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_manual_trigger_serialization.py +110 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_map_node_with_terminal_nodes_serialization.py +62 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_multi_trigger_same_node_serialization.py +99 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_scheduled_trigger_serialization.py +267 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_terminal_node_any_serialization.py +49 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_trigger_display_from_display_class.py +153 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_web_search_node_serialization.py +72 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_workflow_input_parameterization_error.py +37 -0
- vellum_ee/workflows/display/types.py +32 -2
- vellum_ee/workflows/display/utils/auto_layout.py +130 -0
- vellum_ee/workflows/display/utils/events.py +57 -0
- vellum_ee/workflows/display/utils/exceptions.py +19 -0
- vellum_ee/workflows/display/utils/expressions.py +487 -2
- vellum_ee/workflows/display/utils/metadata.py +146 -0
- vellum_ee/workflows/display/utils/registry.py +46 -0
- vellum_ee/workflows/display/utils/tests/__init__.py +0 -0
- vellum_ee/workflows/display/utils/tests/test_auto_layout.py +56 -0
- vellum_ee/workflows/display/utils/tests/test_events.py +185 -0
- vellum_ee/workflows/display/utils/tests/test_expressions.py +92 -0
- vellum_ee/workflows/display/utils/vellum.py +49 -86
- vellum_ee/workflows/display/vellum.py +2 -128
- vellum_ee/workflows/display/workflows/__init__.py +0 -1
- vellum_ee/workflows/display/workflows/base_workflow_display.py +778 -129
- vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +3 -0
- vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +752 -2
- vellum_ee/workflows/server/virtual_file_loader.py +131 -6
- vellum_ee/workflows/tests/local_workflow/display/nodes/final_output.py +1 -1
- vellum_ee/workflows/tests/local_workflow/display/nodes/templating_node.py +1 -1
- vellum_ee/workflows/tests/local_workflow/display/workflow.py +11 -14
- vellum_ee/workflows/tests/test_display_meta.py +89 -0
- vellum_ee/workflows/tests/test_registry.py +169 -0
- vellum_ee/workflows/tests/test_serialize_module.py +265 -0
- vellum_ee/workflows/tests/test_server.py +619 -44
- vellum_ee/workflows/tests/test_virtual_files.py +48 -0
- vellum/client/resources/release_reviews/client.py +0 -254
- vellum/client/types/node_event_display_context.py +0 -30
- vellum/client/types/workflow_event_display_context.py +0 -28
- vellum/workflows/nodes/experimental/openai_chat_completion_node/__init__.py +0 -5
- vellum/workflows/nodes/experimental/openai_chat_completion_node/node.py +0 -266
- vellum/workflows/nodes/experimental/tool_calling_node/__init__.py +0 -3
- vellum/workflows/nodes/experimental/tool_calling_node/node.py +0 -125
- vellum/workflows/nodes/experimental/tool_calling_node/utils.py +0 -128
- vellum_ai-0.14.41.dist-info/RECORD +0 -1704
- vellum_ai-0.14.41.dist-info/entry_points.txt +0 -3
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +0 -9
- /vellum/{workflows/nodes/displayable/bases/inline_prompt_node → prompts}/constants.py +0 -0
- {vellum_ai-0.14.41.dist-info → vellum_ai-1.11.2.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.41.dist-info → vellum_ai-1.11.2.dist-info}/WHEEL +0 -0
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
|
+
from contextlib import contextmanager
|
|
2
3
|
from copy import deepcopy
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
import logging
|
|
5
6
|
from queue import Empty, Queue
|
|
7
|
+
import sys
|
|
6
8
|
from threading import Event as ThreadingEvent, Thread
|
|
9
|
+
import traceback
|
|
7
10
|
from uuid import UUID, uuid4
|
|
8
|
-
from typing import
|
|
11
|
+
from typing import (
|
|
12
|
+
TYPE_CHECKING,
|
|
13
|
+
Any,
|
|
14
|
+
Dict,
|
|
15
|
+
Generator,
|
|
16
|
+
Generic,
|
|
17
|
+
Iterable,
|
|
18
|
+
Iterator,
|
|
19
|
+
List,
|
|
20
|
+
Optional,
|
|
21
|
+
Sequence,
|
|
22
|
+
Set,
|
|
23
|
+
Tuple,
|
|
24
|
+
Type,
|
|
25
|
+
Union,
|
|
26
|
+
)
|
|
9
27
|
|
|
10
28
|
from vellum.workflows.constants import undefined
|
|
11
29
|
from vellum.workflows.context import ExecutionContext, execution_context, get_execution_context
|
|
12
30
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
|
13
|
-
from vellum.workflows.
|
|
31
|
+
from vellum.workflows.descriptors.exceptions import InvalidExpressionException
|
|
14
32
|
from vellum.workflows.errors import WorkflowError, WorkflowErrorCode
|
|
15
33
|
from vellum.workflows.events import (
|
|
16
34
|
NodeExecutionFulfilledEvent,
|
|
@@ -18,20 +36,22 @@ from vellum.workflows.events import (
|
|
|
18
36
|
NodeExecutionRejectedEvent,
|
|
19
37
|
NodeExecutionStreamingEvent,
|
|
20
38
|
WorkflowEvent,
|
|
21
|
-
|
|
39
|
+
WorkflowEventGenerator,
|
|
22
40
|
WorkflowExecutionFulfilledEvent,
|
|
23
41
|
WorkflowExecutionInitiatedEvent,
|
|
24
42
|
WorkflowExecutionRejectedEvent,
|
|
25
43
|
WorkflowExecutionStreamingEvent,
|
|
26
44
|
)
|
|
27
45
|
from vellum.workflows.events.node import (
|
|
46
|
+
NodeEvent,
|
|
28
47
|
NodeExecutionFulfilledBody,
|
|
29
48
|
NodeExecutionInitiatedBody,
|
|
30
49
|
NodeExecutionRejectedBody,
|
|
31
50
|
NodeExecutionStreamingBody,
|
|
32
51
|
)
|
|
33
|
-
from vellum.workflows.events.types import BaseEvent, NodeParentContext, ParentContext, WorkflowParentContext
|
|
52
|
+
from vellum.workflows.events.types import BaseEvent, NodeParentContext, ParentContext, SpanLink, WorkflowParentContext
|
|
34
53
|
from vellum.workflows.events.workflow import (
|
|
54
|
+
WorkflowEventStream,
|
|
35
55
|
WorkflowExecutionFulfilledBody,
|
|
36
56
|
WorkflowExecutionInitiatedBody,
|
|
37
57
|
WorkflowExecutionPausedBody,
|
|
@@ -51,7 +71,13 @@ from vellum.workflows.outputs import BaseOutputs
|
|
|
51
71
|
from vellum.workflows.outputs.base import BaseOutput
|
|
52
72
|
from vellum.workflows.ports.port import Port
|
|
53
73
|
from vellum.workflows.references import ExternalInputReference, OutputReference
|
|
74
|
+
from vellum.workflows.references.state_value import StateValueReference
|
|
54
75
|
from vellum.workflows.state.base import BaseState
|
|
76
|
+
from vellum.workflows.state.delta import StateDelta
|
|
77
|
+
from vellum.workflows.triggers.base import BaseTrigger
|
|
78
|
+
from vellum.workflows.triggers.integration import IntegrationTrigger
|
|
79
|
+
from vellum.workflows.triggers.manual import ManualTrigger
|
|
80
|
+
from vellum.workflows.types.core import CancelSignal
|
|
55
81
|
from vellum.workflows.types.generics import InputsType, OutputsType, StateType
|
|
56
82
|
|
|
57
83
|
if TYPE_CHECKING:
|
|
@@ -59,7 +85,7 @@ if TYPE_CHECKING:
|
|
|
59
85
|
|
|
60
86
|
logger = logging.getLogger(__name__)
|
|
61
87
|
|
|
62
|
-
RunFromNodeArg = Sequence[Type[BaseNode]]
|
|
88
|
+
RunFromNodeArg = Sequence[Union[Type[BaseNode], UUID]]
|
|
63
89
|
ExternalInputsArg = Dict[ExternalInputReference, Any]
|
|
64
90
|
BackgroundThreadItem = Union[BaseState, WorkflowEvent, None]
|
|
65
91
|
|
|
@@ -80,10 +106,14 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
80
106
|
state: Optional[StateType] = None,
|
|
81
107
|
entrypoint_nodes: Optional[RunFromNodeArg] = None,
|
|
82
108
|
external_inputs: Optional[ExternalInputsArg] = None,
|
|
83
|
-
|
|
109
|
+
previous_execution_id: Optional[Union[str, UUID]] = None,
|
|
110
|
+
cancel_signal: Optional[CancelSignal] = None,
|
|
84
111
|
node_output_mocks: Optional[MockNodeExecutionArg] = None,
|
|
85
112
|
max_concurrency: Optional[int] = None,
|
|
113
|
+
timeout: Optional[float] = None,
|
|
86
114
|
init_execution_context: Optional[ExecutionContext] = None,
|
|
115
|
+
trigger: Optional[BaseTrigger] = None,
|
|
116
|
+
execution_id: Optional[UUID] = None,
|
|
87
117
|
):
|
|
88
118
|
if state and external_inputs:
|
|
89
119
|
raise ValueError("Can only run a Workflow providing one of state or external inputs, not both")
|
|
@@ -91,21 +121,35 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
91
121
|
self.workflow = workflow
|
|
92
122
|
self._is_resuming = False
|
|
93
123
|
self._should_emit_initial_state = True
|
|
124
|
+
self._span_link_info: Optional[Tuple[str, str, str, str]] = None
|
|
94
125
|
if entrypoint_nodes:
|
|
95
|
-
|
|
96
|
-
|
|
126
|
+
nodes_by_id = {node.__id__: node for node in self.workflow.get_all_nodes()}
|
|
127
|
+
|
|
128
|
+
resolved_nodes = []
|
|
129
|
+
for item in entrypoint_nodes:
|
|
130
|
+
if isinstance(item, UUID):
|
|
131
|
+
matching_node = nodes_by_id.get(item)
|
|
132
|
+
if matching_node is None:
|
|
133
|
+
raise ValueError(f"No node found with UUID {item}")
|
|
134
|
+
resolved_nodes.append(matching_node)
|
|
135
|
+
else:
|
|
136
|
+
resolved_nodes.append(item)
|
|
137
|
+
|
|
138
|
+
if len(list(resolved_nodes)) > 1:
|
|
139
|
+
raise WorkflowInitializationException("Cannot resume from multiple nodes")
|
|
97
140
|
|
|
98
141
|
# TODO: Support resuming from multiple nodes
|
|
99
142
|
# https://app.shortcut.com/vellum/story/4408
|
|
100
|
-
node = next(iter(
|
|
143
|
+
node = next(iter(resolved_nodes))
|
|
101
144
|
if state:
|
|
102
145
|
self._initial_state = deepcopy(state)
|
|
103
|
-
self._initial_state.meta.span_id = uuid4()
|
|
146
|
+
self._initial_state.meta.span_id = execution_id or uuid4()
|
|
147
|
+
self._initial_state.meta.workflow_definition = self.workflow.__class__
|
|
104
148
|
else:
|
|
105
149
|
self._initial_state = self.workflow.get_state_at_node(node)
|
|
106
|
-
self._entrypoints =
|
|
150
|
+
self._entrypoints = resolved_nodes
|
|
107
151
|
elif external_inputs:
|
|
108
|
-
self._initial_state = self.workflow.get_most_recent_state()
|
|
152
|
+
self._initial_state = self.workflow.get_most_recent_state(execution_id)
|
|
109
153
|
for descriptor, value in external_inputs.items():
|
|
110
154
|
if not any(isinstance(value, type_) for type_ in descriptor.types):
|
|
111
155
|
raise NodeException(
|
|
@@ -120,20 +164,84 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
120
164
|
if issubclass(ei.inputs_class.__parent_class__, BaseNode)
|
|
121
165
|
]
|
|
122
166
|
self._is_resuming = True
|
|
167
|
+
elif previous_execution_id:
|
|
168
|
+
if not self.workflow.resolvers:
|
|
169
|
+
raise WorkflowInitializationException(
|
|
170
|
+
message=f"No resolvers configured to load initial state for execution ID: {previous_execution_id}",
|
|
171
|
+
workflow_definition=self.workflow.__class__,
|
|
172
|
+
code=WorkflowErrorCode.INVALID_INPUTS,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
resolver_failed = True
|
|
176
|
+
for resolver in self.workflow.resolvers:
|
|
177
|
+
try:
|
|
178
|
+
load_state_result = resolver.load_state(previous_execution_id)
|
|
179
|
+
|
|
180
|
+
if load_state_result is not None:
|
|
181
|
+
if execution_id:
|
|
182
|
+
load_state_result.state.meta.span_id = execution_id
|
|
183
|
+
|
|
184
|
+
state_class = self.workflow.get_state_class()
|
|
185
|
+
if isinstance(load_state_result.state, state_class):
|
|
186
|
+
self._initial_state = load_state_result.state
|
|
187
|
+
normalized_inputs = deepcopy(inputs) if inputs else self.workflow.get_default_inputs()
|
|
188
|
+
self._initial_state.meta.workflow_inputs = normalized_inputs
|
|
189
|
+
self._initial_state.meta.workflow_definition = self.workflow.__class__
|
|
190
|
+
self._span_link_info = (
|
|
191
|
+
load_state_result.previous_trace_id,
|
|
192
|
+
load_state_result.previous_span_id,
|
|
193
|
+
load_state_result.root_trace_id,
|
|
194
|
+
load_state_result.root_span_id,
|
|
195
|
+
)
|
|
196
|
+
resolver_failed = False
|
|
197
|
+
break
|
|
198
|
+
except Exception as e:
|
|
199
|
+
logger.warning(f"Failed to load state from resolver {type(resolver).__name__}: {e}")
|
|
200
|
+
continue
|
|
201
|
+
|
|
202
|
+
if resolver_failed:
|
|
203
|
+
raise WorkflowInitializationException(
|
|
204
|
+
message=f"All resolvers failed to load initial state for execution ID: {previous_execution_id}",
|
|
205
|
+
workflow_definition=self.workflow.__class__,
|
|
206
|
+
code=WorkflowErrorCode.INVALID_INPUTS,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
self._entrypoints = self.workflow.get_entrypoints()
|
|
210
|
+
elif trigger:
|
|
211
|
+
# When trigger is provided, set up default state and filter entrypoints by trigger type
|
|
212
|
+
normalized_inputs = deepcopy(inputs) if inputs else self.workflow.get_default_inputs()
|
|
213
|
+
if state:
|
|
214
|
+
self._initial_state = deepcopy(state)
|
|
215
|
+
self._initial_state.meta.workflow_inputs = normalized_inputs
|
|
216
|
+
self._initial_state.meta.span_id = execution_id or uuid4()
|
|
217
|
+
self._initial_state.meta.workflow_definition = self.workflow.__class__
|
|
218
|
+
else:
|
|
219
|
+
self._initial_state = self.workflow.get_default_state(normalized_inputs, execution_id)
|
|
220
|
+
self._should_emit_initial_state = False
|
|
221
|
+
|
|
222
|
+
# Validate and bind trigger, then filter entrypoints
|
|
223
|
+
self._validate_and_bind_trigger(trigger)
|
|
224
|
+
self._entrypoints = self.workflow.get_entrypoints()
|
|
225
|
+
self._filter_entrypoints_for_trigger(trigger)
|
|
123
226
|
else:
|
|
227
|
+
# Default case: no entrypoint overrides and no trigger
|
|
124
228
|
normalized_inputs = deepcopy(inputs) if inputs else self.workflow.get_default_inputs()
|
|
125
229
|
if state:
|
|
126
230
|
self._initial_state = deepcopy(state)
|
|
127
231
|
self._initial_state.meta.workflow_inputs = normalized_inputs
|
|
128
|
-
self._initial_state.meta.span_id = uuid4()
|
|
232
|
+
self._initial_state.meta.span_id = execution_id or uuid4()
|
|
233
|
+
self._initial_state.meta.workflow_definition = self.workflow.__class__
|
|
129
234
|
else:
|
|
130
|
-
self._initial_state = self.workflow.get_default_state(normalized_inputs)
|
|
235
|
+
self._initial_state = self.workflow.get_default_state(normalized_inputs, execution_id)
|
|
131
236
|
# We don't want to emit the initial state on the base case of Workflow Runs, since
|
|
132
237
|
# all of that data is redundant and is derivable. It also clearly communicates that
|
|
133
238
|
# there was no initial state provided by the user to invoke the workflow.
|
|
134
239
|
self._should_emit_initial_state = False
|
|
135
240
|
self._entrypoints = self.workflow.get_entrypoints()
|
|
136
241
|
|
|
242
|
+
# Check if workflow requires a trigger but none was provided
|
|
243
|
+
self._validate_no_trigger_provided()
|
|
244
|
+
|
|
137
245
|
# This queue is responsible for sending events from WorkflowRunner to the outside world
|
|
138
246
|
self._workflow_event_outer_queue: Queue[WorkflowEvent] = Queue()
|
|
139
247
|
|
|
@@ -141,7 +249,7 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
141
249
|
self._workflow_event_inner_queue: Queue[WorkflowEvent] = Queue()
|
|
142
250
|
|
|
143
251
|
self._max_concurrency = max_concurrency
|
|
144
|
-
self._concurrency_queue: Queue[Tuple[StateType, Type[BaseNode], Optional[
|
|
252
|
+
self._concurrency_queue: Queue[Tuple[StateType, Type[BaseNode], Optional[UUID]]] = Queue()
|
|
145
253
|
|
|
146
254
|
# This queue is responsible for sending events from WorkflowRunner to the background thread
|
|
147
255
|
# for user defined emitters
|
|
@@ -152,17 +260,165 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
152
260
|
|
|
153
261
|
self._active_nodes_by_execution_id: Dict[UUID, ActiveNode[StateType]] = {}
|
|
154
262
|
self._cancel_signal = cancel_signal
|
|
263
|
+
self._timeout = timeout
|
|
155
264
|
self._execution_context = init_execution_context or get_execution_context()
|
|
265
|
+
self._trigger = trigger
|
|
156
266
|
|
|
157
267
|
setattr(
|
|
158
268
|
self._initial_state,
|
|
159
269
|
"__snapshot_callback__",
|
|
160
|
-
lambda s: self._snapshot_state(s),
|
|
270
|
+
lambda s, d: self._snapshot_state(s, d),
|
|
161
271
|
)
|
|
162
272
|
self.workflow.context._register_event_queue(self._workflow_event_inner_queue)
|
|
163
273
|
self.workflow.context._register_node_output_mocks(node_output_mocks or [])
|
|
164
274
|
|
|
165
|
-
|
|
275
|
+
self._outputs_listening_to_state = [
|
|
276
|
+
descriptor for descriptor in self.workflow.Outputs if isinstance(descriptor.instance, StateValueReference)
|
|
277
|
+
]
|
|
278
|
+
|
|
279
|
+
self._background_thread: Optional[Thread] = None
|
|
280
|
+
self._cancel_thread: Optional[Thread] = None
|
|
281
|
+
self._timeout_thread: Optional[Thread] = None
|
|
282
|
+
|
|
283
|
+
def _has_manual_trigger(self) -> bool:
|
|
284
|
+
"""Check if workflow has ManualTrigger."""
|
|
285
|
+
for subgraph in self.workflow.get_subgraphs():
|
|
286
|
+
for trigger in subgraph.triggers:
|
|
287
|
+
if issubclass(trigger, ManualTrigger):
|
|
288
|
+
return True
|
|
289
|
+
return False
|
|
290
|
+
|
|
291
|
+
def _get_entrypoints_for_trigger_type(self, trigger_class: Type) -> List[Type[BaseNode]]:
|
|
292
|
+
"""Get all entrypoints connected to a specific trigger type.
|
|
293
|
+
|
|
294
|
+
Allows subclasses: if trigger_class is a subclass of any declared trigger,
|
|
295
|
+
returns those entrypoints.
|
|
296
|
+
"""
|
|
297
|
+
entrypoints: List[Type[BaseNode]] = []
|
|
298
|
+
for subgraph in self.workflow.get_subgraphs():
|
|
299
|
+
for trigger in subgraph.triggers:
|
|
300
|
+
# Check if the provided trigger_class is a subclass of the declared trigger
|
|
301
|
+
# This allows runtime instances to be subclasses of what's declared in the workflow
|
|
302
|
+
if issubclass(trigger_class, trigger):
|
|
303
|
+
entrypoints.extend(subgraph.entrypoints)
|
|
304
|
+
return entrypoints
|
|
305
|
+
|
|
306
|
+
def _validate_and_bind_trigger(self, trigger: BaseTrigger) -> None:
|
|
307
|
+
"""
|
|
308
|
+
Validate that trigger is compatible with workflow and bind it to state.
|
|
309
|
+
|
|
310
|
+
Supports all trigger types derived from BaseTrigger:
|
|
311
|
+
- IntegrationTrigger instances (Slack, Gmail, etc.)
|
|
312
|
+
- ManualTrigger instances (explicit manual execution)
|
|
313
|
+
- ScheduledTrigger instances (time-based triggers)
|
|
314
|
+
- Any future trigger types
|
|
315
|
+
|
|
316
|
+
Raises:
|
|
317
|
+
WorkflowInitializationException: If trigger type is not compatible with workflow
|
|
318
|
+
"""
|
|
319
|
+
trigger_class = type(trigger)
|
|
320
|
+
|
|
321
|
+
# Search for a compatible trigger type in the workflow
|
|
322
|
+
found_compatible_trigger = False
|
|
323
|
+
has_any_triggers = False
|
|
324
|
+
incompatible_trigger_names: List[str] = []
|
|
325
|
+
|
|
326
|
+
for subgraph in self.workflow.get_subgraphs():
|
|
327
|
+
for declared_trigger in subgraph.triggers:
|
|
328
|
+
has_any_triggers = True
|
|
329
|
+
# Allow subclasses: if workflow declares BaseSlackTrigger, accept SpecificSlackTrigger instances
|
|
330
|
+
if issubclass(trigger_class, declared_trigger):
|
|
331
|
+
found_compatible_trigger = True
|
|
332
|
+
break
|
|
333
|
+
else:
|
|
334
|
+
incompatible_trigger_names.append(declared_trigger.__name__)
|
|
335
|
+
|
|
336
|
+
if found_compatible_trigger:
|
|
337
|
+
break
|
|
338
|
+
|
|
339
|
+
# Special case: workflows with no explicit triggers implicitly support ManualTrigger
|
|
340
|
+
if not has_any_triggers and not isinstance(trigger, ManualTrigger):
|
|
341
|
+
raise WorkflowInitializationException(
|
|
342
|
+
message=f"Provided trigger type {trigger_class.__name__} is not compatible with workflow. "
|
|
343
|
+
f"Workflow has no explicit triggers and only supports ManualTrigger.",
|
|
344
|
+
workflow_definition=self.workflow.__class__,
|
|
345
|
+
code=WorkflowErrorCode.INVALID_INPUTS,
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
# Validate that we found a compatible trigger type
|
|
349
|
+
if has_any_triggers and not found_compatible_trigger:
|
|
350
|
+
raise WorkflowInitializationException(
|
|
351
|
+
message=f"Provided trigger type {trigger_class.__name__} is not compatible with workflow triggers. "
|
|
352
|
+
f"Workflow has: {sorted(set(incompatible_trigger_names))}",
|
|
353
|
+
workflow_definition=self.workflow.__class__,
|
|
354
|
+
code=WorkflowErrorCode.INVALID_INPUTS,
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
# Bind trigger to state (works for all trigger types via BaseTrigger.bind_to_state)
|
|
358
|
+
trigger.bind_to_state(self._initial_state)
|
|
359
|
+
|
|
360
|
+
def _filter_entrypoints_for_trigger(self, trigger: BaseTrigger) -> None:
|
|
361
|
+
"""
|
|
362
|
+
Filter entrypoints to those connected to the specific trigger type.
|
|
363
|
+
|
|
364
|
+
Uses the specific trigger subclass, not the parent class, allowing workflows
|
|
365
|
+
with multiple triggers to route to the correct path.
|
|
366
|
+
"""
|
|
367
|
+
trigger_class = type(trigger)
|
|
368
|
+
specific_entrypoints = self._get_entrypoints_for_trigger_type(trigger_class)
|
|
369
|
+
if specific_entrypoints:
|
|
370
|
+
self._entrypoints = specific_entrypoints
|
|
371
|
+
|
|
372
|
+
def _validate_no_trigger_provided(self) -> None:
|
|
373
|
+
"""
|
|
374
|
+
Validate that workflow can run without a trigger.
|
|
375
|
+
|
|
376
|
+
If workflow has IntegrationTrigger(s) but no ManualTrigger, it requires a trigger instance.
|
|
377
|
+
If workflow has both, filter entrypoints to ManualTrigger path only.
|
|
378
|
+
|
|
379
|
+
Raises:
|
|
380
|
+
WorkflowInitializationException: If workflow requires trigger but none was provided
|
|
381
|
+
"""
|
|
382
|
+
# Collect all IntegrationTrigger types in the workflow
|
|
383
|
+
workflow_integration_triggers = []
|
|
384
|
+
for subgraph in self.workflow.get_subgraphs():
|
|
385
|
+
for trigger_type in subgraph.triggers:
|
|
386
|
+
if issubclass(trigger_type, IntegrationTrigger):
|
|
387
|
+
workflow_integration_triggers.append(trigger_type)
|
|
388
|
+
|
|
389
|
+
@contextmanager
|
|
390
|
+
def _httpx_logger_with_span_id(self) -> Iterator[None]:
|
|
391
|
+
"""
|
|
392
|
+
Context manager to append the current execution's span ID to httpx logger messages.
|
|
393
|
+
|
|
394
|
+
This is used when making API requests via the Vellum client to include
|
|
395
|
+
the execution's span ID in the httpx request logs for better traceability.
|
|
396
|
+
"""
|
|
397
|
+
httpx_logger = logging.getLogger("httpx")
|
|
398
|
+
|
|
399
|
+
class SpanIdFilter(logging.Filter):
|
|
400
|
+
def filter(self, record: logging.LogRecord) -> bool:
|
|
401
|
+
if record.name == "httpx" and "[span_id=" not in record.msg:
|
|
402
|
+
context = get_execution_context()
|
|
403
|
+
if context.parent_context:
|
|
404
|
+
span_id = str(context.parent_context.span_id)
|
|
405
|
+
record.msg = f"{record.msg} [span_id={span_id}]"
|
|
406
|
+
return True
|
|
407
|
+
|
|
408
|
+
span_filter = SpanIdFilter()
|
|
409
|
+
httpx_logger.addFilter(span_filter)
|
|
410
|
+
|
|
411
|
+
try:
|
|
412
|
+
yield
|
|
413
|
+
finally:
|
|
414
|
+
httpx_logger.removeFilter(span_filter)
|
|
415
|
+
|
|
416
|
+
def _snapshot_state(self, state: StateType, deltas: List[StateDelta]) -> StateType:
|
|
417
|
+
execution = get_execution_context()
|
|
418
|
+
edited_by = None
|
|
419
|
+
if execution.parent_context and hasattr(execution.parent_context, "node_definition"):
|
|
420
|
+
edited_by = execution.parent_context.node_definition
|
|
421
|
+
|
|
166
422
|
self._workflow_event_inner_queue.put(
|
|
167
423
|
WorkflowExecutionSnapshottedEvent(
|
|
168
424
|
trace_id=self._execution_context.trace_id,
|
|
@@ -170,10 +426,36 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
170
426
|
body=WorkflowExecutionSnapshottedBody(
|
|
171
427
|
workflow_definition=self.workflow.__class__,
|
|
172
428
|
state=state,
|
|
429
|
+
edited_by=edited_by,
|
|
173
430
|
),
|
|
174
431
|
parent=self._execution_context.parent_context,
|
|
175
432
|
)
|
|
176
433
|
)
|
|
434
|
+
|
|
435
|
+
delta_names = [d.name for d in deltas]
|
|
436
|
+
for descriptor in self._outputs_listening_to_state:
|
|
437
|
+
if not isinstance(descriptor.instance, StateValueReference):
|
|
438
|
+
continue
|
|
439
|
+
|
|
440
|
+
if descriptor.instance.name not in delta_names:
|
|
441
|
+
continue
|
|
442
|
+
|
|
443
|
+
resolved_delta = descriptor.instance.resolve(state)
|
|
444
|
+
if resolved_delta is undefined:
|
|
445
|
+
continue
|
|
446
|
+
|
|
447
|
+
self._workflow_event_outer_queue.put(
|
|
448
|
+
self._stream_workflow_event(
|
|
449
|
+
BaseOutput(
|
|
450
|
+
name=descriptor.name,
|
|
451
|
+
# We may want to switch this to using the delta from the state delta
|
|
452
|
+
# instead of the state value. In the short term, we need to show
|
|
453
|
+
# the full conversation of the tool calling node's delta's.
|
|
454
|
+
delta=resolved_delta,
|
|
455
|
+
)
|
|
456
|
+
)
|
|
457
|
+
)
|
|
458
|
+
|
|
177
459
|
self.workflow._store.append_state_snapshot(state)
|
|
178
460
|
self._background_thread_queue.put(state)
|
|
179
461
|
return state
|
|
@@ -184,17 +466,36 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
184
466
|
return event
|
|
185
467
|
|
|
186
468
|
def _run_work_item(self, node: BaseNode[StateType], span_id: UUID) -> None:
|
|
469
|
+
for event in self.run_node(node, span_id):
|
|
470
|
+
self._workflow_event_inner_queue.put(event)
|
|
471
|
+
|
|
472
|
+
def run_node(
|
|
473
|
+
self,
|
|
474
|
+
node: "BaseNode[StateType]",
|
|
475
|
+
span_id: UUID,
|
|
476
|
+
) -> Generator[NodeEvent, None, None]:
|
|
477
|
+
"""
|
|
478
|
+
Execute a single node and yield workflow events.
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
node: The node instance to execute
|
|
482
|
+
span_id: Unique identifier for this node execution
|
|
483
|
+
|
|
484
|
+
Yields:
|
|
485
|
+
NodeExecutionEvent: Events emitted during node execution (initiated, streaming, fulfilled, rejected)
|
|
486
|
+
"""
|
|
187
487
|
execution = get_execution_context()
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
)
|
|
488
|
+
|
|
489
|
+
node_output_mocks_map = self.workflow.context.node_output_mocks_map
|
|
490
|
+
|
|
491
|
+
yield NodeExecutionInitiatedEvent(
|
|
492
|
+
trace_id=execution.trace_id,
|
|
493
|
+
span_id=span_id,
|
|
494
|
+
body=NodeExecutionInitiatedBody(
|
|
495
|
+
node_definition=node.__class__,
|
|
496
|
+
inputs=node._inputs,
|
|
497
|
+
),
|
|
498
|
+
parent=execution.parent_context,
|
|
198
499
|
)
|
|
199
500
|
|
|
200
501
|
logger.debug(f"Started running node: {node.__class__.__name__}")
|
|
@@ -207,7 +508,7 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
207
508
|
)
|
|
208
509
|
node_run_response: NodeRunResponse
|
|
209
510
|
was_mocked: Optional[bool] = None
|
|
210
|
-
mock_candidates =
|
|
511
|
+
mock_candidates = node_output_mocks_map.get(node.Outputs) or []
|
|
211
512
|
for mock_candidate in mock_candidates:
|
|
212
513
|
if mock_candidate.when_condition.resolve(node.state):
|
|
213
514
|
node_run_response = mock_candidate.then_outputs
|
|
@@ -237,8 +538,9 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
237
538
|
streaming_output_queues: Dict[str, Queue] = {}
|
|
238
539
|
outputs = node.Outputs()
|
|
239
540
|
|
|
240
|
-
def initiate_node_streaming_output(
|
|
241
|
-
|
|
541
|
+
def initiate_node_streaming_output(
|
|
542
|
+
output: BaseOutput,
|
|
543
|
+
) -> Generator[NodeExecutionStreamingEvent, None, None]:
|
|
242
544
|
streaming_output_queues[output.name] = Queue()
|
|
243
545
|
output_descriptor = OutputReference(
|
|
244
546
|
name=output.name,
|
|
@@ -250,130 +552,152 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
250
552
|
node.state.meta.node_outputs[output_descriptor] = streaming_output_queues[output.name]
|
|
251
553
|
initiated_output: BaseOutput = BaseOutput(name=output.name)
|
|
252
554
|
initiated_ports = initiated_output > ports
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
invoked_ports=initiated_ports,
|
|
261
|
-
),
|
|
262
|
-
parent=execution.parent_context,
|
|
555
|
+
yield NodeExecutionStreamingEvent(
|
|
556
|
+
trace_id=execution.trace_id,
|
|
557
|
+
span_id=span_id,
|
|
558
|
+
body=NodeExecutionStreamingBody(
|
|
559
|
+
node_definition=node.__class__,
|
|
560
|
+
output=initiated_output,
|
|
561
|
+
invoked_ports=initiated_ports,
|
|
263
562
|
),
|
|
563
|
+
parent=execution.parent_context,
|
|
264
564
|
)
|
|
265
565
|
|
|
266
566
|
with execution_context(parent_context=updated_parent_context, trace_id=execution.trace_id):
|
|
267
567
|
for output in node_run_response:
|
|
268
568
|
invoked_ports = output > ports
|
|
269
569
|
if output.is_initiated:
|
|
270
|
-
initiate_node_streaming_output(output)
|
|
570
|
+
yield from initiate_node_streaming_output(output)
|
|
271
571
|
elif output.is_streaming:
|
|
272
572
|
if output.name not in streaming_output_queues:
|
|
273
|
-
initiate_node_streaming_output(output)
|
|
573
|
+
yield from initiate_node_streaming_output(output)
|
|
274
574
|
|
|
275
575
|
streaming_output_queues[output.name].put(output.delta)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
invoked_ports=invoked_ports,
|
|
284
|
-
),
|
|
285
|
-
parent=execution.parent_context,
|
|
576
|
+
yield NodeExecutionStreamingEvent(
|
|
577
|
+
trace_id=execution.trace_id,
|
|
578
|
+
span_id=span_id,
|
|
579
|
+
body=NodeExecutionStreamingBody(
|
|
580
|
+
node_definition=node.__class__,
|
|
581
|
+
output=output,
|
|
582
|
+
invoked_ports=invoked_ports,
|
|
286
583
|
),
|
|
584
|
+
parent=execution.parent_context,
|
|
287
585
|
)
|
|
288
586
|
elif output.is_fulfilled:
|
|
289
587
|
if output.name in streaming_output_queues:
|
|
290
588
|
streaming_output_queues[output.name].put(undefined)
|
|
291
589
|
|
|
292
590
|
setattr(outputs, output.name, output.value)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
parent=execution.parent_context,
|
|
303
|
-
)
|
|
591
|
+
yield NodeExecutionStreamingEvent(
|
|
592
|
+
trace_id=execution.trace_id,
|
|
593
|
+
span_id=span_id,
|
|
594
|
+
body=NodeExecutionStreamingBody(
|
|
595
|
+
node_definition=node.__class__,
|
|
596
|
+
output=output,
|
|
597
|
+
invoked_ports=invoked_ports,
|
|
598
|
+
),
|
|
599
|
+
parent=execution.parent_context,
|
|
304
600
|
)
|
|
305
601
|
|
|
306
602
|
node.state.meta.node_execution_cache.fulfill_node_execution(node.__class__, span_id)
|
|
307
603
|
|
|
308
|
-
with
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
604
|
+
with execution_context(parent_context=updated_parent_context, trace_id=execution.trace_id):
|
|
605
|
+
with node.state.__atomic__():
|
|
606
|
+
for descriptor, output_value in outputs:
|
|
607
|
+
if output_value is undefined:
|
|
608
|
+
if descriptor in node.state.meta.node_outputs:
|
|
609
|
+
del node.state.meta.node_outputs[descriptor]
|
|
610
|
+
continue
|
|
611
|
+
node.state.meta.node_outputs[descriptor] = output_value
|
|
316
612
|
|
|
317
613
|
invoked_ports = ports(outputs, node.state)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
parent=execution.parent_context,
|
|
329
|
-
)
|
|
614
|
+
yield NodeExecutionFulfilledEvent(
|
|
615
|
+
trace_id=execution.trace_id,
|
|
616
|
+
span_id=span_id,
|
|
617
|
+
body=NodeExecutionFulfilledBody(
|
|
618
|
+
node_definition=node.__class__,
|
|
619
|
+
outputs=outputs,
|
|
620
|
+
invoked_ports=invoked_ports,
|
|
621
|
+
mocked=was_mocked,
|
|
622
|
+
),
|
|
623
|
+
parent=execution.parent_context,
|
|
330
624
|
)
|
|
331
625
|
except NodeException as e:
|
|
332
|
-
|
|
333
|
-
self._workflow_event_inner_queue.put(
|
|
334
|
-
NodeExecutionRejectedEvent(
|
|
335
|
-
trace_id=execution.trace_id,
|
|
336
|
-
span_id=span_id,
|
|
337
|
-
body=NodeExecutionRejectedBody(
|
|
338
|
-
node_definition=node.__class__,
|
|
339
|
-
error=e.error,
|
|
340
|
-
),
|
|
341
|
-
parent=execution.parent_context,
|
|
342
|
-
)
|
|
343
|
-
)
|
|
626
|
+
yield self._handle_run_node_exception(e, "Node Exception", execution, span_id, node)
|
|
344
627
|
except WorkflowInitializationException as e:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
trace_id=execution.trace_id,
|
|
349
|
-
span_id=span_id,
|
|
350
|
-
body=NodeExecutionRejectedBody(
|
|
351
|
-
node_definition=node.__class__,
|
|
352
|
-
error=e.error,
|
|
353
|
-
),
|
|
354
|
-
parent=execution.parent_context,
|
|
355
|
-
)
|
|
356
|
-
)
|
|
628
|
+
yield self._handle_run_node_exception(e, "Workflow Initialization Exception", execution, span_id, node)
|
|
629
|
+
except InvalidExpressionException as e:
|
|
630
|
+
yield self._handle_run_node_exception(e, "Invalid Expression Exception", execution, span_id, node)
|
|
357
631
|
except Exception as e:
|
|
358
|
-
|
|
632
|
+
error_message = self._parse_error_message(e)
|
|
633
|
+
captured_stacktrace = traceback.format_exc()
|
|
634
|
+
if error_message is None:
|
|
635
|
+
logger.exception(f"An unexpected error occurred while running node {node.__class__.__name__}")
|
|
636
|
+
error_code = WorkflowErrorCode.INTERNAL_ERROR
|
|
637
|
+
error_message = "Internal error"
|
|
638
|
+
else:
|
|
639
|
+
error_code = WorkflowErrorCode.NODE_EXECUTION
|
|
359
640
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
code=WorkflowErrorCode.INTERNAL_ERROR,
|
|
369
|
-
),
|
|
641
|
+
yield NodeExecutionRejectedEvent(
|
|
642
|
+
trace_id=execution.trace_id,
|
|
643
|
+
span_id=span_id,
|
|
644
|
+
body=NodeExecutionRejectedBody(
|
|
645
|
+
node_definition=node.__class__,
|
|
646
|
+
error=WorkflowError(
|
|
647
|
+
message=error_message,
|
|
648
|
+
code=error_code,
|
|
370
649
|
),
|
|
371
|
-
|
|
650
|
+
stacktrace=captured_stacktrace,
|
|
372
651
|
),
|
|
652
|
+
parent=execution.parent_context,
|
|
373
653
|
)
|
|
374
654
|
|
|
375
655
|
logger.debug(f"Finished running node: {node.__class__.__name__}")
|
|
376
656
|
|
|
657
|
+
def _handle_run_node_exception(
|
|
658
|
+
self,
|
|
659
|
+
exception: Union[NodeException, WorkflowInitializationException, InvalidExpressionException],
|
|
660
|
+
prefix: str,
|
|
661
|
+
execution: ExecutionContext,
|
|
662
|
+
span_id: UUID,
|
|
663
|
+
node: BaseNode[StateType],
|
|
664
|
+
) -> NodeExecutionRejectedEvent:
|
|
665
|
+
logger.info(f"{prefix}: {exception}")
|
|
666
|
+
captured_stacktrace = traceback.format_exc()
|
|
667
|
+
|
|
668
|
+
return NodeExecutionRejectedEvent(
|
|
669
|
+
trace_id=execution.trace_id,
|
|
670
|
+
span_id=span_id,
|
|
671
|
+
body=NodeExecutionRejectedBody(
|
|
672
|
+
node_definition=node.__class__,
|
|
673
|
+
error=exception.error,
|
|
674
|
+
stacktrace=captured_stacktrace,
|
|
675
|
+
),
|
|
676
|
+
parent=execution.parent_context,
|
|
677
|
+
)
|
|
678
|
+
|
|
679
|
+
def _parse_error_message(self, exception: Exception) -> Optional[str]:
|
|
680
|
+
try:
|
|
681
|
+
_, _, tb = sys.exc_info()
|
|
682
|
+
if tb:
|
|
683
|
+
tb_list = traceback.extract_tb(tb)
|
|
684
|
+
if tb_list:
|
|
685
|
+
for frame in reversed(tb_list):
|
|
686
|
+
exception_module = next(
|
|
687
|
+
(
|
|
688
|
+
mod.__name__
|
|
689
|
+
for mod in sys.modules.values()
|
|
690
|
+
if hasattr(mod, "__file__") and mod.__file__ == frame.filename
|
|
691
|
+
),
|
|
692
|
+
None,
|
|
693
|
+
)
|
|
694
|
+
if exception_module and not exception_module.startswith("vellum."):
|
|
695
|
+
return str(exception)
|
|
696
|
+
except Exception:
|
|
697
|
+
pass
|
|
698
|
+
|
|
699
|
+
return None
|
|
700
|
+
|
|
377
701
|
def _context_run_work_item(
|
|
378
702
|
self,
|
|
379
703
|
node: BaseNode[StateType],
|
|
@@ -387,7 +711,12 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
387
711
|
):
|
|
388
712
|
self._run_work_item(node, span_id)
|
|
389
713
|
|
|
390
|
-
def _handle_invoked_ports(
|
|
714
|
+
def _handle_invoked_ports(
|
|
715
|
+
self,
|
|
716
|
+
state: StateType,
|
|
717
|
+
ports: Optional[Iterable[Port]],
|
|
718
|
+
invoked_by: Optional[UUID],
|
|
719
|
+
) -> None:
|
|
391
720
|
if not ports:
|
|
392
721
|
return
|
|
393
722
|
|
|
@@ -400,9 +729,9 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
400
729
|
next_state = state
|
|
401
730
|
|
|
402
731
|
if self._max_concurrency:
|
|
403
|
-
self._concurrency_queue.put((next_state, edge.to_node,
|
|
732
|
+
self._concurrency_queue.put((next_state, edge.to_node, invoked_by))
|
|
404
733
|
else:
|
|
405
|
-
self._run_node_if_ready(next_state, edge.to_node,
|
|
734
|
+
self._run_node_if_ready(next_state, edge.to_node, invoked_by)
|
|
406
735
|
|
|
407
736
|
if self._max_concurrency:
|
|
408
737
|
num_nodes_to_run = self._max_concurrency - len(self._active_nodes_by_execution_id)
|
|
@@ -410,14 +739,14 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
410
739
|
if self._concurrency_queue.empty():
|
|
411
740
|
break
|
|
412
741
|
|
|
413
|
-
next_state, node_class,
|
|
414
|
-
self._run_node_if_ready(next_state, node_class,
|
|
742
|
+
next_state, node_class, invoked_by = self._concurrency_queue.get()
|
|
743
|
+
self._run_node_if_ready(next_state, node_class, invoked_by)
|
|
415
744
|
|
|
416
745
|
def _run_node_if_ready(
|
|
417
746
|
self,
|
|
418
747
|
state: StateType,
|
|
419
748
|
node_class: Type[BaseNode],
|
|
420
|
-
invoked_by: Optional[
|
|
749
|
+
invoked_by: Optional[UUID] = None,
|
|
421
750
|
) -> None:
|
|
422
751
|
with state.__lock__:
|
|
423
752
|
for descriptor in node_class.ExternalInputs:
|
|
@@ -429,9 +758,25 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
429
758
|
return
|
|
430
759
|
|
|
431
760
|
all_deps = self._dependencies[node_class]
|
|
432
|
-
node_span_id =
|
|
433
|
-
|
|
434
|
-
|
|
761
|
+
node_span_id = node_class.Trigger._queue_node_execution(state, all_deps, invoked_by)
|
|
762
|
+
|
|
763
|
+
try:
|
|
764
|
+
if not node_class.Trigger.should_initiate(state, all_deps, node_span_id):
|
|
765
|
+
return
|
|
766
|
+
except NodeException as e:
|
|
767
|
+
execution = get_execution_context()
|
|
768
|
+
|
|
769
|
+
self._workflow_event_outer_queue.put(
|
|
770
|
+
WorkflowExecutionRejectedEvent(
|
|
771
|
+
trace_id=execution.trace_id,
|
|
772
|
+
span_id=node_span_id,
|
|
773
|
+
body=WorkflowExecutionRejectedBody(
|
|
774
|
+
workflow_definition=self.workflow.__class__,
|
|
775
|
+
error=e.error,
|
|
776
|
+
),
|
|
777
|
+
)
|
|
778
|
+
)
|
|
779
|
+
raise e
|
|
435
780
|
|
|
436
781
|
execution = get_execution_context()
|
|
437
782
|
node = node_class(state=state, context=self.workflow.context)
|
|
@@ -449,7 +794,7 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
449
794
|
)
|
|
450
795
|
worker_thread.start()
|
|
451
796
|
|
|
452
|
-
def _handle_work_item_event(self, event: WorkflowEvent) -> Optional[
|
|
797
|
+
def _handle_work_item_event(self, event: WorkflowEvent) -> Optional[NodeExecutionRejectedEvent]:
|
|
453
798
|
active_node = self._active_nodes_by_execution_id.get(event.span_id)
|
|
454
799
|
if not active_node:
|
|
455
800
|
return None
|
|
@@ -457,10 +802,23 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
457
802
|
node = active_node.node
|
|
458
803
|
if event.name == "node.execution.rejected":
|
|
459
804
|
self._active_nodes_by_execution_id.pop(event.span_id)
|
|
460
|
-
return event
|
|
805
|
+
return event
|
|
461
806
|
|
|
462
807
|
if event.name == "node.execution.streaming":
|
|
463
808
|
for workflow_output_descriptor in self.workflow.Outputs:
|
|
809
|
+
if node.__directly_emit_workflow_output__(event, workflow_output_descriptor):
|
|
810
|
+
active_node.was_outputs_streamed = True
|
|
811
|
+
self._workflow_event_outer_queue.put(
|
|
812
|
+
self._stream_workflow_event(
|
|
813
|
+
BaseOutput(
|
|
814
|
+
name=workflow_output_descriptor.name,
|
|
815
|
+
value=event.output.value,
|
|
816
|
+
delta=event.output.delta,
|
|
817
|
+
)
|
|
818
|
+
)
|
|
819
|
+
)
|
|
820
|
+
return None
|
|
821
|
+
|
|
464
822
|
node_output_descriptor = workflow_output_descriptor.instance
|
|
465
823
|
if not isinstance(node_output_descriptor, OutputReference):
|
|
466
824
|
continue
|
|
@@ -480,7 +838,7 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
480
838
|
)
|
|
481
839
|
)
|
|
482
840
|
|
|
483
|
-
self._handle_invoked_ports(node.state, event.invoked_ports)
|
|
841
|
+
self._handle_invoked_ports(node.state, event.invoked_ports, event.span_id)
|
|
484
842
|
|
|
485
843
|
return None
|
|
486
844
|
|
|
@@ -506,13 +864,73 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
506
864
|
)
|
|
507
865
|
)
|
|
508
866
|
|
|
509
|
-
self._handle_invoked_ports(node.state, event.invoked_ports)
|
|
867
|
+
self._handle_invoked_ports(node.state, event.invoked_ports, event.span_id)
|
|
510
868
|
|
|
511
869
|
return None
|
|
512
870
|
|
|
513
871
|
return None
|
|
514
872
|
|
|
873
|
+
def _emit_node_cancellation_events(
|
|
874
|
+
self,
|
|
875
|
+
error_message: str,
|
|
876
|
+
) -> None:
|
|
877
|
+
"""
|
|
878
|
+
Emit node cancellation events for all active nodes.
|
|
879
|
+
|
|
880
|
+
Args:
|
|
881
|
+
error_message: The error message to include in the cancellation events
|
|
882
|
+
"""
|
|
883
|
+
parent_context = WorkflowParentContext(
|
|
884
|
+
span_id=self._initial_state.meta.span_id,
|
|
885
|
+
workflow_definition=self.workflow.__class__,
|
|
886
|
+
parent=self._execution_context.parent_context,
|
|
887
|
+
)
|
|
888
|
+
captured_stacktrace = "".join(traceback.format_stack())
|
|
889
|
+
active_span_ids = list(self._active_nodes_by_execution_id.keys())
|
|
890
|
+
for span_id in active_span_ids:
|
|
891
|
+
active_node = self._active_nodes_by_execution_id.pop(span_id, None)
|
|
892
|
+
if active_node is not None:
|
|
893
|
+
active_node.node.__cancel__(error_message)
|
|
894
|
+
|
|
895
|
+
rejection_event = NodeExecutionRejectedEvent(
|
|
896
|
+
trace_id=self._execution_context.trace_id,
|
|
897
|
+
span_id=span_id,
|
|
898
|
+
body=NodeExecutionRejectedBody(
|
|
899
|
+
node_definition=active_node.node.__class__,
|
|
900
|
+
error=WorkflowError(
|
|
901
|
+
code=WorkflowErrorCode.NODE_CANCELLED,
|
|
902
|
+
message=error_message,
|
|
903
|
+
),
|
|
904
|
+
stacktrace=captured_stacktrace,
|
|
905
|
+
),
|
|
906
|
+
parent=parent_context,
|
|
907
|
+
)
|
|
908
|
+
self._workflow_event_outer_queue.put(rejection_event)
|
|
909
|
+
|
|
515
910
|
def _initiate_workflow_event(self) -> WorkflowExecutionInitiatedEvent:
|
|
911
|
+
links: Optional[List[SpanLink]] = None
|
|
912
|
+
|
|
913
|
+
if self._span_link_info:
|
|
914
|
+
previous_trace_id, previous_span_id, root_trace_id, root_span_id = self._span_link_info
|
|
915
|
+
links = [
|
|
916
|
+
SpanLink(
|
|
917
|
+
trace_id=previous_trace_id,
|
|
918
|
+
type="PREVIOUS_SPAN",
|
|
919
|
+
span_context=WorkflowParentContext(
|
|
920
|
+
workflow_definition=self.workflow.__class__,
|
|
921
|
+
span_id=previous_span_id,
|
|
922
|
+
),
|
|
923
|
+
),
|
|
924
|
+
SpanLink(
|
|
925
|
+
trace_id=root_trace_id,
|
|
926
|
+
type="ROOT_SPAN",
|
|
927
|
+
span_context=WorkflowParentContext(
|
|
928
|
+
workflow_definition=self.workflow.__class__,
|
|
929
|
+
span_id=root_span_id,
|
|
930
|
+
),
|
|
931
|
+
),
|
|
932
|
+
]
|
|
933
|
+
|
|
516
934
|
return WorkflowExecutionInitiatedEvent(
|
|
517
935
|
trace_id=self._execution_context.trace_id,
|
|
518
936
|
span_id=self._initial_state.meta.span_id,
|
|
@@ -520,8 +938,10 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
520
938
|
workflow_definition=self.workflow.__class__,
|
|
521
939
|
inputs=self._initial_state.meta.workflow_inputs,
|
|
522
940
|
initial_state=deepcopy(self._initial_state) if self._should_emit_initial_state else None,
|
|
941
|
+
trigger=self._trigger.__class__ if self._trigger else None,
|
|
523
942
|
),
|
|
524
943
|
parent=self._execution_context.parent_context,
|
|
944
|
+
links=links,
|
|
525
945
|
)
|
|
526
946
|
|
|
527
947
|
def _stream_workflow_event(self, output: BaseOutput) -> WorkflowExecutionStreamingEvent:
|
|
@@ -535,24 +955,36 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
535
955
|
parent=self._execution_context.parent_context,
|
|
536
956
|
)
|
|
537
957
|
|
|
538
|
-
def _fulfill_workflow_event(self, outputs: OutputsType) -> WorkflowExecutionFulfilledEvent:
|
|
958
|
+
def _fulfill_workflow_event(self, outputs: OutputsType, final_state: StateType) -> WorkflowExecutionFulfilledEvent:
|
|
539
959
|
return WorkflowExecutionFulfilledEvent(
|
|
540
960
|
trace_id=self._execution_context.trace_id,
|
|
541
961
|
span_id=self._initial_state.meta.span_id,
|
|
542
962
|
body=WorkflowExecutionFulfilledBody(
|
|
543
963
|
workflow_definition=self.workflow.__class__,
|
|
544
964
|
outputs=outputs,
|
|
965
|
+
final_state=final_state,
|
|
545
966
|
),
|
|
546
967
|
parent=self._execution_context.parent_context,
|
|
547
968
|
)
|
|
548
969
|
|
|
549
|
-
def _reject_workflow_event(
|
|
970
|
+
def _reject_workflow_event(
|
|
971
|
+
self, error: WorkflowError, captured_stacktrace: Optional[str] = None
|
|
972
|
+
) -> WorkflowExecutionRejectedEvent:
|
|
973
|
+
if captured_stacktrace is None:
|
|
974
|
+
try:
|
|
975
|
+
captured_stacktrace = traceback.format_exc()
|
|
976
|
+
if captured_stacktrace.strip() == "NoneType: None":
|
|
977
|
+
captured_stacktrace = None
|
|
978
|
+
except Exception:
|
|
979
|
+
pass
|
|
980
|
+
|
|
550
981
|
return WorkflowExecutionRejectedEvent(
|
|
551
982
|
trace_id=self._execution_context.trace_id,
|
|
552
983
|
span_id=self._initial_state.meta.span_id,
|
|
553
984
|
body=WorkflowExecutionRejectedBody(
|
|
554
985
|
workflow_definition=self.workflow.__class__,
|
|
555
986
|
error=error,
|
|
987
|
+
stacktrace=captured_stacktrace,
|
|
556
988
|
),
|
|
557
989
|
parent=self._execution_context.parent_context,
|
|
558
990
|
)
|
|
@@ -578,6 +1010,11 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
578
1010
|
parent=self._execution_context.parent_context,
|
|
579
1011
|
)
|
|
580
1012
|
|
|
1013
|
+
def _wrapped_stream(self) -> None:
|
|
1014
|
+
"""Wrapper for _stream that adds httpx logger span ID context."""
|
|
1015
|
+
with self._httpx_logger_with_span_id():
|
|
1016
|
+
self._stream()
|
|
1017
|
+
|
|
581
1018
|
def _stream(self) -> None:
|
|
582
1019
|
for edge in self.workflow.get_edges():
|
|
583
1020
|
self._dependencies[edge.to_node].add(edge.from_port.node_class)
|
|
@@ -596,22 +1033,26 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
596
1033
|
else:
|
|
597
1034
|
self._concurrency_queue.put((self._initial_state, node_cls, None))
|
|
598
1035
|
except NodeException as e:
|
|
599
|
-
|
|
1036
|
+
captured_stacktrace = traceback.format_exc()
|
|
1037
|
+
self._workflow_event_outer_queue.put(self._reject_workflow_event(e.error, captured_stacktrace))
|
|
600
1038
|
return
|
|
601
1039
|
except WorkflowInitializationException as e:
|
|
602
|
-
|
|
1040
|
+
captured_stacktrace = traceback.format_exc()
|
|
1041
|
+
self._workflow_event_outer_queue.put(self._reject_workflow_event(e.error, captured_stacktrace))
|
|
603
1042
|
return
|
|
604
1043
|
except Exception:
|
|
605
1044
|
err_message = f"An unexpected error occurred while initializing node {node_cls.__name__}"
|
|
606
1045
|
logger.exception(err_message)
|
|
1046
|
+
captured_stacktrace = traceback.format_exc()
|
|
607
1047
|
self._workflow_event_outer_queue.put(
|
|
608
1048
|
self._reject_workflow_event(
|
|
609
1049
|
WorkflowError(code=WorkflowErrorCode.INTERNAL_ERROR, message=err_message),
|
|
1050
|
+
captured_stacktrace,
|
|
610
1051
|
)
|
|
611
1052
|
)
|
|
612
1053
|
return
|
|
613
1054
|
|
|
614
|
-
|
|
1055
|
+
rejection_event: Optional[NodeExecutionRejectedEvent] = None
|
|
615
1056
|
|
|
616
1057
|
while True:
|
|
617
1058
|
if not self._active_nodes_by_execution_id:
|
|
@@ -622,9 +1063,13 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
622
1063
|
self._workflow_event_outer_queue.put(event)
|
|
623
1064
|
|
|
624
1065
|
with execution_context(parent_context=current_parent, trace_id=self._execution_context.trace_id):
|
|
625
|
-
|
|
1066
|
+
rejection_event = self._handle_work_item_event(event)
|
|
626
1067
|
|
|
627
|
-
if
|
|
1068
|
+
if rejection_event:
|
|
1069
|
+
failed_node_name = rejection_event.body.node_definition.__name__
|
|
1070
|
+
self._emit_node_cancellation_events(
|
|
1071
|
+
error_message=f"Node execution cancelled due to {failed_node_name} failure",
|
|
1072
|
+
)
|
|
628
1073
|
break
|
|
629
1074
|
|
|
630
1075
|
# Handle any remaining events
|
|
@@ -633,9 +1078,9 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
633
1078
|
self._workflow_event_outer_queue.put(event)
|
|
634
1079
|
|
|
635
1080
|
with execution_context(parent_context=current_parent, trace_id=self._execution_context.trace_id):
|
|
636
|
-
|
|
1081
|
+
rejection_event = self._handle_work_item_event(event)
|
|
637
1082
|
|
|
638
|
-
if
|
|
1083
|
+
if rejection_event:
|
|
639
1084
|
break
|
|
640
1085
|
except Empty:
|
|
641
1086
|
pass
|
|
@@ -655,8 +1100,10 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
655
1100
|
)
|
|
656
1101
|
return
|
|
657
1102
|
|
|
658
|
-
if
|
|
659
|
-
self._workflow_event_outer_queue.put(
|
|
1103
|
+
if rejection_event:
|
|
1104
|
+
self._workflow_event_outer_queue.put(
|
|
1105
|
+
self._reject_workflow_event(rejection_event.error, rejection_event.body.stacktrace)
|
|
1106
|
+
)
|
|
660
1107
|
return
|
|
661
1108
|
|
|
662
1109
|
fulfilled_outputs = self.workflow.Outputs()
|
|
@@ -670,7 +1117,7 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
670
1117
|
descriptor.instance.resolve(final_state),
|
|
671
1118
|
)
|
|
672
1119
|
|
|
673
|
-
self._workflow_event_outer_queue.put(self._fulfill_workflow_event(fulfilled_outputs))
|
|
1120
|
+
self._workflow_event_outer_queue.put(self._fulfill_workflow_event(fulfilled_outputs, final_state))
|
|
674
1121
|
|
|
675
1122
|
def _run_background_thread(self) -> None:
|
|
676
1123
|
state_class = self.workflow.get_state_class()
|
|
@@ -692,16 +1139,44 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
692
1139
|
|
|
693
1140
|
while not kill_switch.wait(timeout=0.1):
|
|
694
1141
|
if self._cancel_signal.is_set():
|
|
1142
|
+
self._emit_node_cancellation_events(
|
|
1143
|
+
error_message="Workflow run cancelled",
|
|
1144
|
+
)
|
|
1145
|
+
|
|
1146
|
+
captured_stacktrace = "".join(traceback.format_stack())
|
|
695
1147
|
self._workflow_event_outer_queue.put(
|
|
696
1148
|
self._reject_workflow_event(
|
|
697
1149
|
WorkflowError(
|
|
698
1150
|
code=WorkflowErrorCode.WORKFLOW_CANCELLED,
|
|
699
1151
|
message="Workflow run cancelled",
|
|
700
|
-
)
|
|
1152
|
+
),
|
|
1153
|
+
captured_stacktrace,
|
|
701
1154
|
)
|
|
702
1155
|
)
|
|
703
1156
|
return
|
|
704
1157
|
|
|
1158
|
+
def _run_timeout_thread(self, kill_switch: ThreadingEvent) -> None:
|
|
1159
|
+
if not self._timeout:
|
|
1160
|
+
return
|
|
1161
|
+
|
|
1162
|
+
if kill_switch.wait(timeout=self._timeout):
|
|
1163
|
+
return
|
|
1164
|
+
|
|
1165
|
+
self._emit_node_cancellation_events(
|
|
1166
|
+
error_message=f"Workflow execution exceeded timeout of {self._timeout} seconds",
|
|
1167
|
+
)
|
|
1168
|
+
|
|
1169
|
+
captured_stacktrace = "".join(traceback.format_stack())
|
|
1170
|
+
self._workflow_event_outer_queue.put(
|
|
1171
|
+
self._reject_workflow_event(
|
|
1172
|
+
WorkflowError(
|
|
1173
|
+
code=WorkflowErrorCode.WORKFLOW_TIMEOUT,
|
|
1174
|
+
message=f"Workflow execution exceeded timeout of {self._timeout} seconds",
|
|
1175
|
+
),
|
|
1176
|
+
captured_stacktrace,
|
|
1177
|
+
)
|
|
1178
|
+
)
|
|
1179
|
+
|
|
705
1180
|
def _is_terminal_event(self, event: WorkflowEvent) -> bool:
|
|
706
1181
|
if (
|
|
707
1182
|
event.name == "workflow.execution.fulfilled"
|
|
@@ -711,21 +1186,30 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
711
1186
|
return event.workflow_definition == self.workflow.__class__
|
|
712
1187
|
return False
|
|
713
1188
|
|
|
714
|
-
def
|
|
715
|
-
|
|
1189
|
+
def _generate_events(self) -> Generator[WorkflowEvent, None, None]:
|
|
1190
|
+
self._background_thread = Thread(
|
|
716
1191
|
target=self._run_background_thread,
|
|
717
1192
|
name=f"{self.workflow.__class__.__name__}.background_thread",
|
|
718
1193
|
)
|
|
719
|
-
|
|
1194
|
+
self._background_thread.start()
|
|
720
1195
|
|
|
721
1196
|
cancel_thread_kill_switch = ThreadingEvent()
|
|
722
1197
|
if self._cancel_signal:
|
|
723
|
-
|
|
1198
|
+
self._cancel_thread = Thread(
|
|
724
1199
|
target=self._run_cancel_thread,
|
|
725
1200
|
name=f"{self.workflow.__class__.__name__}.cancel_thread",
|
|
726
1201
|
kwargs={"kill_switch": cancel_thread_kill_switch},
|
|
727
1202
|
)
|
|
728
|
-
|
|
1203
|
+
self._cancel_thread.start()
|
|
1204
|
+
|
|
1205
|
+
timeout_thread_kill_switch = ThreadingEvent()
|
|
1206
|
+
if self._timeout:
|
|
1207
|
+
self._timeout_thread = Thread(
|
|
1208
|
+
target=self._run_timeout_thread,
|
|
1209
|
+
name=f"{self.workflow.__class__.__name__}.timeout_thread",
|
|
1210
|
+
kwargs={"kill_switch": timeout_thread_kill_switch},
|
|
1211
|
+
)
|
|
1212
|
+
self._timeout_thread.start()
|
|
729
1213
|
|
|
730
1214
|
event: WorkflowEvent
|
|
731
1215
|
if self._is_resuming:
|
|
@@ -736,13 +1220,13 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
736
1220
|
yield self._emit_event(event)
|
|
737
1221
|
|
|
738
1222
|
# The extra level of indirection prevents the runner from waiting on the caller to consume the event stream
|
|
739
|
-
|
|
740
|
-
target=self.
|
|
1223
|
+
self._stream_thread = Thread(
|
|
1224
|
+
target=self._wrapped_stream,
|
|
741
1225
|
name=f"{self.workflow.__class__.__name__}.stream_thread",
|
|
742
1226
|
)
|
|
743
|
-
|
|
1227
|
+
self._stream_thread.start()
|
|
744
1228
|
|
|
745
|
-
while
|
|
1229
|
+
while self._stream_thread.is_alive():
|
|
746
1230
|
try:
|
|
747
1231
|
event = self._workflow_event_outer_queue.get(timeout=0.1)
|
|
748
1232
|
except Empty:
|
|
@@ -769,3 +1253,24 @@ class WorkflowRunner(Generic[StateType]):
|
|
|
769
1253
|
|
|
770
1254
|
self._background_thread_queue.put(None)
|
|
771
1255
|
cancel_thread_kill_switch.set()
|
|
1256
|
+
timeout_thread_kill_switch.set()
|
|
1257
|
+
|
|
1258
|
+
def stream(self) -> WorkflowEventStream:
|
|
1259
|
+
return WorkflowEventGenerator(self._generate_events(), self._initial_state.meta.span_id)
|
|
1260
|
+
|
|
1261
|
+
def join(self) -> None:
|
|
1262
|
+
"""
|
|
1263
|
+
Wait for all background threads to complete.
|
|
1264
|
+
This ensures all pending work is finished before the runner terminates.
|
|
1265
|
+
"""
|
|
1266
|
+
if self._stream_thread and self._stream_thread.is_alive():
|
|
1267
|
+
self._stream_thread.join()
|
|
1268
|
+
|
|
1269
|
+
if self._background_thread and self._background_thread.is_alive():
|
|
1270
|
+
self._background_thread.join()
|
|
1271
|
+
|
|
1272
|
+
if self._cancel_thread and self._cancel_thread.is_alive():
|
|
1273
|
+
self._cancel_thread.join()
|
|
1274
|
+
|
|
1275
|
+
if self._timeout_thread and self._timeout_thread.is_alive():
|
|
1276
|
+
self._timeout_thread.join()
|