Runtime ModulesTransformation

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

StageBehavior
PRE onlyAppends 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:

  1. 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 unique tool_call_id / call_id.
  2. 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.

FrameworkTool ID BehaviorPrompt Cache StatusConfiguration Needed
OpenAI Official SDK (Python/Node/REST)Preserves raw tool call IDs verbatim100% Cache StableNone (Works out of the box)
LangChainPreserves raw tool call IDs verbatim100% Cache StableNone (Works out of the box)
LangGraphPreserves state messages and tool IDs100% Cache StableNone (Works out of the box)
CrewAIPreserves provider tool IDs via LiteLLM100% Cache StableNone (Works out of the box)
LlamaIndexPreserves raw tool call IDs verbatim100% Cache StableNone (Works out of the box)
Vercel AI SDKPreserves raw tool call IDs verbatim100% Cache StableNone (Works out of the box)
Google GenAI SDKPreserves native call IDs100% Cache StableNone (Works out of the box)
AutoGenPreserves raw tool call IDs verbatim100% Cache StableNone (Works out of the box)
AgnoRewrites foreign IDs to call_0000000...Requires 1-line configSet 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:

  1. Infralo Cache Miss: Infralo indexes toolu_..., but Agno queries call_000000....
  2. 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"] = None

Configuration

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:

RegionValue
UTCUTC
Jakarta / Bangkok / Ho Chi MinhAsia/Jakarta
Singapore / Kuala LumpurAsia/Singapore
TokyoAsia/Tokyo
LondonEurope/London
New YorkAmerica/New_York
Los AngelesAmerica/Los_Angeles

Datetime Format

The output format for the injected datetime string.

OptionExample Output
ISO 8601 (default)2026-06-18T21:30:00+07:00
ISO 8601 without seconds2026-06-18T21:30+07:00
Date only2026-06-18
Date & time2026-06-18 21:30:00
Date & time without seconds2026-06-18 21:30
Human readableJune 18, 2026 21:30 WIB
Day, date & timeThursday, June 18, 2026 21:30 WIB
Day & date onlyThursday, June 18, 2026
Unix timestamp1781814600

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.

On this page