Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix: inject current date and time into agent and swarm system prompts

warren6180aea8b01507b
diff --git a/agent/src/agent/context.py b/agent/src/agent/context.py
index ebeb023d5..f1fd6bcce 100644
--- a/agent/src/agent/context.py
+++ b/agent/src/agent/context.py
@@ -3,6 +3,7 @@
from __future__ import annotations
import json
+from datetime import datetime
from typing import Any, Dict, List, Optional
from src.agent.memory import WorkspaceMemory
@@ -53,6 +54,10 @@ Decide which workflow to use based on the request:
- Output results as markdown tables. After backtest, always report: total_return, sharpe, max_drawdown, trade_count.
- All file paths are relative to run_dir (auto-injected).
- Respond in the same language the user used.
+
+## Current Date & Time
+
+Today is {current_datetime}.
"""
@@ -89,10 +94,12 @@ class ContextBuilder:
Returns:
System prompt text.
"""
+ now = datetime.now()
return _SYSTEM_PROMPT.format(
tool_descriptions=self._format_tool_descriptions(),
skill_descriptions=self.skills_loader.get_descriptions(),
memory_summary=self.memory.to_summary(),
+ current_datetime=now.strftime("%A, %B %d, %Y %H:%M (local)"),
)
def build_messages(self, user_message: str, history: Optional[List[Dict[str, Any]]] = None) -> List[Dict[str, Any]]:
diff --git a/agent/src/swarm/worker.py b/agent/src/swarm/worker.py
index d79caa566..56fd22ed3 100644
--- a/agent/src/swarm/worker.py
+++ b/agent/src/swarm/worker.py
@@ -170,6 +170,12 @@ def build_worker_prompt(
"- Respond in the same language as the task prompt."
)
+ now = datetime.now()
+ prompt_parts.append(
+ f"## Current Date & Time\n\n"
+ f"Today is {now.strftime('%A, %B %d, %Y %H:%M (local)')}."
+ )
+
return "\n\n".join(prompt_parts)