Repository navigation
Conversation
…same session DaprWorkflowAgentRunner started every workflow from only the new prompt and never saved the reply, so a wrapped chat agent became single-turn. The workflow now loads the session's messages in an activity, runs the loop on history plus the new turn, and saves the full list in a second activity after a successful run. History is keyed by runner name and session id, goes to the state store when there is one (explicit or the agent-memory component) and otherwise stays in the runner process with a single warning. Saved history is trimmed to the agent's sliding window (default 40) and cut so it starts on a user message with no tool result. DurableAgent now starts from agent.messages and writes the finished turn back to it. Callers that reuse one session_id for unrelated tasks will now carry history between those tasks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Casper Nielsen <casper@diagrid.io>
… call Signed-off-by: Casper Nielsen <casper@diagrid.io>
Signed-off-by: Casper Nielsen <casper@diagrid.io>
strands.Agent reads model.stateful at construction; the base Model class defaults it to False, but the duck-typed test double lacked it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Casper Nielsen <casper@diagrid.io>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A Strands agent wrapped in
DaprWorkflowAgentRunnercould not hold a conversation. Every call started a new workflow with only the new prompt, and the reply was never saved.session_idonly ended up in the workflow instance ID and in events. A plain StrandsAgentremembers earlier turns, so wrapping a chat agent silently made it single-turn.DurableAgenthad the same problem: it started from the task alone, and its.messagesproperty never changed.What changed
session_idas input. It loads the session history in an activity, runs the loop on history plus the new turn, and saves the full list in a second activity after the run finishes successfully. A failed or max-iteration run saves nothing. Both steps are activities, so replays stay deterministic and a retried save writes the same value.agent-memorycomponent found by auto-discovery). Otherwise it is kept in a dict inside the runner process, with a single warning that it will not survive a restart or be shared between replicas. That is what plain Strands does today.strands-{runner name}-{session_id}-messages, so different session ids or different runner names never share history.toolResult. This avoids a tool result without its tool call, which providers reject, and keeps the workflow payload small.DurableAgent: starts fromagent.messagesplus the new turn and writes the finished turn back into the same list. No state store is involved. A failed model call leaves.messagesuntouched.session_idmeans "this conversation", and include theagent-memorycomponent YAML.Behaviour change (release note worthy)
Callers that reuse one fixed
session_idfor unrelated tasks (the docstring examples use"session-123") will now carry history between those tasks. Use a newsession_idto start fresh.Not covered (follow-ups)
session_id: the last save wins.DurableAgenthistory is not trimmed.DaprAgentWorkflowshares one conversation across sessions; separate issue.How it was tested
uv run ruff format: no changesuv run flake8 diagrid tests --ignore=E501,F401,W503,E203,E704: cleanuv run mypy --config-file mypy.ini: no issues in 142 source filesuv run pytest tests -m "not integration": 1031 passed, 4 skippedDurableAgentbehaviour including a failed model call.integration) against the sidecar state store was not run in CI here.Checklist
uv run ruff format(no path arguments, soexamples/is covered too)uv run flake8 diagrid tests --ignore=E501,F401,W503,E203,E704uv run mypy --config-file mypy.iniuv run pytest tests -m "not integration"diagrid/carry the license headergit commit -s)🤖 Generated with Claude Code