`EventMetadataFilter.build_expression` stores `operator.value` (the
operator's string, e.g. "EQUALS_TO") in the returned dict, but the
TypedDict annotated `operator` as the `OperatorType` enum. Every
constructed filter therefore mis-typed the field, contradicting the
runtime value that is serialized to the AgentCore service.
Annotate `operator` as `str`, matching the sibling `MemoryMetadataFilter`
which already documents and types this the same way. Add the first unit
tests for `EventMetadataFilter` (the type previously had none), covering
the field annotation and `build_expression` for both a value operator
and an existence operator.
Fixes aws#240
Summary
EventMetadataFilter.build_expression stores operator.value (the operator's string, e.g. "EQUALS_TO") in the returned dict, but the EventMetadataFilter TypedDict annotated operator as the OperatorType enum. Every constructed filter therefore mis-typed the field relative to the value that is actually serialized to the AgentCore service.
This annotates operator as str, matching the sibling MemoryMetadataFilter, which already documents and types the field this way.
Fixes #240
Changes
Testing
uv run pytest tests/bedrock_agentcore/memory/models/test_filters.py — all pass. No runtime behavior changes; build_expression already produced string operators.