Skip to content

v1.15.0

Choose a tag to compare

@Unshure Unshure released this 04 Nov 18:21
· 23 commits to main since this release
9f10595

Major Features

SystemContentBlock Support for Provider-Agnostic Caching - PR#1112

System prompts now support SystemContentBlock arrays, enabling provider-agnostic caching and advanced multi-prompt system configurations. Cache points can be defined explicitly within system content.

from strands import Agent
from strands.types.content import SystemContentBlock

# Define system content with cache points
system_content: list[SystemContentBlock] = [
    {"text": "You are a helpful assistant with extensive knowledge."},
    {"text": "Your responses should be concise and accurate."},
    {"text": "Always cite sources."},
    {"cachePoint": {"type": "default"}},
]

agent = Agent(system_prompt=system_content)
agent('What is the capital of Franch?')

Multi-Agent Session Management and Persistence - PR#1071, PR#1110

Multi-agent systems now support session management and persistence, enabling agents to maintain state across invocations and support long-running workflows.

from strands import Agent
from strands.multiagent import GraphBuilder
from strands.multiagent.base import Status
from strands.session import FileSessionManager

def build_graph(max_nodes: int):
    session_manager = FileSessionManager(session_id="my_session_1", storage_dir="./sessions")

    builder = GraphBuilder()
    builder.add_node(Agent(name="analyzer", system_prompt="Explain using 2 paragraphs. "))
    builder.add_node(Agent(name="summarizer", system_prompt="Summerize and be concise.  10 words or less"))

    builder.add_edge("analyzer", "summarizer")
    builder.set_entry_point("analyzer")
    builder.set_max_node_executions(max_nodes)
    builder.set_session_manager(session_manager)

    return builder.build()

# Simulate failure because after the first node we exceed max_nodes
result = await build_graph(max_nodes=1).invoke_async("Analyze why 2+2=4")
assert result.status == Status.FAILED

# Simulate that we're resuming from a failure with a fresh session - this picks at the summerizer
result = await build_graph(max_nodes=10).invoke_async("Analyze why 2+2=4")
assert result.status == Status.COMPLETED

Async Streaming for Multi-Agent Systems - PR#961

Multi-agent systems now support stream_async, enabling real-time streaming of events from agent teams as they collaborate.

from strands import Agent
from strands.multiagent import GraphBuilder

# Create multi-agent graph
analyzer = Agent(name="analyzer")
processor = Agent(name="processor")

builder = GraphBuilder()
builder.add_node(analyzer)
builder.add_node(processor)
builder.add_edge("analyzer", "processor")
builder.set_entry_point("analyzer")

graph = builder.build()

# Stream events as agents process
async for event in graph.stream_async("Analyze this data"):
    print(f"Event: {event.get('type', 'unknown')}")

Major Bug Fixes

  • Guardrails Redaction Fix - PR#1072
    Fixed input/output message redaction when guardrails_trace="enabled_full", ensuring sensitive data is properly protected in traces.

  • Tool Result Block Redaction - PR#1080
    Properly redact tool result blocks to prevent conversation corruption when using content filtering or PII redaction.

  • Orphaned Tool Use Fix - PR#1123
    Fixed broken conversations caused by orphaned toolUse blocks, improving reliability when tools fail or are interrupted.

  • Reasoning Content Handling - PR#1099
    Drop reasoningContent from requests to prevent errors with providers that don't support extended thinking modes.

  • Swarm Initialization Fix - PR#1107
    Don't initialize agents during Swarm construction, preventing unnecessary resource allocation and improving startup performance.

  • Structured Output Context Fix - PR#1128
    Allow None structured output context in tool executors, fixing edge cases where tools don't require structured responses.

What's Changed

  • fix: (bug): Drop reasoningContent from request by @mehtarac in #1099
  • fix: Dont initialize an agent on swarm init by @Unshure in #1107
  • feat: add multiagent session/repository management. by @JackYPCOnline in #1071
  • feat(multiagent): Add stream_async by @mkmeral in #961
  • Fix #1077: properly redact toolResult blocks to avoid corrupting the conversation by @leotac in #1080
  • linting by @pgrayy in #1120
  • Fix input/output message not redacted when guardrails_trace="enabled_full" by @leotac in #1072
  • fix: Allow none structured output context in tool executors by @mkmeral in #1128
  • fix: Fix broken converstaion with orphaned toolUse by @Unshure in #1123
  • feat: Enable multiagent session persistent in Graph/Swarm by @JackYPCOnline in #1110
  • feat(models): add SystemContentBlock support for provider-agnostic caching by @dbschmigelski in #1112

New Contributors

Full Changelog: v1.14.0...v1.15.0