AgentLoop Data Query API Usage Guide
AgentLoop is not a monolithic database in which a single List API returns all data. Identify the object first, and then choose the control-plane API or the data-plane API.
1. Scope
Object to query | Recommended query plane | Typical locator keys | Current availability |
AgentSpace | AgentLoop API |
| Public and stable |
Raw Trace / Span | Locate the Trace Logstore through CMS, and then query it through SLS |
| Data plane: SLS |
Session | Query by the Session field in a Trace or Trajectory |
| No unified List Session API |
Raw Agent events | In the AgentSpace SLS Project: |
| Available after you enable the corresponding integration |
Agent Trajectory | In the AgentSpace SLS Project, query |
| Data plane: SLS |
Trajectory feature views |
|
| Available after you enable trajectory feature processing |
Dataset metadata | AgentLoop API |
| Public and stable |
Dataset data rows | AgentLoop | Dataset | Public and stable |
Memory store / experience store metadata | AgentLoop ContextStore API |
| Public and stable |
Memory / experience content | AgentLoop | Natural language query + identity/metadata filters | The primary public read method |
Memory write events |
| Scope, | One per Memory ContextStore |
Evaluators, evaluation tasks, and evaluation runs | AgentLoop API |
| Control-plane query |
Evaluation result details | In the AgentSpace SLS Project: |
| Data plane: SLS |
Playground run details | In the AgentSpace SLS Project: | Run ID, input, output, and score | Available after you use Playground |
Experiment plans and experiment records | AgentLoop API |
| Control-plane query |
Per-sample experiment results |
|
| Data plane: SLS |
Audit and security events | The audit-related Logstores in the AgentSpace SLS Project | Event/Incident ID, risk type, and evidence ID | Available after you enable auditing |
Token and cost efficiency data |
| Trajectory/Step/Run/Window ID | Available after you enable efficiency analysis |
Pipeline definitions, runs, and statistics | AgentLoop API |
| Public and stable |
Business data produced by a Pipeline | The target Dataset | Dataset Item ID and lineage fields | You must query the Dataset again to verify delivery |
The most important object boundaries are:
A Trace is the raw record of a call. A Trace usually consists of multiple Spans.
A Session is a correlation boundary across turns or calls, and is not equivalent to one complete Trace.
A Trajectory is an ordered behavior process cleaned and assembled from Traces. It is not another name for a Trace.
A Dataset is a set of structured samples materialized for querying, labeling, evaluation, experiments, and reuse.
Memory records the long-term context of a user, Agent, application, or task. Experience records practices, failure patterns, and applicable boundaries that you can reuse across tasks.
A successful Pipeline Run only proves that the processing task finished. Data delivery is proven only when you read the data back from the target Dataset and it satisfies the field contract.
Evaluation completion, experiment completion, version release, and business improvement are different layers of evidence and cannot replace one another.
This topic describes read operations only. Unless otherwise specified, it does not use operations that change the state of your cloud resources, such as Create, Update, Delete, Run, Pause, Resume, and Terminate.
2. Query architecture
┌─────────────────────────────┐
│ AgentLoop API 2026-05-20 │
│ AgentSpace / Dataset / │
│ ContextStore / Pipeline / │
│ Evaluation / Experiment │
└──────────────┬──────────────┘
│ Control plane, structured queries
▼
Client / SDK / Aliyun CLI ───────────────── AgentLoop
│ │
│ ├─ Dataset ExecuteQuery
│ └─ Context SearchContext
│
├─ CMS API 2024-03-30 ── Locates the XTrace Store through EntityStore; compatible with legacy Memory API
│
└─ SLS API 2020-12-30 ── Trace / Trajectory / Evaluation / Experiment detailsStart with the AgentSpace metadata, because it provides the three locators that matter most for the queries that follow:
regionId: the region where the resource resides.cmsWorkspace: the CMS Workspace that the raw Trace belongs to.slsProject: the SLS Project where AgentLoop derived data is stored. Common data includes Trajectories, evaluation details, and experiment details.Do not assume that
cmsWorkspace, the Trace Project, and the AgentSpaceslsProjectare the same value.
3. Preparations
3.1 Prepare the CLI
aliyun version
aliyun plugin show --name agentloop
aliyun plugin show --name aliyun-cli-sls
aliyun configure list
jq --versionSLS log queries use get-logs-v2. Before you integrate formally, use Help to check the parameters that your current client supports:
aliyun agentloop <command> --help
aliyun sls get-logs-v2 --help3.2 Identity and credentials
You can use an existing Aliyun CLI profile, STS, OAuth, or a RAM role. For production programs, prefer temporary credentials or an instance role. Do not write AK/SK pairs, SecurityToken values, ContextStore API keys, cookies, or signed URLs into code, documentation, logs, or Git.
The examples in this topic consistently use placeholders and separate variables:
AL_REGION='<region-id>'
AL_AGENT_SPACE='<agent-space-name>'
AL_PROFILE='<aliyun-cli-profile>'If you use a named profile, carry the same profile through the entire query chain. Do not fall back to the default profile partway through.
3.3 Endpoints and API versions
Product | API version | Common endpoint |
AgentLoop |
|
|
CMS |
|
|
SLS |
|
|
Direct HTTP calls must be signed according to the Alibaba Cloud ROA/POP rules. Do not assemble an unsigned curl command. Prefer the official SDK or Aliyun CLI.
3.4 Least privilege
Grant RAM actions based on the object that you read, and avoid using agentloop:* directly:
Scope | Common read-only actions |
AgentSpace |
|
Dataset |
|
ContextStore |
|
Pipeline |
|
Evaluation |
|
Experiment |
|
Locate a Trace data source |
|
SLS data |
|
agentloop:ExecuteQuery RAM actions are not statement-level read-only controls. The caller must still restrict queries to SELECT or a read-only SearchExpr, and cannot rely on RAM to automatically block data modification statements.
4. General query rules
4.1 Fix the query context before every query
Each query request must fix at least the following:
The region
regionId.The AgentSpace.
The data object.
The time range, preferably the half-open interval
[from, to).The pagination limit.
Whether reading sensitive content is allowed, such as prompts, outputs, tool parameters, and memory bodies.
4.2 Do not mix time units
Location | Common time format |
SLS | Unix seconds, half-open interval |
Dataset | Unix seconds, applied to |
In a Trajectory row, | are usually Unix milliseconds. Follow the actual schema. |
Experiment | are millisecond timestamps |
Resource | are ISO 8601 UTC strings |
Perform business time zone conversion on the caller side, and keep the original UTC and epoch values so that report boundaries are not off by one day.
4.3 Pagination has three forms
nextToken + maxResults: most resource lists, such as AgentSpace, Dataset, ContextStore, Evaluator, Evaluation, and Pipeline;offset + limitorpage + pageSize: some Experiment lists;offset + lineor the SQLLIMIT: SLS queries.Do not interpret an empty first page as "no data". Check the time window, the filter conditions,
nextToken, permissions, and data latency.
4.4 Project only the fields you need
Traces, Trajectories, Evaluations, and Memory can contain prompts, model outputs, tool parameters, user identifiers, business content, file paths, or external references. By default, return only:
IDs and lineage fields;
status, duration, tokens, and counts;
the length, hash, and emptiness of content fields;
authorized and redacted summaries.
Read the full content only when troubleshooting genuinely requires it.
4.5 Record request evidence consistently
For every API query, record at least the following:
The region, AgentSpace, and object type;
The API action or the SLS Project and Logstore;
A redacted version of the query window and filter conditions;
requestId;The pagination position;
The number of returned entries, whether the result is truncated, and whether it is complete;
The client version and the query time.
5. Step 1: Query AgentSpace
5.1 List AgentSpaces
aliyun agentloop list-agent-spaces \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--max-results 100If the response contains nextToken, pass it in the next request:
aliyun agentloop list-agent-spaces \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--max-results 100 \
--next-token '<next-token>'5.2 Get an AgentSpace
aliyun agentloop get-agent-space \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE"Key fields to read:
{
"agentSpace": "<agent-space>",
"regionId": "<region-id>",
"cmsWorkspace": "<cms-workspace>",
"slsProject": "<agentloop-sls-project>",
"requestId": "<request-id>"
}Read and save the resource locators required by this query chain in one step:
AGENT_SPACE_JSON=$(aliyun agentloop get-agent-space \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE")
CMS_WORKSPACE=$(printf '%s\n' "$AGENT_SPACE_JSON" | jq -r '.cmsWorkspace // empty')
AGENTSPACE_SLS_PROJECT=$(printf '%s\n' "$AGENT_SPACE_JSON" | jq -r '.slsProject // empty')
RESOURCE_REGION=$(printf '%s\n' "$AGENT_SPACE_JSON" | jq -r '.regionId // empty')Where:
cmsWorkspaceis used to further locate the XTrace Project and Logstore where the raw Traces are stored;slsProjectis the AgentLoop data Project of the current AgentSpace. Query Trajectory, evaluation, and experiment details from this Project;regionIdis the region used by default for subsequent CMS and SLS queries.Completion criteria:
CMS_WORKSPACE,AGENTSPACE_SLS_PROJECT, andRESOURCE_REGIONare all non-empty, and the returnedagentSpacematches the target space. Do not guess the Project or Workspace from the AgentSpace name.
6. Query raw Traces and Spans
6.1 Locate the XTrace Store from AgentSpace
Do not infer the Project of the raw Traces from the AgentSpace name or slsProject. The complete lookup chain is:
AgentSpace
└─ GetAgentSpace → cmsWorkspace
└─ CMS GetEntityStoreData → XTrace project + logstore + region
└─ SLS GetLogsV2 → Trace / SpanFirst, get a Unix-seconds time window for the last 24 hours:
LOOKUP_TO=$(date +%s)
LOOKUP_FROM=$((LOOKUP_TO - 86400))Then query the SLS Logstore entities in the Workspace marked apm.trace_set.storage:
TRACE_STORE_JSON=$(aliyun cms get-entity-store-data \
--api-version 2024-03-30 \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--workspace "$CMS_WORKSPACE" \
--from "$LOOKUP_FROM" \
--to "$LOOKUP_TO" \
--query ".umodel
| where kind = 'sls_logstore'
and json_extract_scalar(metadata, '$.domain') = 'apm'
and json_extract_scalar(metadata, '$.name') = 'apm.trace_set.storage'
| extend project_name = json_extract_scalar(spec, '$.project'),
logstore_name = json_extract_scalar(spec, '$.store'),
region = json_extract_scalar(spec, '$.region')
| project project_name, logstore_name, region")The response uses header to describe the column order and data to return two-dimensional data. For example:
{
"header": ["project_name", "logstore_name", "region"],
"data": [
["<xtrace-project>", "<trace-logstore>", "<trace-region>"]
],
"requestId": "<request-id>"
}Map the following fields by header:
TRACE_PROJECT: theproject_namecolumn;TRACE_LOGSTORE: thelogstore_namecolumn;TRACE_REGION: theregioncolumn; if it is empty, use the AgentSpaceregionId.The following approach reads values dynamically by column name and does not depend on a fixed column order:
TRACE_PROJECT=$(printf '%s\n' "$TRACE_STORE_JSON" | jq -r '
(.header | index("project_name")) as $i
| if $i == null then empty else (.data[0][$i] // empty) end')
TRACE_LOGSTORE=$(printf '%s\n' "$TRACE_STORE_JSON" | jq -r '
(.header | index("logstore_name")) as $i
| if $i == null then empty else (.data[0][$i] // empty) end')
TRACE_REGION=$(printf '%s\n' "$TRACE_STORE_JSON" | jq -r '
(.header | index("region")) as $i
| if $i == null then empty else (.data[0][$i] // empty) end')
TRACE_REGION=${TRACE_REGION:-$RESOURCE_REGION}Do not hardcode logstore-tracing as the only value for all environments. Use the logstore_name that EntityStore actually returns. If no entity is found in the last 24 hours, extend the lookup window to 7 days and confirm that the caller has the cms:GetEntityStoreData permission on the current Workspace.
Optionally, call GetServiceObservability to verify the APM observability instance status and entryPointInfo.project, but Trace queries must still use the Project and Logstore combination returned by EntityStore:
aliyun cms get-service-observability \
--api-version 2024-03-30 \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--workspace "$CMS_WORKSPACE" \
--type apmCompletion criteria: the values read back from the CMS response are a non-empty TRACE_PROJECT, TRACE_LOGSTORE, and an available region, rather than values guessed from naming conventions.
6.2 Verify the XTrace Store
Before you query, verify that the Project and Logstore resolved in the previous step exist and are readable:
aliyun sls get-log-store \
--profile "$AL_PROFILE" \
--region "$TRACE_REGION" \
--project "$TRACE_PROJECT" \
--logstore "$TRACE_LOGSTORE"Completion criteria: the Project and Logstore returned by SLS match the CMS EntityStore lookup result.
6.3 Query all Spans by Trace ID
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$TRACE_REGION" \
--project "$TRACE_PROJECT" \
--logstore "$TRACE_LOGSTORE" \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query 'traceId:"<trace-id>"' \
--line 100 \
--offset 0 \
--reverse falseIf a Trace has more than 100 Spans, increase offset and continue paginating until no new records are returned. Do not judge a Trace to be complete after reading only the first page.
Common fields include:
traceId,spanId, andparentSpanId.serviceNameandoperationName.startTime,duration, andstatusCode.attributes.gen_ai.span.kind.attributes.gen_ai.session.id.attributes.gen_ai.agent.name.The
gen_ai.*attributes for input, output, model, tokens, tools, and so on.Whether a field exists depends on the probe, the framework adaptation, and the redaction configuration. The presence of a Trace does not guarantee that the Tool, Skill, sub-Agent, or business result fields are complete.
6.4 Query Traces by Session
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$TRACE_REGION" \
--project "$TRACE_PROJECT" \
--logstore "$TRACE_LOGSTORE" \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query 'attributes.gen_ai.session.id:"<session-id>"' \
--line 100 \
--offset 0If the integration does not report attributes.gen_ai.session.id, the platform cannot reliably reconstruct a Session from time proximity alone. Do not force two Traces that are close in time into the same business task.
6.5 Verify Trace completeness
Verify at least the following:
The number of Span IDs after deduplication;
Whether parent-child references are closed;
Whether a root Span exists;
Whether the input and output fields are collected according to policy;
Whether the Tool, LLM, and Agent Spans match the actual calls;
Whether the query window covers Spans that arrive late;
Whether all pages have been read.
Completion criteria: you can read back all visible Spans from an explicit
traceIdand can distinguish between "a certain type of call genuinely did not occur" and "missing instrumentation or fields".
7. Query Agent Trajectories
7.1 Data location
The Trajectory Project comes directly from the GetAgentSpace response field slsProject, and the Logstore is agent-trajectory:
AgentSpace
└─ GetAgentSpace → slsProject
└─ SLS Project / agent-trajectoryAfter you obtain AGENTSPACE_SLS_PROJECT as described in section 5.2, verify that the Logstore is readable:
aliyun sls get-log-store \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore 'agent-trajectory'The slsProject here and the XTrace Project of the raw Traces are two separate sets of locators and cannot replace each other:
Data | Project source | Logstore source |
Raw Trace / Span |
| CMS EntityStore → |
Agent Trajectory |
|
|
Completion criteria: GetAgentSpace.slsProject is not empty, and GetLogStore successfully returns information about agent-trajectory.
If slsProject is empty, or GetLogStore returns that the resource does not exist, first confirm that the current AgentSpace has produced Agent trajectories and that the caller has read permissions. Do not substitute the XTrace Project.
7.2 Query a list
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore 'agent-trajectory' \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query '*' \
--line 100 \
--offset 0 \
--reverse true7.3 Query by different identifiers
# By Trajectory ID
--query 'trajectory_id:"<trajectory-id>"'
# Follow a raw Trace to Trajectory
--query 'trace_id:"<trace-id>"'
# Query trajectories for one Session
--query 'session_id:"<session-id>"'
# Query an Agent application
--query 'service_names:"<service-name>"'
# Query trajectories that include a tool
--query 'tool_names:"<tool-name>"'
# Restrict step count and duration
--query 'step_count >= 10 AND duration_ms >= 5000'Common query fields for a Trajectory include:
Lineage:
trajectory_id,previous_trajectory_ref,trace_id,terminal_span_id,session_id, andturn_id.Time and scale:
start_time,end_time,duration_ms, andstep_count.Model and tokens:
models,model_call_count,total_tokens,input_tokens,output_tokens, andcached_tokens.Tools and Skills:
tool_names,tool_call_count,tool_errors,skill_ids,skill_names, andskill_call_count.Agent:
agent_name,agent_version,subagent_trajectory_ids, andsub_agent_count.Content:
input,output,atif_content,model_calls,tool_calls, andskills.Data quality:
degraded,degraded_reason,input_empty_reason, andversion.Fields can change with the cleaning version. Consumers should allow new fields and handle compatibility based on
versionorcleaning_version, instead of assuming a fixed column order.
7.4 Content and ATIF
atif_content can be very large. A list page should not read or display the complete ATIF. Pull the full content only in a detail query, by trajectory_id. For an exceptionally large input/output, return only the first few characters and explicitly mark truncated=true. Do not truncate silently.
Completion criteria: you can read ordered behavior data by trajectory_id or trace_id, and you can determine whether the data is degraded, whether the content is truncated, and what the cleaning version is.
8. Query Datasets
8.1 List Datasets
aliyun agentloop list-datasets \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--max-results 100You can use --dataset-name to filter precisely. If nextToken is returned, continue paginating.
8.2 Query a Dataset schema
aliyun agentloop get-dataset \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>'Read the schema first, and then generate the query. Common field types include text, long, double, and json. System fields are commonly id, __time__, and internal sequence fields. Clients must not depend on internal sequence fields.
8.3 SQL SELECT
aliyun agentloop execute-query \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>' \
--type SQL \
--query 'SELECT id, __time__, question, answer, trace_id FROM <dataset-name> ORDER BY __time__ DESC LIMIT 100'Query rules:
Use only single-Dataset
SELECT.Do not use JOIN, UNION, INTERSECT, EXCEPT, or subqueries.
Explicitly list the fields and
LIMIT.Do not concatenate user input directly into SQL.
SELECTwithoutLIMITreturns at most 1,000 rows by default. The per-query limit is subject to the API reference of the target region and the actual response.
8.4 Time windows, pagination, and truncation
aliyun agentloop execute-query \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>' \
--type SQL \
--query 'SELECT id, question, answer FROM <dataset-name> ORDER BY __time__ DESC' \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--offset 0 \
--length 100 \
--max-output-length 4096maxOutputLength: when truncation occurs, check the response field meta.truncation. Do not treat truncated text as a complete sample.
8.5 SearchExpr
# Keywords, numeric conditions, and Boolean conditions
aliyun agentloop execute-query \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>' \
--type SQL \
--query 'question:"timeout" AND score >= 0.8'SearchExpr supports comparison, AND/OR/NOT, parentheses, field:value, field:*, and prefix matching. Do not use IN, BETWEEN, LIKE, IS NULL, arbitrary functions, or JSON Filter DSL on the SearchExpr side.
8.6 Semantic search
The target field must have embedding enabled in the Dataset schema.
# Distance threshold. A smaller value usually indicates greater similarity
aliyun agentloop execute-query \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>' \
--type SQL \
--query 'similarity(question, "<semantic-query>") < 0.3'
# Top-K
aliyun agentloop execute-query \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>' \
--type SQL \
--query 'topk(question, "<semantic-query>") <= 10'
# SQL distance ordering
aliyun agentloop execute-query \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--dataset-name '<dataset-name>' \
--type SQL \
--query 'SELECT id, question, semantic_distance(question, "<semantic-query>", "l2") AS distance FROM <dataset-name> ORDER BY distance ASC LIMIT 10'8.7 The response is not an object array
ExecuteQuery returns columns and two-dimensional rows separately:
{
"columns": ["id", "question", "score"],
"columnTypes": ["text", "text", "double"],
"rows": [
["<id-1>", "<question-1>", 0.95],
["<id-2>", "<question-2>", 0.91]
],
"meta": {
"progress": "Complete",
"count": 2,
"truncation": {"truncated": false}
},
"requestId": "<request-id>"
}The caller must use columns[j] to interpret rows[i][j].
Completion criteria: the schema matches the query fields, meta.progress indicates completion, all pages are read, the truncation state is handled, and the key lineage fields are not empty.
9. Query memory and experience stores
9.1 Unified object: ContextStore
The current AgentLoop API uses ContextStore to represent context stores in a unified way:
contextType=memory: a memory store;contextType=experience: an experience store.Both can use the same set of List, Get, and Search APIs, but they differ in business meaning, identity isolation, and content source.
9.2 List context stores
# All ContextStore
aliyun agentloop list-context-stores \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--max-results 100
# Memory stores only
aliyun agentloop list-context-stores \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--context-type memory \
--max-results 100
# Experience stores only
aliyun agentloop list-context-stores \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--context-type experience \
--max-results 100In the response, focus on contextStoreName, contextType, status, serviceNames, createTime, updateTime, and nextToken.
9.3 Get a context store configuration
aliyun agentloop get-context-store \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--context-store-name '<context-store-name>'Common configuration items for an experience store include source.agentSpace, source.startTime, serviceNames, metadataField, and miningInterval. A status of Active or Running only reflects the state of the resource or the mining task. It does not prove that recallable content already exists.
For contextType=memory, if the response contains config.innerSource, it directly gives the event source location of that memory store:
{
"contextType": "memory",
"config": {
"innerSource": {
"project": "<agent-space-sls-project>",
"logstore": "memory_events_<32-character-hash>"
}
}
}This Logstore stores short-term events that were written through the Context API and are waiting to be extracted. Long-term memory results are still queried through SearchContext or the corresponding Dataset. The event Project matches the AgentSpace slsProject, and the naming rule is memory_events_ plus MD5(agentSpace + "|" + contextStoreName) as a 32-character lowercase hexadecimal value. Prefer the innerSource returned by the API. If the current SDK parses only general configurations, compute the value by the same rule and verify it with GetLogStore:
AL_CONTEXT_STORE='<context-store-name>'
MEMORY_EVENT_HASH=$(printf '%s' "$AL_AGENT_SPACE|$AL_CONTEXT_STORE" \
| openssl dgst -md5 -r \
| awk '{print $1}')
MEMORY_EVENT_LOGSTORE="memory_events_${MEMORY_EVENT_HASH}"contextType=experience sources are described by config.source.agentSpace and serviceNames. Experience mining reads the Trajectories of that AgentSpace and does not use the identically named memory_events_* Logstore.
9.4 Search memory or experience
aliyun agentloop search-context \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--context-store-name '<context-store-name>' \
--query '<natural-language-query>' \
--filter '{"userId":"<user-id>","agentId":"<agent-id>"}' \
--formatted true \
--limit 10 \
--threshold 0.6The field names used for identity filtering depend on the metadata mapping of the ContextStore. Before you call, confirm the fields through GetContextStore and the product agreement. Do not assume that every store uses userId.
Security requirements:
A memory query must carry sufficient tenant, user, Agent, application, and Run isolation conditions;
An experience query should carry the service, scenario, or other applicable boundaries;
thresholdandlimitmust be calibrated with a real test set;HTTP 200 with an empty
resultsmeans that the request reached the service but no content matched. It does not indicate a service failure;A successful Search does not mean that the recalled content has been injected into the Agent, and it does not mean that quality has improved.
9.5 Query by ID, full export, and audit history
The common read paths for a ContextStore are List, Get, and Search. If your business requires a deterministic full export, traversal by ID, or audit history, prefer one of the following:
Use the officially available Dataset materialization or export solution;
Use a dedicated ContextStore API that is explicitly available in your region;
For an existing legacy MemoryStore, use the CMS-compatible interface described in the next section.
10. Query evaluators, evaluation tasks, and evaluation results
10.1 Query order
First query the configuration and status of the Evaluator, Evaluation Task, and Evaluation Run, and then query the per-sample details in the SLS Project of the AgentSpace. Verify the control-plane status and the result details separately.
10.2 Query evaluators
aliyun agentloop list-evaluators \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--max-results 100
aliyun agentloop get-evaluator \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--name '<evaluator-name>' \
--biz-version '<optional-version>'Retain the evaluator version in the query results. A configuration snapshot is usually frozen when the task is created, so the latest evaluator is not necessarily the version that a historical Run actually used.
10.3 Query evaluation tasks and runs
aliyun agentloop list-evaluation-tasks \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--task-mode batch \
--max-results 100
aliyun agentloop get-evaluation-task \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--task-id '<task-id>'
aliyun agentloop list-evaluation-runs \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--task-id '<task-id>' \
--max-results 100
aliyun agentloop get-evaluation-run \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--task-id '<task-id>' \
--run-id '<run-id>'The Task and Run control plane answers what the configuration is and how far the execution has progressed. It does not necessarily return complete per-sample scoring details.
10.4 Query evaluation details
Evaluation details are located in the AgentSpace slsProject, in the Logstore evaluation_detail:
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore 'evaluation_detail' \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query 'task_id:"<task-id>" AND run_id:"<run-id>"' \
--line 100 \
--offset 0Common fields:
task_id,run_id, andeval_id.evaluator_nameandevaluator_display_name.status.score_name,score_value,score_range, andnormalized_score_value.explanationandevaluation_process.eval_info.data_link.eval_metrics,custom_outputs, andeval_latency.Example query for low scores:
task_id:"<task-id>" AND run_id:"<run-id>" AND status:success
| SELECT eval_id, evaluator_name, normalized_score_value, explanation
FROM log
WHERE normalized_score_value < 0.5
ORDER BY normalized_score_value ASC
LIMIT 50By default, do not export eval_info, the complete evaluation_process, or the custom_outputs content. Read it only after you obtain data authorization and genuinely need to investigate a single case.
Completion criteria: the Task and Run statuses are readable; the number of evaluation detail entries can be explained by the expected sample and evaluator combinations; failed, non-evaluable, and successfully scored entries are counted separately; and a low-scoring case can be traced back to data_link or the Dataset Item that it points to.
10.5 Query Playground run details
A single Playground run and its evaluation results are written to the AgentSpace slsProject, in the Logstore playground_detail. It is separate from the evaluation_detail of formal evaluation tasks, and is suitable for reviewing interactive debugging records:
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore 'playground_detail' \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query '*' \
--line 100 \
--offset 0Playground records can contain sensitive content such as inputs, outputs, model parameters, and scores. A list query should first read the ID, status, model, and time fields. Read the full content only when you investigate a single run.
11. Query experiment plans, experiment records, and per-sample results
11.1 Query experiment plans
aliyun agentloop list-experiment-plans \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--offset 0 \
--limit 20
aliyun agentloop get-experiment-plan \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--plan-id '<plan-id>'11.2 Query experiment records
In the CLI, run represents one experiment record:
aliyun agentloop list-experiment-runs \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--page 0 \
--page-size 20
aliyun agentloop get-experiment-run \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--record-id '<record-id>'Common fields of an experiment record include recordId, planId, status, the total, completed, and failed task counts, progress, executedAt, completedAt, datasetId, experimentConfig, evaluationTaskId, and error messages.
11.3 Query per-sample experiment output
Per-sample experiment output is stored in experiment_detail:
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore 'experiment_detail' \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query 'experiment_id:"<experiment-id>"' \
--line 100 \
--offset 0Common fields:
experiment_id;experiment_metadata.experiment_group_name;data_config.dataset_id;data_config.dataset_item_id;experiment_output;experiment_metrics;status.Experiment scores are still in
evaluation_detail, and are linked through the following fields:data_link.experiment_id;data_link.experiment_group_name;data_link.dataset_id;data_link.dataset_item_id.Completion criteria: the Baseline and the Candidate use the same set of Dataset Items, the same evaluator version, and the same environment baseline, and both the per-sample output and the per-sample scores are traceable. Comparing only aggregate means is not enough to prove that a change is effective.
12. Query Pipelines
12.1 List and get definitions
aliyun agentloop list-pipelines \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--max-results 100
aliyun agentloop get-pipeline \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--pipeline-name '<pipeline-name>'GetPipeline Focus on the source, the ordered nodes, the sink, the execution policy, and the last run information. The core shape of the current public contract is "one data source → ordered processing nodes → Dataset Sink". Do not describe it as an arbitrary DAG, a multi-source join, or a multi-sink platform.
12.2 Query runs
aliyun agentloop list-pipeline-runs \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--pipeline-name '<pipeline-name>' \
--start-time '<inclusive-unix-seconds>' \
--end-time '<inclusive-upper-bound-used-by-current-cli>' \
--max-results 200
aliyun agentloop get-pipeline-run \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--pipeline-name '<pipeline-name>' \
--run-id '<run-id>'In the Run details, focus on the following:
status;The data window;
triggerType;attempt/maxAttempts;startTime/finishTime;stats;errorCode/errorMessage;Optional inline results.
12.3 Query statistics
aliyun agentloop get-pipeline-stats \
--profile "$AL_PROFILE" \
--region "$AL_REGION" \
--agent-space "$AL_AGENT_SPACE" \
--pipeline-name '<pipeline-name>' \
--start-time '<unix-seconds>' \
--end-time '<unix-seconds>' \
--granularity Day12.4 You must query the Dataset again
After a Run reaches Succeeded, you must still query the target Dataset and verify at least the following:
The source selection scope and the target row count;
trace_id/trajectory_id/session_id, and other lineage fields;The proportion of required fields that are empty;
Duplicate IDs;
Converted fields;
Truncation;
Whether the filtered-out data can be explained.
Completion criteria: the actual rows of the target Dataset have been read back and satisfy the field contract, rather than only showing a successful Pipeline status.
13. Annotations, Prompt and Skill assets, and other objects
13.1 Dataset annotations
execute-query supports --annotation-filter, which lets you filter Dataset data by annotation conditions. The fields, operators, and values of the annotation conditions must match the annotation configuration of the Dataset.
Automatic scores and manual annotations must be stored in separate fields. Do not overwrite them and then treat a machine conclusion as a human gold standard.
13.2 Prompts and runtime Skills
Prompts and runtime Skills belong to the Agent asset domain, while Evaluator Skills belong to the evaluation domain. They are not the same type of resource. When you query a Prompt or a runtime Skill, use the version, release status, and Label conditions from the Agent asset API reference. An Evaluator Skill query is not a substitute.
13.3 Token, cost, and quality metrics
Tokens, model latency, and tool calls can be aggregated from Trace or Trajectory fields. Evaluation quality is aggregated from evaluation_detail. The two come from different evidence planes, so specify the time window, the deduplication unit, and the denominator when you aggregate:
Trace metrics are usually deduplicated by
traceId;Session metrics are deduplicated by Session ID;
Trajectory metrics are deduplicated by
trajectory_id;Dataset metrics are deduplicated by the Dataset Item
id;Evaluation metrics are deduplicated by
eval_id, and are also split by evaluator;Experiment metrics are deduplicated by
experiment_id + group + dataset_item_id.
14. Cross-object query recipes
14.1 Find the Trajectory and Dataset sample from a Trace
In the
TRACE_PROJECT/TRACE_LOGSTORElocated through CMS EntityStore, read the complete Spans bytraceId.In
agent-trajectory, query the Trajectory bytrace_id.Record
trajectory_id,session_id, and the cleaning version.In the target Dataset, query the explicitly stored
trace_idortrajectory_id.If the Dataset schema has no lineage fields, you cannot make a deterministic association based on time proximity.
Dataset example:
SELECT id, trace_id, trajectory_id, session_id, question, answer
FROM <dataset-name>
WHERE trace_id = '<trace-id>'
LIMIT 10014.2 Find evaluation results from a Dataset Item
Get the Item
idfrom the Dataset.In
evaluation_detail, querydata_link.dataset_item_id.Also restrict
task_idorrun_idto avoid matching historical reruns.Interpret the scores separately by evaluator. Do not average different metrics directly into an overall quality score.
14.3 Verify the Baseline and Candidate from experiment records
Use
GetExperimentRunto get therecordId, the Dataset, the configuration group, and the associated evaluation task.In
experiment_detail, get the output of each Dataset Item byexperiment_id.In
evaluation_detail, get the scores bydata_link.experiment_id.Use
dataset_item_id + experiment_group_nameto align the results.Check for missing output, duplicate samples, and failed or non-evaluable records.
14.4 Trace an experience recall result back to its source trajectory
An experience result can be traced back deterministically only when its metadata retains sourceTraceId, trace_id, trajectory_id, or an equivalent field. The field names depend on the ContextStore configuration.
If there is no source identifier, you can only say that an experience was recalled. Do not claim that it came from a specific Trace.
15. Python SDK example
The following example shows a Dataset query with the AgentLoop Python SDK. The SDK package name is alibabacloud_agentloop20260520. Get it from a package source approved by your organization or from the official vendor directory in your project. Do not download and install it from an unknown source.
import os
from alibabacloud_agentloop20260520.client import Client
from alibabacloud_agentloop20260520 import models as agentloop_models
from alibabacloud_tea_openapi import models as openapi_models
region = os.environ["AL_QUERY_REGION"]
agent_space = os.environ["AL_QUERY_AGENT_SPACE"]
dataset_name = os.environ["AL_QUERY_DATASET"]
# The example reads credentials from standard environment variables. In production, prefer STS, a RAM role, or a unified credential provider.
config = openapi_models.Config(
access_key_id=os.environ["ALIBABA_CLOUD_ACCESS_KEY_ID"],
access_key_secret=os.environ["ALIBABA_CLOUD_ACCESS_KEY_SECRET"],
security_token=os.environ.get("ALIBABA_CLOUD_SECURITY_TOKEN"),
region_id=region,
endpoint=f"agentloop.{region}.aliyuncs.com",
connect_timeout=3000,
read_timeout=15000,
)
client = Client(config)
request = agentloop_models.ExecuteQueryRequest(
type="SQL",
query=(
f"SELECT id, __time__, question, answer "
f"FROM {dataset_name} ORDER BY __time__ DESC LIMIT 100"
),
)
response = client.execute_query(agent_space, dataset_name, request)
body = response.body
records = [dict(zip(body.columns, row)) for row in body.rows]
print({
"request_id": body.request_id,
"count": body.meta.count,
"progress": body.meta.progress,
"records": records,
})This example allows only application-generated Dataset names and a fixed SELECT template. Do not pass arbitrary SQL submitted by external users directly to ExecuteQuery.
The CLI and the SDK should use the same API version. If the SDK request model is missing a parameter listed in the documentation, upgrade the SDK for that API version. Do not modify the generated code to bypass parameter validation.
16. Error handling and retries
Symptom | Read-only check | Handling principle |
| Check the region, AgentSpace, and profile | Do not switch to another space automatically |
Insufficient permissions | Record the action, the resource ARN, and | Add the least privilege and retry. Do not display credentials |
SLS returns no data | Check the Project, Logstore, index, time window, and field names | Relax the filters first. Do not assert that there is no data |
| Record the Token of the previous page and the query conditions | Do not reuse a Token from another query |
429 / Throttling | Read the error code and the response headers | Exponential backoff plus jitter, with bounded retries |
5xx or a network timeout | Keep | Retry within bounds. Do not treat a timeout as "no results" |
Dataset | Check | Do not publish incomplete statistics |
A Dataset field is truncated | Check | Reduce the fields or read the details by ID |
Pipeline | Query the Run statistics and the target Dataset again | Trust what you read back from the Dataset |
An evaluation Run exists but has no details | Check the time, the SLS Project, | Distinguish the task status from the result data plane |
Context Search returns empty | Check the store status, identity filters, thresholds, and mining progress | An empty result does not mean an API failure |
You can retry GET, List, Search, and read-only Query operations within bounds. Recommendations:
Retry only on connection timeouts, read timeouts, 429, and explicit transient 5xx errors;
Add random jitter to the backoff;
Set a total duration limit and a maximum number of attempts;
Keep the same business query identifier for every retry, and record each
requestId;Do not silently widen the time range or switch the AgentSpace after a failure.
17. Data security and compliance
By default, do not collect or return complete prompts, outputs, tool parameters, or file content.
Before you query, confirm that the caller has permissions on the target AgentSpace, Dataset, ContextStore, and SLS Project.
A Memory query must carry identity isolation conditions, and you must run cross-user negative tests.
For large multi-modal content, return the object URI, type, size, hash, and permission metadata. Do not put large Base64 objects into a Trace or Dataset response.
Signed URLs have a TTL. Do not store them as long-term Dataset or Memory content.
In logs, record only the query structure, counts, hashes, and
requestId. Do not record secrets or complete customer content.When you export data, record the source window, the schema and cleaning version, the pagination, and the redaction rules so that the export can be explained later.
18. API and command quick reference
18.1 AgentLoop query operations
Action | CLI | HTTP path |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18.2 Trace and Trajectory data location operations
Purpose | Action/CLI | HTTP path or data location |
Locate the XTrace Store from the Workspace |
|
|
Query the APM observability instance |
|
|
Enumerate the AgentSpace Logstores |
|
|
Verify a Logstore |
| The Project/Logstore returned by AgentSpace or CMS |
Query the Logstore index |
| The located Project/Logstore |
Query Trace/Trajectory logs |
| The XTrace Store or |
18.3 Evaluation and experiment query commands
Object | CLI command |
Evaluator |
|
Evaluation Task/Run |
|
Experiment Plan/Run |
|
Before you call, confirm that the target account has the corresponding RAM read permissions, and use an AgentLoop API version that the target region supports.
19. Logstore data map: names, lookup methods, and purposes
In this section, "all Logstores" refers to the complete set of Logstore types that a customer can encounter when querying AgentLoop business data through the API. This includes fixed names, names generated dynamically per resource, and sources specified by configuration. The task queues, metering data, and operational logs of the platform service itself are described separately and are not mixed with customer business data.
19.1 First enumerate the Logstores that actually exist in the AgentSpace
A fixed name means that the data contract is fixed. It does not mean that every AgentSpace has all Logstores immediately after creation. Many Logstores are created after you enable the corresponding integration, auditing, evaluation, experiment, memory, or efficiency analysis capability. First use GetAgentSpace.slsProject to enumerate the actual resources:
aliyun sls list-log-stores \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--offset 0 \
--size 500If the number of returned entries reaches 500, keep increasing offset until you have read everything. For each Logstore that you plan to query, verify the resource and the index:
AL_LOGSTORE='<logstore-name>'
aliyun sls get-log-store \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore "$AL_LOGSTORE"
aliyun sls get-index \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project "$AGENTSPACE_SLS_PROJECT" \
--logstore "$AL_LOGSTORE"ListLogStores proves that the resource exists, and GetIndex proves which fields support keyword, range, or SQL queries. Neither proves that data already exists within the target time window.
19.2 Trajectory and trajectory feature Logstores
The Project for these Logstores always comes from GetAgentSpace.slsProject:
Logstore | Purpose | Typical fields and query keys | Availability condition |
| Cleaned and assembled complete Agent Trajectories, used for trajectory lists, details, evaluations, and experience mining |
| After AgentSpace trajectory storage is ready |
| Splits a Trajectory into aggregatable step and tool events; suitable for analyzing tools, commands, targets, status, duration, and result size |
| After trajectory feature processing is enabled |
| Aggregate statistics per Trajectory, suitable for overviews, trends, Tokens, tool calls, and success/error ratios |
| After trajectory feature processing is enabled |
| Security findings extracted from Trajectories |
| After the security feature view is enabled |
| Signals that trajectory features are ready and trigger downstream processing; also stores compact flags for errors, changes, collection gaps, and security risks |
| After the trigger view is enabled |
When you query trajectory features, preferentially correlate the four views by trajectory_id or feature_id. trajectory-feature-event is derived from a Trajectory; it is not the same as an application-reported agent-event.
19.3 Raw Agent event and audit Logstores
These Logstores are also in the AgentSpace slsProject. Ingestion writes raw events. Derived audit data appears after the applicable audit capability is enabled and produces results.
Logstore | Purpose | Typical fields and query keys |
| Standardized AI application events directly reported by a server or Agent, including model requests/responses, tool calls/results, and session context |
|
| Browser or frontend AI application events ingested through WebTracking. The schema is aligned with | Same as |
| Host- or process-level runtime observability events that supplement file, network, process, and system-call runtime evidence | Host, process, container, event type, time, and runtime result fields; use the actual index as the authority |
| Individual security findings output by detectors |
|
| Correlates one or more security findings and raw events into an Incident |
|
| Audit analysis events for intent, risk, entities, and usage |
|
| Behavioral baseline profiles used to compare current activity with historical baselines | Profile ID, subject, statistical window, and baseline metrics; use the actual index as the authority |
| Queryable records of current Agent audit and security policies | Policy ID, applicable subject, version, status, and update time; use the actual index as the authority |
| A pool of policies that can be selected, distributed, or reused | Policy ID, category, version, scope, and status; use the actual index as the authority |
| Conversation history for audit analysis interactions | Chat/Message ID, session, role, time, and content summary; read bodies according to data authorization |
| An index of evidence, conclusions, or export artifacts persisted during an investigation | Investigation/Artifact ID, source, type, status, hash, or object reference |
When you query across agent-event and agent-event-webtracking, you should explicitly project the same fields and add a source column, and then use UNION ALL; do not assume that both Logstores contain data in every time window. ebpf-event falls within the runtime data scope and should not be joined directly to AI application events without a correlation key.
19.4 Evaluation, experiment, and Playground Logstores
Logstore | Purpose | Typical correlation keys |
| Per-sample and per-evaluator results from formal evaluations; scores, explanations, custom output, and data lineage are all read from here |
|
| Actual output and execution metrics for each Dataset Item, experiment group, and candidate configuration in an experiment |
|
| A single interactive Playground run and its evaluation record | Run ID, model, status, input, output, score, and time fields; use the actual index as the authority |
experiment_detail stores experiment output, while experiment scoring remains in evaluation_detail. playground_detail is used for interactive debugging and should not be treated as the result source of formal Evaluation Task/Run results.
19.5 Token, cost, and efficiency Logstores
After Token/cost efficiency analysis is enabled, the AgentSpace Project can contain the following Logstores:
Logstore | Purpose | Typical correlation keys |
| Splits a Trajectory into reusable Steps/Fragments and stores fragment lineage and content payloads |
|
| Token and cost features calculated from fragments or Trajectories |
|
| A catalog and release index of feature-mining artifacts, used to identify the published artifact for a window, entity, and version |
|
| Summaries, anomalies, optimization actions, and expected savings for queries and console display |
|
When you read efficiency data, first use mining-catalog to confirm the published Runs and windows, and then read the Feature, Fragment, or Serving data. Do not conclude that a window has been published only because a Logstore has rows.
19.6 Logstores with dynamic names or names determined by resource configuration
Type | Lookup method | Purpose |
XTrace Store |
| Raw Traces and Spans. The name can be |
Memory Event Store | Prefer reading | The short-term write event stream of each Memory ContextStore. After extraction, the events are written to the memory Dataset |
Pipeline Source Logstore |
| The source SLS Logstore that a Pipeline reads. The name is determined by the Pipeline configuration and can be a Trace, Trajectory, Event, or business Logstore. There is no unified fixed name |
An Experience ContextStore does not have an Event Logstore that must share the store name. It selects the source through config.source.agentSpace and serviceNames, and reads trajectories mainly from the agent-trajectory of that AgentSpace. Recall results are queried through the ContextStore API.
19.7 Do not confuse the different types of Event
Name | What it records | What questions it answers |
| Raw events such as model, tool, and session events reported directly by the application | What the Agent actually did, when it happened, and which Session/Turn/Step it belongs to |
| Structured step and tool features derived from a complete Trajectory | How a certain type of tool, command, target, result, and duration is distributed |
| Derived events produced by detection, correlation, and audit analysis | What risks exist, what the evidence is, and which events were merged into an Incident |
| Short-term events written through the Context API and waiting for long-term memory extraction | Whether a memory write arrived, whether the Scope and Partition are correct, and what the extraction input is |
| Process signals such as the readiness and sealing of the Trajectory processing chain | Why trajectory processing has not advanced. It is not the entry point for querying user behavior events |
Also distinguish agent-trajectory from the agentloop-trajectory in the service operational logs. The former is the business Trajectory inside the customer AgentSpace; the latter is the operational log of the Trajectory service itself. The names are similar, but the Project, schema, permissions, and purposes are all different.
19.8 Process control, metering, and service operation Logstores
AgentLoop task execution also uses process control or service observation Logstores. Common categories include:
Category | Typical names | Purpose | Use for result queries |
Continuous evaluation window queue |
| Passes mature time windows between the scheduler and the execution instances. The messages describe windows and do not store per-sample scores |
|
Evaluation execution queue | The name is determined by the deployment configuration | Distributes samples or tasks to be evaluated |
|
Experiment execution queue |
| Distributes normal or high-priority experiment tasks |
|
Trajectory process signals |
|
|
|
Evaluation and experiment metering and monitoring |
| Service capacity, metering, monitoring, and operational statistics | For AgentSpace business results, still query the Detail Logstores |
AgentLoop service operational logs |
| Access logs, application logs, and error logs of services such as API, scheduling, extraction, and cleaning | For service troubleshooting. Not a substitute for AgentSpace data queries |
The names, Projects, and retention periods of process control or service operation Logstores can vary by region and deployment environment. They can explain why a task is waiting or has failed, but they cannot replace the Trace, Trajectory, Dataset, Evaluation, Experiment, or Context query results of the customer data plane.
19.9 General Logstore query template
After you confirm the Project, Logstore, index, and time range, run a bounded query:
aliyun sls get-logs-v2 \
--profile "$AL_PROFILE" \
--region "$RESOURCE_REGION" \
--project '<resolved-project>' \
--logstore '<resolved-logstore>' \
--from '<inclusive-unix-seconds>' \
--to '<exclusive-unix-seconds>' \
--query '<indexed-filter-or-*>' \
--line 100 \
--offset 0 \
--reverse trueWhen you query an unknown schema for the first time, read a small number of records first and use GetIndex to confirm the fields before you write the formal filters and SQL. When a query is complete, you must record the Project, Logstore, time window, filter conditions, pagination, completeness flag, and requestId.
20. Pre-launch checklist
The region, profile, and AgentSpace are fixed;
You have read the cmsWorkspace and slsProject of the AgentSpace;
You have located and verified the XTrace Project/Logstore/Region through CMS EntityStore;
You have enumerated all Logstores that actually exist in the AgentSpace slsProject and classified them according to the data map in this section;
You have verified the Logstore used by this query and its index;
You have distinguished agent-event, trajectory-feature-event, memory_events_*, and process control events;
You have checked the commands and parameters against the actual CLI/SDK Help of the target environment;
RAM grants only the actions and target resources required by the query;
Every time-based query has an explicit half-open time range [from, to) and a time zone;
The List API has handled complete pagination;
Dataset Query allows only SELECT/SearchExpr, with an explicit LIMIT;
SLS queries handle pagination beyond 100 entries or use bounded SQL;
Content fields are projected, redacted, or truncated by default, and truncation is explicitly recorded;
Memory queries include identity isolation filters and have passed cross-identity negative validation;
Evaluation and experiment details can be traced back to a Trace or Dataset Item;
After a Pipeline succeeds, you have queried the target Dataset again;
Logs store the requestId, the query window, the object IDs, and the client version;
You do not conflate configuration saved, task run, results produced, results readable, and business acceptance.
21. Versions and compatibility
When the client version, regional capabilities, or the returned schema is updated, follow the official documentation of the corresponding API version and the actual response, and update the field compatibility logic of the caller accordingly.