diff --git a/llama-index-core/llama_index/core/agent/workflow/base_agent.py b/llama-index-core/llama_index/core/agent/workflow/base_agent.py index 3dc7741867d2b..86cd1d58a41b4 100644 --- a/llama-index-core/llama_index/core/agent/workflow/base_agent.py +++ b/llama-index-core/llama_index/core/agent/workflow/base_agent.py @@ -1,5 +1,5 @@ from abc import ABC, abstractmethod -from typing import Callable, List, Sequence, Optional +from typing import Callable, List, Sequence, Optional, Union from llama_index.core.agent.workflow.workflow_events import ( AgentOutput, @@ -52,7 +52,7 @@ class BaseWorkflowAgent(BaseModel, PromptMixin, ABC): @field_validator("tools", mode="before") def validate_tools( - cls, v: Optional[Sequence[BaseTool | Callable]] + cls, v: Optional[Sequence[Union[BaseTool, Callable]]] ) -> Optional[Sequence[BaseTool]]: """Validate tools. diff --git a/llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py b/llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py index ab16ac3045bd8..2ee0dfeb88f4c 100644 --- a/llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py +++ b/llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py @@ -451,7 +451,7 @@ def run( @classmethod def from_tools_or_functions( cls, - tools_or_functions: list[BaseTool | Callable], + tools_or_functions: List[Union[BaseTool, Callable]], llm: Optional[LLM] = None, system_prompt: Optional[str] = None, state_prompt: Optional[Union[str, BasePromptTemplate]] = None,