SearchContext
Searches the context.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
agentloop:SearchContext |
get |
*ContextStore
|
None | None |
Request syntax
POST /agentspace/{agentSpace}/contextstore/{contextStoreName}/context/search HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| agentSpace |
string |
Yes |
The name of the AgentSpace. The length must be 2 to 64 characters. |
my-agent-space |
| contextStoreName |
string |
Yes |
The name of the context store. The length must be 2 to 64 characters. |
my-context-store |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The retrieval request body. |
|
| strategyIds |
array |
No |
Filters results by extraction strategy IDs. Multiple IDs in the list are evaluated with an OR operator. If this parameter is not specified, all strategies are recalled. An empty list returns a 400 error. If the format is valid but no matching IDs are found, an empty result is returned. Historical removed strategy IDs are supported. |
["preferences","profile"] |
|
string |
No |
The extraction strategy ID. |
preferences |
|
| query |
string |
Yes |
The retrieval query text. Natural language is supported. |
Recent user preferences |
| formatted |
boolean |
No |
Specifies whether to apply structured formatting to the returned results. |
true |
| filter |
object |
No |
The structured filter conditions. The experience store supports the scene field. When __agentloopControl.mode is set to direct, hybrid, or agentic, multi-strategy recall with auditing is used. You can pass source, callId, application, fields, channels, and budget simultaneously. The management plane can additionally pass contentStatus=all, active, candidate, gray, or deprecated to perform content retrieval, which includes disabled or unreviewed content and is not affected by store-level runtime switches. The API key runtime entry prohibits contentStatus and retains the original governance thresholds. The maximum value for timeoutMs is 60000. If mode is not passed, the existing semantics of fields, channels, minQualityScore, expansion, and debug are retained. When query is *, you can use includeCandidates, cursor, and offset to browse experiences in the management plane only. |
{"scene":"incident-recovery","__agentloopControl":{"fields":["when_to_use","summary"],"channels":["vector","fulltext"],"minQualityScore":0.6,"expansion":false,"debug":true}} |
|
any |
No |
The value of the filter condition. The data type varies based on the field. |
alice |
|
| limit |
integer |
No |
The maximum number of returned results based on the top-N similarity. |
10 |
| threshold |
number |
No |
The similarity threshold. Results with a score below this value are filtered out. Valid values: 0 to 1. |
0.5 |
| retrievalOption |
string |
No |
The retrieval options. The experience store supports normal and reranker for deterministic reranking. The memory store uses its own retrieval strategy. For real-time recall in the experience store, the limit ranges from 1 to 20. |
normal |
| scope |
object |
No |
The recall scope. If this field conflicts with a field of the same name in the filter, a 400 ScopeFilterConflict error is returned. |
|
| userId |
string |
No |
The user ID. |
u-10001 |
| agentId |
string |
No |
The agent identifier. |
sales-copilot |
| appId |
string |
No |
The application ID. |
crm-service |
| runId |
string |
No |
The run ID. |
run-001 |
| includeInactive |
boolean |
No |
Specifies whether to include memories with sourceState set to inactive. Default value: false. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| callId |
string |
The call ID for the multi-strategy recall of the experience store. |
550e8400-e29b-41d4-a716-446655440000 |
| status |
string |
The processing status of the current experience recall call. Examples include success, degraded, failed, or error. |
success |
| mode |
string |
The actual experience recall mode used for the current call. Valid values: direct, agentic, or hybrid. |
agentic |
| strategyVersion |
string |
The implementation version of the strategy used for the current experience recall. This is used for auditing and result tracing. |
experience-recall-20261031-v5 |
| rewrittenQueries |
array |
The list of rewritten queries generated based on the original retrieval question. The original query is not included. |
["How to avoid repeatedly executing unchanged inputs"] |
|
string |
A rewritten query used to retrieve candidate experiences. |
How to avoid repeatedly executing unchanged inputs |
|
| relevance |
array<object> |
The list of relevance judgment results for candidate experiences. |
[ { "contextId": "a:1", "judgment": "relevant", "reason": "This experience explains how to skip tasks with unchanged inputs, which is relevant to the retrieval question." } ] |
|
object |
The relevance judgment result for a candidate experience. |
{ "contextId": "a:1", "judgment": "relevant", "reason": "This experience explains how to skip tasks with unchanged inputs, which is relevant to the retrieval question." } |
|
| diagnostics |
object |
The diagnostics information for the current experience recall, including execution duration, model call volume, and filtering. The actual diagnostic items are determined by the running mode. |
{ "durationMs": 386.5, "modelCalls": 2, "relevanceValidation": "semantic", "candidateCount": 1, "filtering": { "model_not_relevant": 0 } } |
|
any |
The value of a single diagnostic item. The specific data type varies based on the diagnostic item. |
0 |
|
| requestId |
string |
The request ID. This is used to locate the current request during troubleshooting. |
9ACFB10A-1B2C-3D4E-5F6G-7H8I9J0K1L2M |
| recallEventId |
string |
The recall event ID. You can use this ID to call GetContextStoreRecall to view audit details. |
0190f1c2-7d3e-7a1b-9c4d-2e5f6a7b8c9d |
| auditStatus |
string |
The audit write status. Valid values: ok and degraded. |
ok |
| results |
array<object> |
The list of retrieval results, sorted by similarity in descending order. Each item includes contextId, context, metadata, score, rank, revision, strategyVersion, and strategyId. |
[{"contextId":"01a1cf08-c368-7c83******","strategyId":"default","context":"The assistant recommends steamed seafood because it is fresh and not spicy, which aligns with the user's preference for seafood and constraint against spicy food.","metadata":{"contextType":"memory","memoryType":"long","userId":"test_user_002","agentId":"95273000000000","appId":"mm_480d961******","runId":"jr-80ded1d6******","strategyId":"default","category":"recommendation","kind":"state","sourceKind":"api","sourceId":"addctx:75395808-cb81-54cd******","revision":1,"reviewStatus":"unreviewed","sourceState":"active","factKey":"assistant:recommendation:dish******","sessionId":"test_session_001"},"score":0.6617179,"rank":1,"revision":1,"strategyVersion":1}] |
|
object |
A single retrieval result. The structure aligns with the storage fields of the context store. |
{"contextId":"01a1cf08-c368-7c83******","strategyId":"default","context":"The assistant recommends steamed seafood because it is fresh and not spicy, which aligns with the user's preference for seafood and constraint against spicy food.","metadata":{"contextType":"memory","memoryType":"long","userId":"test_user_002","agentId":"95273000000000","appId":"mm_480d961******","runId":"jr-80ded1d6******","strategyId":"default","category":"recommendation","kind":"state","sourceKind":"api","sourceId":"addctx:75395808-cb81-54cd******","revision":1,"reviewStatus":"unreviewed","sourceState":"active","factKey":"assistant:recommendation:dish******","sessionId":"test_session_001"},"score":0.6617179,"rank":1,"revision":1,"strategyVersion":1} |
|
|
any |
The values of the fields in the search results. The data type varies by field. |
User preference: concise answers |
Examples
Success response
JSON format
{
"callId": "550e8400-e29b-41d4-a716-446655440000",
"status": "success",
"mode": "agentic",
"strategyVersion": "experience-recall-20261031-v5",
"rewrittenQueries": [
"How to avoid repeatedly executing unchanged inputs"
],
"relevance": [
{
"contextId": "a:1",
"judgment": "relevant",
"reason": "This experience explains how to skip tasks with unchanged inputs, which is relevant to the retrieval question."
}
],
"diagnostics": {
"key": "0"
},
"requestId": "9ACFB10A-1B2C-3D4E-5F6G-7H8I9J0K1L2M",
"recallEventId": "0190f1c2-7d3e-7a1b-9c4d-2e5f6a7b8c9d",
"auditStatus": "ok",
"results": [
{
"key": "用户偏好:简洁回答"
}
]
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.