Current Datetime
Inject the current date and time into each request so the LLM has accurate temporal context.
Current Datetime injects the current date and time into each request before it is forwarded to the LLM. This gives the model reliable temporal context for queries that depend on knowing the current date or time — for example: "What happened today?", "How many business days are left this month?", or "What should I schedule for tomorrow?"
Without this module, LLMs have no knowledge of the current date beyond their training cutoff, often producing incorrect or vague temporal answers.
Stage
| Stage | Behavior |
|---|---|
| PRE only | Appends a datetime block as a suffix to the latest user message before forwarding to the LLM |
Injected Format
The module appends the following block to the last user message in the request:
{original user message}
[System Context: Timezone={timezone}, CurrentTime={datetime}]If no user message exists in the request, the block is appended to the last message of any role.
Example
Original user message:
How many days until the end of the quarter?After injection (timezone: Asia/Jakarta, format: ISO 8601):
How many days until the end of the quarter?
[System Context: Timezone=Asia/Jakarta, CurrentTime=2026-06-25T09:30:00+07:00]Prompt Caching Optimization
Optimized for Prompt Caching
The datetime block is appended as a suffix to the user query rather than prepended to the beginning of the prompt.
Because modern LLM providers (Anthropic, OpenAI, DeepSeek, vLLM, Gemini) use prefix-based KV-caching, appending the dynamic timestamp at the tail ensures that the entire static prefix—including system prompts, tool definitions, and prior conversation history—remains 100% cacheable, saving 50–90% in token costs and drastically reducing Time to First Token (TTFT).
Multi-Turn Agent Loop Stability (Tool Call ID Relay)
In autonomous agent workflows where the LLM executes function or tool calls across multiple round-trips:
- Turn 1 (Fresh User Query): The initial user prompt is stamped with the current timestamp (e.g.
2026-09-06T14:00:00Z). When the LLM responds with tool calls, Infralo indexes this timestamp in the gateway cache under the uniquetool_call_id/call_id. - Turn 2+ (Tool Execution Results): Client SDKs store raw user messages in their local memory buffers without server-injected suffixes. When the agent sends tool results back along with the raw history, Infralo extracts the active
tool_call_ids, retrieves Turn 1's exact timestamp from the gateway cache, and re-attaches it to the user message.
This prevents the seconds/minutes from drifting between turns, ensuring the prefix sent to the LLM remains 100% byte-for-byte stable for prompt cache hits throughout the entire agent loop. This is natively supported across both the Chat Completions (/v1/chat/completions) and Responses API (/v1/responses) endpoints.
Why Scoped by Tool Call ID (Not Session ID)?
We deliberately scope the timestamp to the individual tool_call_id rather than the broader session_id:
- A single user chat session can last hours or days and encompass dozens of separate conversations.
- Tying timestamps to a session ID would cause cross-conversation cache bleed, freezing the date/time on questions asked hours later to the session's first turn.
- The tool call ID strictly bounds the lifespan of the timestamp to that exact execution loop. Once the agent completes and the user asks a new question, a fresh timestamp is resolved naturally.
Framework Compatibility & Tool ID Preservation
For Infralo to retrieve the Turn 1 timestamp during tool continuations, the client SDK must pass back the same tool call ID that the model returned.
| Framework | Tool ID Behavior | Prompt Cache Status | Configuration Needed |
|---|---|---|---|
| OpenAI Official SDK (Python/Node/REST) | Preserves raw tool call IDs verbatim | 100% Cache Stable | None (Works out of the box) |
| LangChain | Preserves raw tool call IDs verbatim | 100% Cache Stable | None (Works out of the box) |
| LangGraph | Preserves state messages and tool IDs | 100% Cache Stable | None (Works out of the box) |
| CrewAI | Preserves provider tool IDs via LiteLLM | 100% Cache Stable | None (Works out of the box) |
| LlamaIndex | Preserves raw tool call IDs verbatim | 100% Cache Stable | None (Works out of the box) |
| Vercel AI SDK | Preserves raw tool call IDs verbatim | 100% Cache Stable | None (Works out of the box) |
| Google GenAI SDK | Preserves native call IDs | 100% Cache Stable | None (Works out of the box) |
| AutoGen | Preserves raw tool call IDs verbatim | 100% Cache Stable | None (Works out of the box) |
| Agno | Rewrites foreign IDs to call_0000000... | Requires 1-line config | Set prefix = None (see below) |
Important Note for Agno Users
By default, Agno's OpenAIChat and OpenAILike classes enforce OpenAI's legacy tool ID regex (^call_) by reformatting non-OpenAI IDs (e.g. Anthropic toolu_...) into a zero-padded counter: call_00000000000000000000000000000000000.
This causes two issues:
- Infralo Cache Miss: Infralo indexes
toolu_..., but Agno queriescall_000000.... - Provider KV Cache Miss: Changing the tool use ID in the assistant message forces Claude to re-tokenize the assistant block instead of hitting Anthropic's prompt cache.
To preserve native provider IDs and maintain full prompt caching when using Agno with Infralo Gateway, disable Agno's ID reformatting at application startup:
from agno.utils.message import PROVIDER_TOOL_ID_CONFIG
# Allow Infralo Gateway to manage provider-native IDs without Agno mutating them
if "openai_chat" in PROVIDER_TOOL_ID_CONFIG:
PROVIDER_TOOL_ID_CONFIG["openai_chat"]["prefix"] = NoneConfiguration
Timezone
The IANA timezone identifier used to resolve the current datetime. Defaults to UTC.
All standard IANA timezone identifiers are supported. If an unknown or invalid timezone is provided, the module automatically falls back to UTC.
Common options:
| Region | Value |
|---|---|
| UTC | UTC |
| Jakarta / Bangkok / Ho Chi Minh | Asia/Jakarta |
| Singapore / Kuala Lumpur | Asia/Singapore |
| Tokyo | Asia/Tokyo |
| London | Europe/London |
| New York | America/New_York |
| Los Angeles | America/Los_Angeles |
Datetime Format
The output format for the injected datetime string.
| Option | Example Output |
|---|---|
| ISO 8601 (default) | 2026-06-18T21:30:00+07:00 |
| ISO 8601 without seconds | 2026-06-18T21:30+07:00 |
| Date only | 2026-06-18 |
| Date & time | 2026-06-18 21:30:00 |
| Date & time without seconds | 2026-06-18 21:30 |
| Human readable | June 18, 2026 21:30 WIB |
| Day, date & time | Thursday, June 18, 2026 21:30 WIB |
| Day & date only | Thursday, June 18, 2026 |
| Unix timestamp | 1781814600 |
Example Use Cases
- Time-sensitive Q&A bots: Chatbots that answer questions like "What's today?" or "When does this promotion end?" need reliable temporal context.
- Scheduling assistants: Agents that help users book meetings, set reminders, or reason about deadlines.
- Daily digest generation: Pipelines that generate summaries anchored to the current date.
- Business logic validation: LLMs evaluating time-based rules (e.g., "Is this invoice still within the payment window?").
No system prompt required
This module injects the datetime at the infrastructure level, so you don't need to add a timestamp to your system prompt in every application. Changes to the timezone or format take effect immediately without any code changes.