Repository navigation
Description
Summary
StrandsPlugin keeps the payload codec and external storage of the Client's DataConverter, but
it still sets failure_converter_class=StrandsFailureConverter whenever the payload converter is
the SDK default. A caller that set DefaultFailureConverterWithEncodedAttributes, so that failure
messages and stack traces go through the codec, gets them stored as written in History. The
plugin does not warn.
Second, a docs gap: temporalio.contrib.strands in temporalio 1.34.0 and earlier dropped the
Client's codec, so its payloads are plain JSON. After moving to temporalio-strands-agents, a codec
that rejects payloads it did not encode fails on those payloads. Nothing tells users this.
Versions
temporalio-strands-agents 0.1.0 and main at 5e91c26 (same plugin source), temporalio
1.34.0, strands-agents 1.56.0, Python 3.13.16.
Reproduction
No server needed:
import dataclasses
import sys
from temporalio.api.failure.v1 import Failure
from temporalio.converter import DataConverter, DefaultFailureConverterWithEncodedAttributes
from temporalio.exceptions import ApplicationError
from temporalio.strands_agents import StrandsPlugin
given = dataclasses.replace(DataConverter.default, failure_converter_class=DefaultFailureConverterWithEncodedAttributes)
active = StrandsPlugin(models={}).configure_client({"data_converter": given})["data_converter"]
failure = Failure()
active.failure_converter.to_failure(ApplicationError("card 4111-1111"), active.payload_converter, failure)
print("given:", given.failure_converter_class.__name__)
print("active:", type(active.failure_converter).__name__)
print("stored message:", repr(failure.message))
sys.exit(0 if failure.message == "Encoded failure" else 1)Output on 0.1.0 and on main (exit 1):
given: DefaultFailureConverterWithEncodedAttributes
active: StrandsFailureConverter
stored message: 'card 4111-1111'
Expected: the message is stored as Encoded failure, and the plugin still turns Strands'
InterruptException into its StrandsInterrupt failure. The same happens on a real Worker: a
Workflow that raises ApplicationError stores its message in plain text in
WorkflowExecutionFailed, and an Activity-tool interrupt stores interrupt:<name> in plain text.
A plugin listed before StrandsPlugin that sets the failure converter loses it the same way.
Control: the same converter with no plugin stores Encoded failure.
For the docs gap: a Client with DataConverter(payload_codec=<codec that rejects unencoded payloads>) and temporalio.contrib.strands.StrandsPlugin runs a TemporalAgent Workflow; the
result is stored as json/plain. A Client with the same codec and
temporalio.strands_agents.StrandsPlugin then calls result() on that run and gets the codec's
error. A run left open across the same upgrade fails its Workflow Task with the codec's error on a
Worker with no Workflow cache. With a codec that passes unencoded payloads through, both work.
Rolling Workers back to temporalio.contrib.strands fails runs that the new plugin wrote to
(Failed decoding arguments), unless a plugin listed after StrandsPlugin sets the caller's codec
and external storage again. Restoring only the codec fails a run whose payloads were offloaded
([TMPRL1105] Detected externally stored payload(s) but external storage is not configured.).
Impact
Failure messages and stack traces can hold the same data the codec protects: tool arguments,
model output and error text from providers. With an encryption codec they are readable by anyone
with History access, although the user configured them to be encoded.
Proposed fix
When the caller's class is DefaultFailureConverterWithEncodedAttributes, install a private
StrandsFailureConverterWithEncodedAttributes, a StrandsFailureConverter with
encode_common_attributes=True; every other class becomes StrandsFailureConverter as today.
Decoding does not change, since both use DefaultFailureConverter.from_failure, which reads
encoded and plain failure attributes: histories written before the change replay with it, and
Workers without it read the new failures. Keeping an arbitrary caller class is not safe: its own
from_failure would replace the decoding Workflow code has seen so far, so a Workflow that
branches on the error type can take another branch and fail replay ([TMPRL1100]). Add a README
section on the upgrade from temporalio.contrib.strands: the codec now applies, a strict codec
must accept unencoded payloads before the upgrade, and a rollback needs a plugin that sets the
caller's codec and external storage again.
A change with regression tests in tests/test_plugin.py and the README section is ready. The
encoded-attributes test fails on main on the stored message and passes with the change; a test
that a caller class with its own decoding is still replaced passes on both; the suite and lint
pass.
Activity
campoy commentedon Oct 30, 2026
#155 fixes the failure converter part. At a maintainer's request, the codec upgrade note goes in the release notes instead of the README. Generated release notes list only commit subjects, so this stays open until the next
strands_agentsrelease notes include:campoy commentedon Nov 2, 2026
Closing: #155 fixed the failure converter part. The codec upgrade note in the comment above still needs to go into the next
strands_agentsrelease notes.