Cosmos DB TTL for Ephemeral Prompts
Findable’s flow designer creates ephemeral prompt templates in theprompts container when human input nodes execute. These are short-lived documents (prefixed eph-) that are automatically cleaned up through three mechanisms:
- Active deletion — The orchestrator deletes the prompt immediately after receiving a response.
- Periodic sweep — A background job (
/server/jobs/ephemeral-cleanup) runs every 6 hours to catch any that were missed. - Cosmos DB TTL — Each ephemeral prompt sets a
_ttlfield (in seconds). Cosmos DB will auto-delete expired documents if TTL is enabled on the container.
Enabling TTL on the Prompts Container
For new deployments, TTL is configured automatically — the server passesdefaultTtl: -1 when creating the prompts container via createIfNotExists.
For existing deployments where the prompts container already exists, createIfNotExists will not update the container’s TTL setting. You must enable it manually:
Option A: Azure Portal
- Navigate to your Cosmos DB account in the Azure Portal
- Open Data Explorer
- Expand your database and select the
promptscontainer - Click Settings (or Scale & Settings)
- Under Time to Live, select On (no default)
- This sets
defaultTtl = -1, which means “no container-wide expiry, but honour per-item_ttlvalues”
- This sets
- Click Save
Option B: Azure CLI
Option C: Azure PowerShell
Verifying TTL is Active
After enabling, you can verify in the Portal by checking that the container’s Time to Live setting shows On (no default). New ephemeral prompts will then be auto-deleted by Cosmos DB after their_ttl expires (typically 1 hour).
Note: Even without TTL enabled, ephemeral prompts are still cleaned up by the active deletion and periodic sweep mechanisms. TTL is a defense-in-depth measure for edge cases like server crashes or flow timeouts.
Cosmos DB Container Reference
Containers are grouped by purpose. Partition keys are chosen to match the dominant query pattern:/id for shared/global resources, /email for per-user data, and purpose-specific keys (/executionId, /flowId, /assigneeEmail, /createdBy) where reads are scoped to a particular execution, flow, or owner.
Core & content library
| Container | Partition Key | Description |
|---|---|---|
settings | /id | Application-wide settings (single "default" document) |
chat | /id | Chat tab configurations (IChatTabDBItem) — data source, AI options, ACL |
prompts | /id | Prompt templates and groups (per-item TTL for ephemeral prompts) |
flows | /id | Flow Designer flow definitions and flow groups |
pages | /id | Navigation pages (hierarchical via parentPageId) |
AI & tools
| Container | Partition Key | Description |
|---|---|---|
aimodelendpoints | /id | AI model endpoints (Azure OpenAI, OpenAI, Anthropic, Gemini, etc.) |
aisearchendpoints | /id | Azure AI Search endpoint configurations |
aitoolproviders | /id | Tool provider configs (Tavily, SQL, Cosmos, Exchange, OneDrive, etc.) |
mcpservers | /id | MCP server registry entries |
datasources | /id | Datasource catalog entries |
dataconnections | /id | SQL/database connection configs for NL-SQL |
Per-user data (partitioned by /email)
| Container | Partition Key | Description |
|---|---|---|
chatlog | /email | Conversation history — every message exchange with timestamps and citations |
feedback | /email | User feedback (thumbs up/down) on AI responses |
usersettings | /email | Per-user settings (language, drawer state, AI defaults, memory preferences) |
userfavorites | /email | User-bookmarked prompts, flows, and chats |
usertheme | /email | Per-user Material UI theme preferences |
usernotifications | /email | In-app notifications for human-in-the-loop workflows |
usernotificationpreferences | /email | Notification channel preferences (email, Teams, Slack, SMS) |
datasourcelastaccessed | /email | Per-user data source activity (used by purge job) |
onedrivelastaccessed | /email | Per-user OneDrive activity (used by purge job) |
userrecommendations | /email | Cached recommendations doc (singleton per user) |
recommendationfeedback | /email | Per-user feedback on recommendations |
recommendationsaved | /email | Recommendations saved into the user’s prompt library |
Flow execution & human input (TTL-enabled)
| Container | Partition Key | Description |
|---|---|---|
humaninput | /executionId | Active human-input requests awaiting response (per-item TTL) |
flowcheckpoints | /executionId | Flow execution checkpoints for resume (per-item TTL) |
flowexecutions | /flowId | Flow execution runs — “show runs for this flow” (per-item TTL) |
flowexecutionsteps | /executionId | Per-step execution trace (per-item TTL) |
Assignments
| Container | Partition Key | Description |
|---|---|---|
assignments | /assigneeEmail | Per-assignee obligations — pushed chats/flows with completion tracking, deadlines, and delegation |
assignmentschedules | /createdBy | Recurring assignment templates owned by their creator |
Integrations & operations
| Container | Partition Key | Description |
|---|---|---|
sharepointentitlements | /id | SharePoint per-user entitlement registry |
teamsappicons | /id | Cached Teams app icons |
teamsconversationreferences | /id | Teams conversation references for proactive messaging |
jobs | /id | Periodic-job throttle records (sweep, cleanup, purge) |
Partition-key strategy./idis the default for shared/global resources where queries are by document ID./executionIdcolocates everything related to a single flow run./flowIdcolocates execution runs by flow./assigneeEmailmirrors the/createdBymirrors it for owner-scoped recurring schedules. TTL behaviour. TTL-enabled containers setdefaultTtl: -1so Cosmos honours per-item_ttlvalues without applying a container-wide expiry. Items written without_ttllive forever; ephemeral items (e.g. unresolved human-input requests, ephemeral prompts) set_ttland are auto-deleted by Cosmos after expiry. A periodic sweep (ephemeralcleanup,humaninputcleanup,assignmentsweep) provides a defence-in-depth fallback in case TTL is disabled at the container level (which can happen whencreateIfNotExistsis called against a pre-existing container that was created without TTL).