All Products
Search
Document Center

Tablestore:Knowledge compilation (Wiki)

Last Updated:Sep 24, 2026

Agent Wiki asynchronously organizes an Agent's source files into interlinked, structured Markdown pages, forming a searchable knowledge graph. Pages can be listed, read, and searched by path, making them suitable for storing product specifications, operation manuals, project conventions, and other Agent-level materials that need to be shared across sessions.

Wiki provides pages, links, source citations, and search capabilities, but does not provide entity triplets or graph query interfaces. When you need graph-database-style entity/relationship queries, use a different data model.

Prerequisites

A memory store has been created (any input type is acceptable; a Wiki belongs to one memory store plus a three-part Agent Scope).

Resource boundaries

Each Wiki uniquely belongs to one memory store and a three-part Agent Scope:

memoryStoreName + appId / tenantId / agentId
  • Wiki does not use runId; different sessions of the same Agent share one Wiki.

  • When you call GetWiki, the service automatically retrieves or creates the Wiki for that Scope, and no wikiId, build ID, or task ID is required.

  • All three fields are required, are at most 128 bytes each, must not contain /, and do not allow the wildcard *.

Supported source files

Type

Extension

Write method

Per-file limit

Markdown, text

.md, .txt

content

100 KiB

PDF

.pdf

contentBase64 + mediaType

2,000,000 bytes

Word

.doc, .docx

contentBase64 + mediaType

2,000,000 bytes

Excel

.xls, .xlsx

contentBase64 + mediaType

2,000,000 bytes

PowerPoint

.ppt, .pptx

contentBase64 + mediaType

2,000,000 bytes

Image

.jpg, .jpeg, .png

contentBase64 + mediaType

2,000,000 bytes

Binary files use standard Base64; the extension, mediaType, and file signature must be consistent.

Query Wiki

Retrieve or create the Wiki for the current Agent Scope and view the latest build status. The first call automatically creates the Wiki.

Console

Open the memory store, go to Knowledge compilation Wiki > Raw files (or Knowledge graph), set the application, tenant, and Agent, then view the Wiki status and page count.

SDK

The current Agent Storage SDK does not yet wrap high-level Wiki methods. Use the low-level ots_client.request(Action, body) call.

Python

from tablestore_agent_storage import AgentStorageClient

client = AgentStorageClient(
    api_key="<your-api-key>",
    ots_endpoint="https://<instance>.<region>.ots.aliyuncs.com",
    ots_instance_name="<instance-name>",
)

wiki = client.ots_client.request("GetWiki", {
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
})
print(f"Status: {wiki.get('status')}, Pages: {wiki.get('pageCount')}, Pending: {wiki.get('hasPendingChanges')}")

API

Call GetWiki to query the Wiki. For the complete fields, see Query Wiki.

Build Wiki

Asynchronously compiles the source files under /.wiki/raw/ into a new set of pages and atomically publishes them.

Console

  1. On the Knowledge compilation Wiki > Raw files page, click Add raw material or Batch upload to write source files to /.wiki/raw/.

  2. Click Build Wiki; the service asynchronously compiles the pages.

  3. View the published pages on the Knowledge graph page; existing pages remain readable during the build.

SDK

Python

from tablestore_agent_storage import AgentStorageClient

client = AgentStorageClient(
    api_key="<your-api-key>",
    ots_endpoint="https://<instance>.<region>.ots.aliyuncs.com",
    ots_instance_name="<instance-name>",
)

# 1. Write the source file (for AddItem, see the "File memory" document)
client.add_item({
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
    "path": "/.wiki/raw/product/payment.md",
    "content": "# Payment notes\n\nPayment callbacks must validate the idempotency key.",
})

# 2. Start the build
resp = client.ots_client.request("IngestWiki", {
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
    "clientToken": "wiki-build-001",
})
print(resp)

API

Call IngestWiki to build the Wiki. For the complete fields, see Build Wiki.

IngestWiki is an asynchronous operation. The same clientToken can be used for safe retries. In the response, reused indicates that the same build was reused, and skipped indicates that the sources have not changed and no rebuild is needed.

Common build statuses are as follows:

Status

Description

pending, processing

Build accepted or in progress

accepting_output, sealing, validating, indexing, publishing

Pages are being generated, validated, indexed, or published

ready

New pages have been atomically published and can be read and searched

failed

Build failed; check errorMessage, fix the sources, and start a new build

conflict

The sources or the current version changed during the build; re-fetch the status and start a new build

List pages

Paginate the metadata of published pages in path order.

  • Pages are available for listing only after a build has been published; if no build has been performed, a resource-not-found error is returned.

  • limit defaults to 50 and has a maximum of 100. Do not parse or modify nextToken; during pagination, pages are locked to the same published version.

Console

View the published page list (path, title, summary) on the Knowledge graph page.

SDK

Python

from tablestore_agent_storage import AgentStorageClient

client = AgentStorageClient(
    api_key="<your-api-key>",
    ots_endpoint="https://<instance>.<region>.ots.aliyuncs.com",
    ots_instance_name="<instance-name>",
)

resp = client.ots_client.request("ListWikiPages", {
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
    "limit": 50,
})
for p in resp.get("pages", []):
    print(p.get("path"), p.get("title"))

API

Call ListWikiPages to list pages. For the complete fields, see List Wiki pages.

Read page

Read the full body of a published page by path.

Console

On the Knowledge graph page, click the target page to view its full body, source citations, and incoming and outgoing links.

SDK

Python

from tablestore_agent_storage import AgentStorageClient

client = AgentStorageClient(
    api_key="<your-api-key>",
    ots_endpoint="https://<instance>.<region>.ots.aliyuncs.com",
    ots_instance_name="<instance-name>",
)

resp = client.ots_client.request("GetWikiPage", {
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
    "path": "/wiki/payment-callback.md",
})
print(resp.get("content"))

API

Call GetWikiPage to read a page. For the complete fields, see GetWikiPage.

Search pages

Perform a semantic search over published pages using natural language; returns the path, title, summary, and score of matching pages.

Console

On the Knowledge retrieval page, enter keywords to search built pages by title, summary, and body.

SDK

Python

from tablestore_agent_storage import AgentStorageClient

client = AgentStorageClient(
    api_key="<your-api-key>",
    ots_endpoint="https://<instance>.<region>.ots.aliyuncs.com",
    ots_instance_name="<instance-name>",
)

resp = client.ots_client.request("SearchWikiPages", {
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
    "query": "How do payment callbacks ensure idempotency",
    "limit": 5,
})
for p in resp.get("pages", []):
    print(f"[{p.get('score')}] {p.get('path')} - {p.get('title')}")

API

Call SearchWikiPages to search pages. For the complete fields, see Search Wiki pages.

Update Wiki

Update the display name or summary of a Wiki.

Console

On the Wiki page, click Settings to modify the name or summary.

SDK

Python

from tablestore_agent_storage import AgentStorageClient

client = AgentStorageClient(
    api_key="<your-api-key>",
    ots_endpoint="https://<instance>.<region>.ots.aliyuncs.com",
    ots_instance_name="<instance-name>",
)

client.ots_client.request("UpdateWiki", {
    "memoryStoreName": "agent_memory",
    "scope": {"appId": "app-001", "tenantId": "user-001", "agentId": "assistant"},
    "name": "Payment and reconciliation Wiki",
    "summary": "Covers payment callbacks, reconciliation, and idempotency conventions",
})

API

Call UpdateWiki to update the Wiki. For the complete fields, see Update Wiki.

Build quality and limits

GetWiki.latestBuild.quality provides metrics such as source coverage, page citation status, and link quality to help determine whether pages need manual spot-checking. A successful build does not mean that every source is fully represented, nor that all facts have been business-validated.

Item

Limit

Source files per Wiki

2000

Unique binary sources per build

50

Total source size per build

20 MiB

Pages per build

500

Single page body

100 KiB

Total page size per build

20 MiB

ListWikiPages default/maximum limit

50 / 100

SearchWikiPages default/maximum limit

10 / 100

Related documents