Checks
Strands Version
1.34.1
Python Version
3.10.16
Operating System
macOS
Installation Method
pip
Steps to Reproduce
- Create an agent with a structured system prompt containing cache points:
from strands import Agent
from strands.vended_plugins.skills import Skill, AgentSkills
skill = Skill(name="my-skill", description="A skill", instructions="Do the thing")
plugin = AgentSkills(skills=[skill])
agent = Agent(
system_prompt=[
{"text": "Base instructions."},
{"cachePoint": {"type": "default"}},
{"text": "More instructions."},
],
plugins=[plugin],
)
# Before any invocation, check:
print(agent._system_prompt_content)
# [{"text": "Base instructions."}, {"cachePoint": {"type": "default"}}, {"text": "More instructions."}]
# After the agent runs (triggering _on_before_invocation):
agent("hello")
print(agent._system_prompt_content)
# Expected: cache points preserved
# Actual: all structure collapsed into a single text block
Expected Behavior
_system_prompt_content should preserve all structured blocks including cachePoint entries after the AgentSkills hook injects skills XML. Cache points should continue to work for prompt caching optimization.
Actual Behavior
AgentSkills._on_before_invocation reads the system prompt as a string via agent.system_prompt, concatenates the skills XML, and writes it back as a plain string. The setter then converts this to [{"text": full_string}], destroying all cachePoint blocks and any other structured content.
After the hook runs, _system_prompt_content becomes a single flat text block with no cache points.
Additional Context
No response
Possible Solution
No response
Related Issues
No response
Checks
Strands Version
1.34.1
Python Version
3.10.16
Operating System
macOS
Installation Method
pip
Steps to Reproduce
Expected Behavior
_system_prompt_contentshould preserve all structured blocks includingcachePointentries after the AgentSkills hook injects skills XML. Cache points should continue to work for prompt caching optimization.Actual Behavior
AgentSkills._on_before_invocationreads the system prompt as a string viaagent.system_prompt, concatenates the skills XML, and writes it back as a plain string. The setter then converts this to[{"text": full_string}], destroying allcachePointblocks and any other structured content.After the hook runs,
_system_prompt_contentbecomes a single flat text block with no cache points.Additional Context
No response
Possible Solution
No response
Related Issues
No response