Seperate system message in AI Agent for better structure and add ability for cache

The current structure of AI Agent is like that:


[
{
"messages": 
[
"System: System message test\nHuman: hej\nAI: Hej! Hvordan kan jeg hjælpe dig?\nHuman: frytki"
],
"estimatedTokens": 
26,
"options": 
{
"anthropic_api_key": 
{
"lc": 
1,
"type": 
"secret",
"id": 
[
"ANTHROPIC_API_KEY"
]
},
"model": 
"claude-3-5-sonnet-20241022",
"max_tokens": 
2048,
"temperature": 
1,
"top_k": 
-1,
"top_p": 
-1,
"api_key": 
{
"lc": 
1,
"type": 
"secret",
"id": 
[
"ANTHROPIC_API_KEY"
]
}
}
}
]

I want to implement system message caching so it should be like that:

[
  {
    "messages": [
      { "role": "system", "content": "System message test" },
      { "role": "human", "content": "hej" },
      { "role": "ai", "content": "Hej! Hvordan kan jeg hjælpe dig?" },
      { "role": "human", "content": "frytki" }
    ],
    "estimatedTokens": 26,
    "options": {
      "anthropic_api_key": {
        "lc": 1,
        "type": "secret",
        "id": ["ANTHROPIC_API_KEY"]
      },
      "model": "claude-3-5-sonnet-20241022",
      "max_tokens": 2048,
      "temperature": 1,
      "top_k": -1,
      "top_p": -1,
      "api_key": {
        "lc": 1,
        "type": "secret",
        "id": ["ANTHROPIC_API_KEY"]
      }
    }
  }
]