Skip to content

Commit 71fff97

Browse files
committed
fix: inject current date and time into agent and swarm system prompts
Closes #22
1 parent fd6c3f4 commit 71fff97

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

agent/src/agent/context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import json
6+
from datetime import datetime
67
from typing import Any, Dict, List, Optional
78

89
from src.agent.memory import WorkspaceMemory
@@ -53,6 +54,10 @@
5354
- Output results as markdown tables. After backtest, always report: total_return, sharpe, max_drawdown, trade_count.
5455
- All file paths are relative to run_dir (auto-injected).
5556
- Respond in the same language the user used.
57+
58+
## Current Date & Time
59+
60+
Today is {current_datetime}.
5661
"""
5762

5863

@@ -89,10 +94,12 @@ def build_system_prompt(self, user_message: str = "") -> str:
8994
Returns:
9095
System prompt text.
9196
"""
97+
now = datetime.now()
9298
return _SYSTEM_PROMPT.format(
9399
tool_descriptions=self._format_tool_descriptions(),
94100
skill_descriptions=self.skills_loader.get_descriptions(),
95101
memory_summary=self.memory.to_summary(),
102+
current_datetime=now.strftime("%A, %B %d, %Y %H:%M (local)"),
96103
)
97104

98105
def build_messages(self, user_message: str, history: Optional[List[Dict[str, Any]]] = None) -> List[Dict[str, Any]]:

agent/src/swarm/worker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ def build_worker_prompt(
170170
"- Respond in the same language as the task prompt."
171171
)
172172

173+
now = datetime.now()
174+
prompt_parts.append(
175+
f"## Current Date & Time\n\n"
176+
f"Today is {now.strftime('%A, %B %d, %Y %H:%M (local)')}."
177+
)
178+
173179
return "\n\n".join(prompt_parts)
174180

175181

0 commit comments

Comments
 (0)