Menu
Schemas

Interaction Models

Data structures for user interactions — publishing, searching, retrieving, and deleting interactions.

ToolUsed

Tracks a tool the agent used during an interaction. Multiple tools can be used per interaction.

PropTypeDefaultDescription
tool_namestring—Name of the tool used
tool_data?object{}Tool metadata: input, output, latency, etc.
status?string""Outcome of the call, e.g. "success" or "failed". Accepted leniently: any value is stringified and truncated to 100 characters, so it never fails validation. Agent plugins commonly send this, which is why it is a declared field rather than an ignored unknown one.

RetrievedLearning

A learning (profile, user playbook, or agent playbook) the caller retrieved from Reflexio and injected into the agent context before the agent responded. Attach every injected learning—not only the ones that visibly changed the answer—so evaluated sessions receive detailed per-learning relevance and impact analysis. These stable identities also provide attribution data for future optimization of retrieved learnings. See Retrieved-learning evaluation.

PropTypeDefaultDescription
kind"profile" | "user_playbook" | "agent_playbook"—Which kind of learning this references
learning_idstring—Stable storage id — profile_id for profiles, user_playbook_id / agent_playbook_id (as decimal strings) for playbooks
exposure_receipt?string | nullnullOpaque signed receipt returned with a searched user playbook. Carry it unchanged when publishing that injected learning; maximum 8192 characters. Optional for older clients.
exposure_receipt_digest?string | nullnullRead-only SHA256 digest of the submitted receipt, returned with stored interactions. The raw receipt is not retained in the interaction. Do not supply this as proof of a served version.

Managed user-playbook exposure evidence is recorded with the published interaction, not during search. A verified receipt preserves the version originally returned, even if the playbook was edited before publication. References without a valid receipt remain supported and contribute incomplete evidence; the server does not infer the old served version from the current playbook. Keep receipts in your pending publish queue and reuse the same request identity on retries.

Citation

A learning the agent claims actually influenced its response — the narrower counterpart to RetrievedLearning, which records everything injected whether it helped or not. Attach citations on the Assistant turn so retrieval attribution can distinguish learnings that shaped the answer from learnings that were merely present.

PropTypeDefaultDescription
kind"profile" | "user_playbook" | "agent_playbook" | "playbook"—Which kind of cited item this references. "playbook" is a legacy compatibility value
real_idstring—Stable storage id — profile_id for profiles, user_playbook_id / agent_playbook_id for playbooks
tag?string""Injection-time rank tag (e.g. "r1-301"). Per-injection and not stable across sessions; a debug aid only
title?string""Short human-readable label for logs and UI

Interaction

Represents information about a user interaction stored in the system.

PropTypeDefaultDescription
interaction_id?integer0Unique identifier for the interaction
user_idstring—Identifier of the user
request_idstring—Identifier of the request
created_at?integerCurrent timeUnix timestamp when interaction was created
role?string"User"Role of the interaction participant
content?string""Text content of the interaction
shadow_content?string""Alternative agent response for A/B testing
expert_content?string""Expert's ideal response for comparison-based playbook extraction
user_action?UserActionTypeNONEType of user action
user_action_description?string""Description of the user action
interacted_image_url?string""URL of any associated image
tools_used?list[ToolUsed][]Tools used during this interaction
citations?list[Citation][]Learnings the agent claims actually influenced this response — the narrower counterpart to retrieved_learnings
retrieved_learnings?list[RetrievedLearning][]Learnings retrieved from Reflexio and injected into the agent context for this turn — everything injected, whether or not it helped

InteractionData

Model for user-provided interaction information (also called InteractionRequest).

Every interaction must carry something. An interaction with no content, shadow_content, expert_content, interacted_image_url, image_encoding, tools_used, citations, retrieved_learnings, and a user_action of none carries no information and can never produce a learning, so it is dropped from the batch. Your other interactions publish normally, so a single empty placeholder turn never fails the request. Whitespace-only text does not count as content. The response's warnings records how many interactions were skipped and at which indices.

A publish where every interaction is empty returns a 422: there is nothing to learn from.

json
// POST /api/publish_interaction
{"user_id": "user_123", "session_id": "session_abc",
 "interaction_data_list": [{"role": "User"}, {"role": "Agent"}]}

// 422 Unprocessable Entity
// every interaction is empty: at least one must set "content" (or any of: ...)

Two further rules return a 422, because they are contradictions rather than absences: a user_action other than none requires a user_action_description, and interacted_image_url and image_encoding cannot both be set. The message names the offending interaction_data_list index. All of these apply on both the synchronous and the default asynchronous publish path.

Unrecognised field names are ignored, but reported. Every field below is optional with a default, so a misspelled key binds to nothing and its value is discarded — a mis-keyed content produces an interaction that is then dropped as empty. As long as one interaction survives, the request still succeeds; if the mis-keying empties every interaction, you get the 422 above, and its message names the offending field. On success, the response's warnings names the unrecognised fields and the interaction_data_list index each appeared on, including nested paths such as tools_used[0].stat. Read that list; a correctly-shaped payload produces no payload warnings.

Two qualifications. The list is bounded — at most 5 names per interaction and 20 entries overall, each with a +N more suffix — so on a large broken batch treat it as a sample rather than an inventory. And per-interaction user_id and session_id are stripped without a warning, because callers routinely repeat those request-level fields on every interaction; their absence from the list is not evidence that they bound.

Still build your payload from an allowlist of the fields below rather than passing an internal record through — the warning tells you a field was dropped, it does not stop the drop.

PropTypeDefaultDescription
created_at?integerCurrent timeUnix timestamp when interaction was created
role?string"User"Role of the interaction participant (e.g., "User", "Agent")
content?string""Text content of the interaction
shadow_content?string""Alternative agent response for A/B testing
expert_content?string""Expert's ideal response for comparison-based playbook extraction
user_action?UserActionTypeNONEType of user action
user_action_description?string""Description of the user action
interacted_image_url?string""URL of any associated image
image_encoding?string""Base64 encoded image data
tools_used?list[ToolUsed][]Tools used during this interaction
citations?list[Citation][]Learnings the agent claims actually influenced this response — the narrower counterpart to retrieved_learnings
retrieved_learnings?list[RetrievedLearning][]Learnings retrieved from Reflexio and injected into the agent context for this turn — everything injected, whether or not it helped

PublishUserInteractionRequest

Request model for publishing user interactions.

PropTypeDefaultDescription
user_idstring—Identifier of the user
interaction_data_listarray[InteractionData]—List of interaction data
source?string""Non-sensitive producer/workflow label. A non-empty value must match `^[a-z0-9][a-z0-9._:-]{0,127}$` and must not contain user identifiers or PII. Evaluation source-set comparison groups a session by the source on its first request.
agent_version?string""Version of the agent generating interactions
session_idstring—Non-empty session identifier for related requests
skip_aggregation?booleanfalseWhen true, extract profiles/playbooks but skip aggregation
session_finished?boolFalseOptional completion hint. Evaluates the saved prefix through the judge without requiring a full window. Later publications remain valid.
force_extraction?booleanfalseWhen true, bypass stride_size checks and always run extractors. Does not bypass an active provider auth/billing stall.
evaluation_only?booleanfalseWhen true, store the request for session-level evaluation while permanently excluding it from profile/playbook extraction. Intended for offline/evaluation-only traffic, not retrieval-experiment holdouts. Requires session_id and cannot be combined with force_extraction.
override_learning_stall?booleanfalseWhen true, run extraction even when Reflexio has recorded a provider auth/billing stall. Use only for explicit retries after reauth or limit reset.
retrieval_experiment_id?string—Experiment ID returned by the search that served this response. Must be sent together with retrieval_experiment_arm.
retrieval_experiment_arm?"treatment" | "holdout"—User arm returned by search. The server verifies it against the deterministic assignment. Must be sent together with retrieval_experiment_id.

PublishUserInteractionResponse

Response model for interaction publication requests. Both publish paths return the request ID, routing details, and durable admission result. Creation counts reflect committed extraction windows covering this request, and can be zero while extraction is pending.

PropTypeDefaultDescription
successboolean—Whether the publication was successful
message?string""Additional information about the operation
warnings?array[string][]Non-fatal problems. Payload warnings — fields that could not be bound, interactions skipped as empty — are returned on both publish paths, and a correctly-shaped payload produces none; see InteractionData. Admission warnings, including the provider-stall notice, are returned on both paths. The list is bounded.
request_id?string—Server-assigned request ID. Returned on BOTH paths — including the deferred one (wait_for_response=False) — so you can poll get_learning_status immediately.
endpoint_url?string—Endpoint URL the publish landed on (both publish paths)
storage_type?string—Storage backend that handled the publish (both publish paths)
storage_label?string—Masked storage label (both publish paths)
profiles_added?integer—Profiles created by extraction (both publish paths)
profiles_updated?integer—Profiles updated by extraction (both publish paths)
playbooks_added?integer—Playbook entries created by extraction (both publish paths)
playbooks_updated?integer—Playbook entries updated by extraction (both publish paths)
learning_status?string | null—done when all required extraction cursors cover this request, otherwise deferred. A synchronous timeout does not cancel accepted work.
learning_reason?string | null—Coverage or waiting reason, including waiting_for_window, queued, retrying, waiter_capacity, and wait_timeout.

SearchInteractionRequest

Request model for searching user interactions.

PropTypeDefaultDescription
user_idstring—Identifier of the user
request_id?string—Filter by specific request ID
query?string—Semantic search query
start_time?datetime—Filter interactions from this time
end_time?datetime—Filter interactions until this time
top_k?integer—Maximum number of results to return
most_recent_k?integer—Return most recent k interactions
threshold?floatmodel-specificSimilarity threshold for the vector arm. Omit it to use the embedding model's default.
search_mode?SearchMode"hybrid"Search mode: "vector", "fts", or "hybrid"

SearchInteractionResponse

Response model for interaction search requests.

PropTypeDefaultDescription
successboolean—Whether the search was successful
interactionsarray[Interaction]—List of matching interactions
msg?string—Additional message

GetInteractionsRequest

Request model for getting user interactions.

PropTypeDefaultDescription
user_idstring—Identifier of the user
start_time?datetime—Filter by start time
end_time?datetime—Filter by end time
top_k?integer30Maximum number of results to return

GetInteractionsResponse

Response model for getting user interactions.

PropTypeDefaultDescription
successboolean—Whether the request was successful
interactionsarray[Interaction]—List of interactions
msg?string—Additional message

DeleteUserInteractionRequest

Request model for deleting a user interaction.

PropTypeDefaultDescription
user_idstring—Identifier of the user
interaction_idinteger—Identifier of the interaction to delete

DeleteUserInteractionResponse

Response model for interaction deletion requests.

PropTypeDefaultDescription
successboolean—Whether the deletion was successful
message?string""Additional information about the operation