awslabs / awslabs/agentcore-samples
06-workshops - [Bug] 07-Guardrails in Policy: list_policy_engines() and list_policies() return empty results after creation
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 30
Description
**In which component is this bug present?**
- [ ] 01-AgentCore-runtime
- [ ] 02-AgentCore-gateway
- [ ] 03-AgentCore-identity
- [ ] 04-AgentCore-memory
- [ ] 05-AgentCore-tools
- [ ] 06-AgentCore-observability
- [x] 07-AgentCore-E2E
**Bug Description**
After creating a policy engine and policies via `create_policy_engine()` / `create_policy()`, the `list_policy_engines()` API returns 0 items and `list_policies()` returns 0 items. However, `get_policy_engine(policyEngineId=...)` and `get_policy(policyEngineId=..., policyId=...)` succeed and show the resources as ACTIVE.
This is likely an eventual consistency issue with the list APIs, but it makes the deploy script brittle — it can't detect existing resources to avoid `ConflictException` on re-runs.
**Expected Behavior**
`list_policy_engines()` and `list_policies()` should return recently created resources.
**Suggested Fix**
Add a note in the workshop about this eventual consistency, and add retry/wait logic in the deploy script after creation before listing.
Contributor guide
Assessment
This issue has not been assessed yet.