Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

Commit 62fc325

Browse files
committed
Fix 3.9 typing
1 parent e43e629 commit 62fc325

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

src/controlflow/agents/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Agent(ControlFlowModel, abc.ABC):
8383
default=False,
8484
description="If True, the agent is given tools for interacting with a human user.",
8585
)
86-
memories: list[Memory] | list[AsyncMemory] = Field(
86+
memories: list[Union[Memory, AsyncMemory]] = Field(
8787
default=[],
8888
description="A list of memory modules for the agent to use.",
8989
)
@@ -345,7 +345,7 @@ def _run_model(
345345

346346
create_markdown_artifact(
347347
markdown=f"""
348-
{response.content or '(No content)'}
348+
{response.content or "(No content)"}
349349
350350
#### Payload
351351
```json
@@ -409,7 +409,7 @@ async def _run_model_async(
409409

410410
create_markdown_artifact(
411411
markdown=f"""
412-
{response.content or '(No content)'}
412+
{response.content or "(No content)"}
413413
414414
#### Payload
415415
```json

src/controlflow/defaults.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ class Defaults(ControlFlowModel):
4040
model: Optional[Any]
4141
history: History
4242
agent: Agent
43-
memory_provider: (
44-
Optional[Union[MemoryProvider, str]] | Optional[Union[AsyncMemoryProvider, str]]
45-
)
43+
memory_provider: Optional[Union[MemoryProvider, AsyncMemoryProvider, str]]
4644

4745
# add more defaults here
4846
def __repr__(self) -> str:

src/controlflow/orchestration/orchestrator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def get_tools(self) -> list[Tool]:
188188
tools = as_tools(tools)
189189
return tools
190190

191-
def get_memories(self) -> list[Memory] | list[AsyncMemory]:
191+
def get_memories(self) -> list[Union[Memory, AsyncMemory]]:
192192
memories = set()
193193

194194
memories.update(self.agent.memories)
@@ -525,7 +525,7 @@ def compile_prompt(self) -> str:
525525
]
526526

527527
prompt = "\n\n".join([p for p in prompts if p])
528-
logger.debug(f"{'='*10}\nCompiled prompt: {prompt}\n{'='*10}")
528+
logger.debug(f"{'=' * 10}\nCompiled prompt: {prompt}\n{'=' * 10}")
529529
return prompt
530530

531531
def compile_messages(self) -> list[BaseMessage]:

src/controlflow/orchestration/prompt_templates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional
1+
from typing import Any, Dict, List, Optional, Union
22

33
from pydantic import model_validator
44

@@ -98,7 +98,7 @@ def should_render(self) -> bool:
9898

9999
class MemoryTemplate(Template):
100100
template_path: str = "memories.jinja"
101-
memories: list[Memory] | list[AsyncMemory]
101+
memories: list[Union[Memory, AsyncMemory]]
102102

103103
def should_render(self) -> bool:
104104
return bool(self.memories)

0 commit comments

Comments
 (0)