Skip to content

feat(integrate): add durable Strands agent sample with Dapr Workflow (Diagrid) - #355

Open
marcduiker wants to merge 5 commits into
strands-agents:mainfrom
marcduiker:dev-919-diagrid-durability-sample
Open

marcduiker wants to merge 5 commits into
strands-agents:mainfrom
marcduiker:dev-919-diagrid-durability-sample

Conversation

@marcduiker

Copy link
Copy Markdown

Closes #354

Adds an integration sample at python/03-integrate/durability/diagrid/ that shows how to make a Strands agent durable with Dapr Workflow and the diagrid[strands] package. None of the existing integration folders covers durable execution, so this starts a durability/ folder. Happy to move it if you'd prefer a different spot.

What's in it

  • simple_agent.py runs an agent with two tools through DaprWorkflowAgentRunner. Each model call and each tool call is a workflow activity.
  • crash_recovery.py gives the agent three tools that it calls in order and exits the process while the second one is running. Run the same command again and Dapr resumes the workflow: the first tool doesn't run again, the second runs to completion, then the third. Every tool call goes to a log, and the script prints PASS or FAIL based on what actually ran. --reset starts over.
  • model.py picks the model from MODEL_PROVIDER: Amazon Bedrock by default (us.amazon.nova-pro-v1:0, like fastapi-strands-production-starter), or OpenAI.
  • It runs locally with the Dapr CLI and the Redis container that dapr init starts. You don't need an account.
  • README from the use-case template, an architecture diagram, and the regenerated samples.json. I didn't add it to a collection in samples-catalog.json, since that's your call.

How I tested it

  • Both scripts end to end with OpenAI (gpt-4o-mini), Dapr 1.19, Python 3.12, following the README from a fresh uv sync. The crash demo printed PASS on the second run.
  • Edge cases in the crash demo: a third run without reset (shows the earlier result), a flushed Redis (asks you to reset), and a failed model call (prints the error instead of a misleading FAIL).
  • Bedrock is not tested end to end. My AWS account doesn't have Bedrock model access. The Bedrock path runs up to the ConverseStream call, and the sample reports the access error clearly. If someone with Nova Pro access could give it a run, that would be great.
  • node generate-samples-manifest.mjs --check and node --test generate-samples-manifest.test.mjs pass.

Notes

  • The proposal mentioned requirements.txt. I used pyproject.toml and uv.lock instead, like the other 03-integrate samples.
  • The diagram is an SVG rather than the PNG the template names, so it follows GitHub's light and dark theme.
  • diagrid[strands] is published by Diagrid under the Business Source License 1.1. The sample code itself is Apache 2.0 and written for this repo. The README says this and also explains the package's anonymous usage event and how to turn it off (DO_NOT_TRACK=1).
  • I work at Diagrid. The package is also submitted to the integrations catalog in Add diagrid to the integrations catalog harness-sdk#6194.

Disclosure: drafted with Claude Code and reviewed by me.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sample proposal: durable Strands agent with Dapr Workflow

1 participant