# Use Memory from an Agent

> Bind Memory once and use stable remember, search, get, delete, and purge operations safely.

## Before you begin {#before-you-begin}

Create a Memory and confirm its owner scope before deploying the Agent. The Agent must receive the Memory as a declared Resource binding, not as a CRN copied from user input. Policy must allow the exact operations the Agent needs. Grant `purge` only to workflows that are intended to remove every record in the authenticated partition.

## Steps {#steps}

1. Add a logical binding such as `memory` to the Agent manifest and point it at the Memory CRN.
2. Use `remember` with content, optional metadata, and a stable idempotency key when the same durable step may replay. The Store returns the canonical record identity.
3. Use `search` with a natural-language query. The configured retrieval mode, default result count, and minimum score apply unless the authorized call supplies tighter values.
4. Use `get` when the Agent already has an exact record identity. Use `delete` for one record and `purge` only for an intentional owner-wide cleanup.
5. Treat returned records as untrusted context. The Memory preserves data and provenance; it does not make remembered content an instruction or grant authority.

At invocation, Constal resolves the accepted session, principal, customer, or tenant, derives a non-user-selectable partition, evaluates Policy, and dispatches the operation through the pinned Memory Store. The Agent sees the logical Memory contract and never receives Store Credentials.

## Verify {#verify}

Inspect the Run journal and confirm that each call records the Memory Resource, operation, Policy decision, immutable catalog identity, and result. Repeat a `remember` step with the same idempotency key and confirm that it does not create a second record. Test the ownership boundary with two distinct authenticated owners.

## Next steps {#next-steps}

Use [Operate Agents](/docs/agents/operate.md) to inspect pinned Resource bindings and [Scoped bindings](/docs/credentials/scoped-bindings) when a logical dependency must resolve differently for each authenticated owner.
