Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/integration-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ jobs:
PYTHONUNBUFFERED: 1
MEMORY_KINESIS_ARN: ${{ secrets.MEMORY_KINESIS_ARN }}
MEMORY_ROLE_ARN: ${{ secrets.MEMORY_ROLE_ARN }}
MEMORY_PREPOPULATED_ID: ${{ secrets.MEMORY_PREPOPULATED_ID }}
id: tests
timeout-minutes: ${{ matrix.timeout }}
run: |
Expand Down
43 changes: 38 additions & 5 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,49 @@ uv run pytest tests_integ/runtime -xvs --log-cli-level=INFO
## Memory

```bash
# Required env vars for all memory tests
export MEMORY_KINESIS_ARN=<Kinesis Data Stream ARN>
export MEMORY_ROLE_ARN=<IAM role ARN trusted by bedrock-agentcore.amazonaws.com with kinesis:PutRecord/PutRecords permissions>
export MEMORY_PREPOPULATED_ID=<ID of a memory with pre-extracted data for retrieval tests>

# Control plane (CRUD on memories/strategies, 5-10 min due to provisioning)
uv run pytest tests_integ/memory/test_controlplane.py -xvs -k "integration"

# Stream delivery (requires env vars below, fails if unset)
export MEMORY_KINESIS_ARN=<Kinesis Data Stream ARN>
export MEMORY_ROLE_ARN=<IAM role ARN trusted by bedrock-agentcore.amazonaws.com with kinesis:PutRecord/PutRecords permissions>
# Client (data plane, retrieval, stream delivery, lifecycle)
uv run pytest tests_integ/memory/test_memory_client.py -xvs
```

# Client and developer experience
uv run pytest tests_integ/memory/test_memory_client.py -xvs
### Pre-populated memory setup

Retrieval tests require a memory with data already extracted into `/facts/`, `/preferences/`, and `/summaries/` namespaces. Create one once per account:

```python
from bedrock_agentcore.memory import MemoryClient

client = MemoryClient(region_name="us-west-2")
memory = client.create_memory_and_wait(
name="integ_test_prepopulated",
strategies=[
{"semanticMemoryStrategy": {"name": "Semantic", "namespaces": ["/facts/{actorId}/"]}},
{"userPreferenceMemoryStrategy": {"name": "Preferences", "namespaces": ["/preferences/{actorId}/"]}},
{"summaryMemoryStrategy": {"name": "Summary", "namespaces": ["/summaries/{actorId}/{sessionId}/"]}},
],
event_expiry_days=90,
)
client.save_conversation(
memory_id=memory["memoryId"],
actor_id="integ-test-actor",
session_id="integ-test-session",
messages=[
("I prefer dark mode, Python over Java, and vim over emacs", "USER"),
("Noted! Those are solid developer preferences.", "ASSISTANT"),
("I work on distributed systems at a startup in Seattle", "USER"),
("Interesting! Distributed systems is a great field.", "ASSISTANT"),
],
)
# Wait a few minutes for extraction, then verify:
# client.retrieve_memories(memory_id=memory["memoryId"], namespace="/facts/integ-test-actor/", query="developer")
print(f"MEMORY_PREPOPULATED_ID={memory['memoryId']}")
```

## Identity
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ignore_missing_imports = false

[tool.ruff]
line-length = 120
include = ["examples/**/*.py", "src/**/*.py", "tests/**/*.py", "tests-integ/**/*.py"]
include = ["examples/**/*.py", "src/**/*.py", "tests/**/*.py", "tests_integ/**/*.py"]
exclude = ["**/*.md"]

[tool.ruff.lint]
Expand Down
Loading
Loading