> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Dynamic Variables

> Use {{today}}, {{now}}, {{uuid}} and other dynamic variables in prompts and workflows

Dynamic variables are resolved at runtime, allowing you to use current date, time, and other values without hardcoding them.

## Built-in Variables

| Variable        | Example Output      | Description         |
| --------------- | ------------------- | ------------------- |
| `{{today}}`     | January 19, 2026    | Human-readable date |
| `{{date}}`      | 2026-01-19          | ISO date format     |
| `{{now}}`       | 2026-01-19T11:00:00 | ISO datetime        |
| `{{timestamp}}` | 1737280800          | Unix timestamp      |
| `{{uuid}}`      | a1b2c3d4-...        | Random UUID         |
| `{{year}}`      | 2026                | Current year        |
| `{{month}}`     | January             | Current month name  |

## Usage in Agent

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

# Dynamic variable in prompt
agent = Agent(instructions="You are a news researcher")
result = agent.start("Find AI news for {{today}}")
# Resolves to: "Find AI news for January 19, 2026"

# Dynamic variable in instructions
agent = Agent(
    instructions="You research news. Today is {{today}}.",
    role="Researcher"
)
result = agent.run("What's new in AI?")
```

## Usage in Workflow YAML

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
framework: praisonai
topic: "Research AI developments for {{today}}"

roles:
  researcher:
    role: AI Researcher
    goal: "Find news for {{month}} {{year}}"
    tasks:
      research:
        description: "Research {{topic}}"
        expected_output: "Summary with sources"
```

## Custom Providers

Register your own dynamic variables:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.utils import register_variable_provider

# Simple function
register_variable_provider("author", lambda: "PraisonAI Team")

# Now {{author}} works in any prompt
agent.start("Article by {{author}} on {{today}}")
```

<Note>
  Dynamic variables are resolved in `Agent.start()`, `Agent.run()`, and `Workflow` execution.
  The import is lazy-loaded, so there's no performance impact if you don't use them.
</Note>

## API Reference

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.utils import (
    substitute_variables,      # Main function
    get_provider_registry,     # Get the registry
    register_variable_provider # Register custom provider
)

# Direct substitution
text = substitute_variables("Hello {{today}}", {})
# Returns: "Hello January 19, 2026"

# With static variables
text = substitute_variables("Topic: {{topic}} Date: {{today}}", {"topic": "AI"})
# Returns: "Topic: AI Date: January 19, 2026"
```
