Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor: replace bare dict with dict[str, Any] in core tools and runtime (#35111)
wdeveloper160f643bca764d
diff --git a/api/core/indexing_runner.py b/api/core/indexing_runner.pyindex b8d5ca2f50f..9aaf85dc0fc 100644--- a/api/core/indexing_runner.py+++ b/api/core/indexing_runner.py@@ -735,7 +735,9 @@ class IndexingRunner:@staticmethoddef _update_document_index_status(- document_id: str, after_indexing_status: IndexingStatus, extra_update_params: dict | None = None+ document_id: str,+ after_indexing_status: IndexingStatus,+ extra_update_params: dict[Any, Any] | None = None,):"""Update the document indexing status.@@ -762,7 +764,7 @@ class IndexingRunner:db.session.commit()@staticmethod- def _update_segments_by_document(dataset_document_id: str, update_params: dict):+ def _update_segments_by_document(dataset_document_id: str, update_params: dict[Any, Any]):"""Update the document segment by document id."""diff --git a/api/core/llm_generator/output_parser/structured_output.py b/api/core/llm_generator/output_parser/structured_output.pyindex a1710f11ace..9bdca1e83b3 100644--- a/api/core/llm_generator/output_parser/structured_output.py+++ b/api/core/llm_generator/output_parser/structured_output.py@@ -200,7 +200,7 @@ def _handle_native_json_schema(provider: str,model_schema: AIModelEntity,structured_output_schema: Mapping,- model_parameters: dict,+ model_parameters: dict[str, Any],rules: list[ParameterRule],):"""@@ -224,7 +224,7 @@ def _handle_native_json_schema(return model_parameters-def _set_response_format(model_parameters: dict, rules: list):+def _set_response_format(model_parameters: dict[str, Any], rules: list[ParameterRule]):"""Set the appropriate response format parameter based on model rules.@@ -326,7 +326,7 @@ def _prepare_schema_for_model(provider: str, model_schema: AIModelEntity, schemareturn {"schema": processed_schema, "name": "llm_response"}-def remove_additional_properties(schema: dict):+def remove_additional_properties(schema: dict[str, Any]):"""Remove additionalProperties fields from JSON schema.Used for models like Gemini that don't support this property.diff --git a/api/core/tools/__base/tool.py b/api/core/tools/__base/tool.pyindex 7bb2cdb8764..ab0f73a9a22 100644--- a/api/core/tools/__base/tool.py+++ b/api/core/tools/__base/tool.py@@ -198,7 +198,7 @@ class Tool(ABC):message=ToolInvokeMessage.TextMessage(text=text),)- def create_blob_message(self, blob: bytes, meta: dict | None = None) -> ToolInvokeMessage:+ def create_blob_message(self, blob: bytes, meta: dict[str, Any] | None = None) -> ToolInvokeMessage:"""create a blob message@@ -212,7 +212,7 @@ class Tool(ABC):meta=meta,)- def create_json_message(self, object: dict, suppress_output: bool = False) -> ToolInvokeMessage:+ def create_json_message(self, object: dict[str, Any], suppress_output: bool = False) -> ToolInvokeMessage:"""create a json message"""diff --git a/api/core/tools/entities/tool_entities.py b/api/core/tools/entities/tool_entities.pyindex b4253652f99..0c77693dde4 100644--- a/api/core/tools/entities/tool_entities.py+++ b/api/core/tools/entities/tool_entities.py@@ -149,7 +149,7 @@ class ToolInvokeMessage(BaseModel):text: strclass JsonMessage(BaseModel):- json_object: dict | list+ json_object: dict[str, Any] | list[Any]suppress_output: bool = Field(default=False, description="Whether to suppress JSON output in result string")class BlobMessage(BaseModel):@@ -337,7 +337,7 @@ class ToolParameter(PluginParameter):form: ToolParameterForm = Field(..., description="The form of the parameter, schema/form/llm")llm_description: str | None = None# MCP object and array type parameters use this field to store the schema- input_schema: dict | None = None+ input_schema: dict[str, Any] | None = None@classmethoddef get_simple_instance(@@ -463,7 +463,7 @@ class ToolInvokeMeta(BaseModel):time_cost: float = Field(..., description="The time cost of the tool invoke")error: str | None = None- tool_config: dict | None = None+ tool_config: dict[str, Any] | None = None@classmethoddef empty(cls) -> ToolInvokeMeta:diff --git a/api/core/tools/tool_engine.py b/api/core/tools/tool_engine.pyindex d1e333f5022..1afaa9cfaf1 100644--- a/api/core/tools/tool_engine.py+++ b/api/core/tools/tool_engine.py@@ -85,7 +85,8 @@ class ToolEngine:invocation_meta_dict: dict[str, ToolInvokeMeta] = {}def message_callback(- invocation_meta_dict: dict, messages: Generator[ToolInvokeMessage | ToolInvokeMeta, None, None]+ invocation_meta_dict: dict[str, Any],+ messages: Generator[ToolInvokeMessage | ToolInvokeMeta, None, None],):for message in messages:if isinstance(message, ToolInvokeMeta):@@ -200,7 +201,7 @@ class ToolEngine:@staticmethoddef _invoke(tool: Tool,- tool_parameters: dict,+ tool_parameters: dict[str, Any],user_id: str,conversation_id: str | None = None,app_id: str | None = None,diff --git a/api/core/tools/utils/dataset_retriever_tool.py b/api/core/tools/utils/dataset_retriever_tool.pyindex fca6e6f1c78..0bdc3df8692 100644--- a/api/core/tools/utils/dataset_retriever_tool.py+++ b/api/core/tools/utils/dataset_retriever_tool.py@@ -33,7 +33,7 @@ class DatasetRetrieverTool(Tool):invoke_from: InvokeFrom,hit_callback: DatasetIndexToolCallbackHandler,user_id: str,- inputs: dict,+ inputs: dict[str, Any],) -> list["DatasetRetrieverTool"]:"""get dataset tooldiff --git a/api/core/tools/workflow_as_tool/tool.py b/api/core/tools/workflow_as_tool/tool.pyindex a17b7f108db..552fbab1a46 100644--- a/api/core/tools/workflow_as_tool/tool.py+++ b/api/core/tools/workflow_as_tool/tool.py@@ -277,7 +277,7 @@ class WorkflowTool(Tool):session.expunge(app)return app- def _transform_args(self, tool_parameters: dict) -> tuple[dict, list[dict]]:+ def _transform_args(self, tool_parameters: dict[str, Any]) -> tuple[dict[str, Any], list[dict[str, Any]]]:"""transform the tool parameters@@ -323,7 +323,7 @@ class WorkflowTool(Tool):return parameters_result, files- def _extract_files(self, outputs: dict) -> tuple[dict, list[File]]:+ def _extract_files(self, outputs: dict[str, Any]) -> tuple[dict[str, Any], list[File]]:"""extract files from the result@@ -355,7 +355,7 @@ class WorkflowTool(Tool):return result, files- def _update_file_mapping(self, file_dict: dict):+ def _update_file_mapping(self, file_dict: dict[str, Any]):file_id = resolve_file_record_id(file_dict.get("reference") or file_dict.get("related_id"))transfer_method = FileTransferMethod.value_of(file_dict.get("transfer_method"))match transfer_method: