Skip to content

[BUG] System prompt is not passed when using structured output in Bedrock #362

@jeromevdl

Description

@jeromevdl

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

0.2.1

Python Version

3.11

Operating System

macOS 15.5

Installation Method

pip

Steps to Reproduce

  1. Install strands using pip (requirements.txt)
  2. Use the following code:
bedrock_model = BedrockModel(
            model_id="eu.amazon.nova-lite-v1:0",
            temperature=0.0,
            top_p=0.5,
            region_name="eu-central-1",
            streaming=False,
            cache_prompt="default"  # cache system prompt
        )
agent = Agent(model=bedrock_model, system_prompt="....")
result = agent.structured_output(Model, prompt="...")

Expected Behavior

The model is called both with the prompt and system prompt, and caches the system prompt, and return the structured output.

Actual Behavior

An error occurred (ValidationException) when calling the Converse operation: There is nothing available to cache. Please remove the invalid cache point and try again.

Additional Context

Looking at the code, the system prompt is not passed to the converse method in structured_output() (here)
So it's not an issue of caching, but rather that system prompt is not passed (and therefore caching cannot work).

Possible Solution

No response

Related Issues

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions