Skip to content

[Question]: Agent time and date understanding and translating relative dates to tools date ranges #20273

@cesarqdt

Description

@cesarqdt

Question Validation

  • I have searched both the documentation and discord for an answer.

Question

My question is this one: How to give agents temporal context for relative date queries?

When I ask my agent "what happened 2 weeks ago?" or "show me today's data," it needs to understand the current date and translate that into concrete date ranges for the tools it calls. Right now, the agent struggles with this kind of relative temporal language.
I'm building financial analysis agents that handle queries with dates like "last month," "today," or "30 days ago," and the agent should be smart enough to convert these into actual date ranges it can pass to its tools. Instead, it either fails to make the right tool calls or passes the responsibility back to the user.

What's the best way to give an agent this temporal understanding in LlamaIndex? Should I inject the current date into the system prompt - and if so, how should I implement that properly? - and create a dedicated temporal tool, or is there a pattern I'm missing?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions