KsADK

会话与文件

KsADK 的本地运行时把对话历史、上传文件和 workspace 产物统一放在 session 边界内。业务 Agent 不应直接依赖某个宿主机绝对路径,而应通过 session id、 workspace 路由和运行时 payload 获取上下文。

Session 标识

字段含义
session_id本地 UI、OpenAI 兼容 API 和运行时内部共享的会话标识
user_id用户维度标识,用于隔离记忆、历史和审计
account_id云账号维度标识,hosted 场景下随请求透传,用于跨账号边界隔离
conversationResponses API 中的会话连续性对象
previous_response_id客户端续聊时可使用的上一轮响应 id

account_id 在 hosted 链路里由 gateway 注入,业务 Agent 不应自行伪造; 本地运行时按 owner 隔离,不会跨 account_id 共享 session、附件或 workspace。

不要在业务代码里每轮生成新的 session id;这会导致 UI 历史、附件引用和运行时状态断裂。

本地存储

agentengine web . 默认使用项目目录下的 .agentengine/ui/sessions.sqlite。 相关变量见 环境变量

KSADK_STM_BACKEND=sqlite
KSADK_STM_PATH=.agentengine/ui/sessions.sqlite

共享环境可改用 PostgreSQL:

KSADK_SESSION_BACKEND=postgres
KSADK_SESSION_DSN=postgresql://user:pass@example.invalid:5432/ksadk

公开文档只使用占位 DSN,不提交真实连接串。

PostgreSQL 是会话的持久化副本,不是 Agent 执行的可用性前置条件。连接或写入失败时, 运行时继续使用当前进程内的 live session,并在进入降级态时记录结构化错误日志 session_backend_state=degraded。运行时会定期探测 PostgreSQL;恢复后新会话和后续事件 继续写入 PostgreSQL,并记录 session_backend_state=recovered。降级期间尚未持久化的旧事件 不会自动补写,因此 Pod 重启或迁移后不保证恢复这些事件。PG 不可用期间,只能使用当前 进程已经加载的历史;请求切换到其他 Pod 时可能缺少会话上下文,但 Agent 当前请求仍继续执行。

PostgreSQL 可读视图

KsADK 初始化 PostgreSQL schema 时会同时创建 ksadk_session_events_readable 视图。 原始的 ksadk_events.content_jsonmetadata_json 仍保留完整机器事件;可读视图把常用字段 拍平成 message_rolemessage_texttool_namelifecycle_statuscreated_at,便于 用户和 SRE 直接排查会话:

SELECT
  session_id,
  seq_id,
  message_role,
  event_type,
  message_text,
  tool_name,
  lifecycle_status,
  created_at
FROM ksadk_session_events_readable
WHERE namespace = 'default' AND session_id = '<session-id>'
ORDER BY seq_id;

流式 reasoning 仍实时返回给客户端,但持久化时按一轮聚合成单条 reasoning 事件,避免 每个 delta 产生一行。run_status 等生命周期事件不会伪装成聊天消息,可通过 lifecycle_status 单独查看。

文件上传

本地 UI 上传文件后,运行时会把文件引用归一化到当前 turn 的输入中。业务 Agent 应读取标准化消息、附件 metadata 或框架 runner payload,而不是猜测浏览器上传目录。

常见输入类型:

  • 文本消息。
  • 图片输入,例如 input_image
  • 文件输入,例如 input_file
  • 历史 turn 中仍有效的附件引用。

上传 URI scheme

新增:0.6.7

本地与 hosted 上传统一为 attachment URI scheme,由同一读取入口解析。

上传文件后,运行时把文件引用归一化为 attachment URI:

Scheme来源含义
ksadk-upload://{file_id}本地 agentengine web 上传由本地 AttachmentStorageService 写入,绑定当前 server
ae-upload://{file_id}hosted 链路上传托管平台返回的 attachment 引用,需要服务端解析

两者都通过同一入口读取:

curl -sS "https://<public-endpoint>/agentengine/api/v1/AttachmentContent?FileUri=ksadk-upload://<file_id>" \
  -H "Authorization: Bearer <api_key>"

读取 ae-upload:// 时,服务端会按 {file_id} 定位托管上传内容并返回字节流, 同时把内容回写到本地 cache(local_path),后续读取命中本地缓存。 非 ae-upload:// 前缀的路径按 workspace 相对路径处理。

AttachmentContent 返回的 attachment 在运行时内部表示为 AttachmentBytes

字段类型含义
databytes附件原始字节流
display_namestr展示用文件名,已做 sanitize
mime_typestrMIME 类型,缺失时按文件名推断
local_pathPath 或 None本地 cache 绝对路径;hosted attachment 首次读取后回写,命中后为非空

公开示例不要把 ksadk-upload://ae-upload:// URI 当作持久外部 URL 写进源码或文档。

Workspace

Workspace 是 Agent 生成产物的推荐位置,例如 HTML、Markdown、JSON、CSV 或代码文件。 本地 UI 和 hosted UI 可以围绕同一逻辑 workspace 展示、预览和下载。

from ksadk.sessions.local_service import resolve_local_session_dir

workspace = resolve_local_session_dir() / "workspace"
workspace.mkdir(parents=True, exist_ok=True)
(workspace / "report.md").write_text("# Report\n", encoding="utf-8")

路径必须留在 workspace 根目录内,避免写入任意宿主机文件系统。

Checkpoint 与 Resume

新增:0.6.7

KsADK 引入框架级 checkpoint/resume 能力,覆盖 list、preview、resume、cancel 四个动作, 并新增 ResumeInstructionCheckpointStatus 等字段。底层基于持久化 run_checkpoint / run_resume / tool_result 事件,支持跨实例恢复。

运行时通过五个 hosted UI action 管理 run 级 checkpoint、恢复、取消与工具回执。所有 action 走 POST /agentengine/api/v1/<Action>,请求体为 JSON,响应统一为 { Code, Message, RequestId, Action, Data } envelope。

Action路径用途
ListSessionCheckpointsPOST /agentengine/api/v1/ListSessionCheckpoints列出某 session 下的 checkpoint,供 resume 选择
GetCheckpointResumePreviewPOST /agentengine/api/v1/GetCheckpointResumePreview预览从某 checkpoint resume 的内容与影响面
ResumeRunPOST /agentengine/api/v1/ResumeRun从 checkpoint 恢复 run 执行
CancelRunPOST /agentengine/api/v1/CancelRun取消正在进行的 run(以 InvocationId 为主键)
ListToolReceiptsPOST /agentengine/api/v1/ListToolReceipts列出某 run / checkpoint 下的工具调用回执

鉴权与边界

本地 agentengine web 默认 owner 隔离;hosted 链路需在请求头携带 Authorization: Bearer <api_key>,且 account_id 由 gateway 注入,业务 Agent 不可伪造。 跨 account_id 的 session / checkpoint / tool receipt 互不可见。

Checkpoint 状态机

ListSessionCheckpointsGetCheckpointResumePreview 返回的每个 checkpoint 携带 CheckpointStatus,由 is_terminalis_resumableresume_countexpires_atreplay_allowed 联合推导。运行时不持久化该字段,读取时实时计算:

状态触发条件
active默认;checkpoint 仍可被 resume
resumed已被 ResumeRun 恢复过(resume_count >= 1,且未到终态)
terminalis_terminal=trueresume_count=0,run 已到终态
expiredexpires_at 已过期,IsResumable 被强制置 false
disabledis_resumable=false,或 replay_allowed=false 且已恢复过

CheckpointStatus 由运行时在读取时实时推导,不写入持久化事件;resume_countlast_resumed_at 来自 run_resume 事件审计。GetCheckpointResumePreview 仅当 ResumeStatus=unknown 时才要求先 preview 再 resume。

Checkpoint descriptor 字段表

每个 checkpoint 是一个 run_checkpoint 事件投影后的对象。除通用事件字段外,还包含 以下 resume 描述字段(0.6.7 全量新增/补齐):

字段类型含义
EventIdstrcheckpoint 事件 id
SessionIdstr所属 session id
InvocationIdstr触发该 checkpoint 的 invocation id
RunIdstr所属 run id
CheckpointIdstrcheckpoint id(resume 时引用)
Frameworkstr产生 checkpoint 的框架,如 langgraphadk
FrameworkRefdict框架特定引用,如 LangGraph 的 next_node
Phasestrcheckpoint 阶段标签
NextNodestrresume 后续跑的下一节点
IsResumablebool 或 null是否可 resume;false 时被强制禁用
ResumeStatusstrresumable / disabled / unknown
IsTerminalbool是否终态 checkpoint
ResumeDisabledReasonstr不可恢复时的原因文案
Backendstrcheckpoint 存储后端,如 memorylanggraph_store
Scopestrcheckpoint 作用域,如 process_local
Durablebool是否持久化(可跨实例恢复)
ArtifactPreviewdictcheckpoint artifact 预览
StageKey / StageName / StageIndex / TotalStages各种多阶段 run 的阶段信息
CreatedAtstrcheckpoint 事件时间戳
LastResumedAtstr 或 null最近一次 resume 时间戳,来自 run_resume 审计
ResumeCountint已 resume 次数,来自 run_resume 审计;0 表示从未恢复
ReplayAllowedbool策略是否允许重复 resume 同一 checkpoint;默认 true
ExpiresAtstr 或 nullcheckpoint 过期时间;过期后 IsResumable 强制 false
CheckpointStatusstr实时推导的状态:active / resumed / terminal / expired / disabled
Metadatadict原始 checkpoint 事件 metadata,含上述字段原始值

进程内 checkpoint 不可恢复

Backend == "memory"Scope == "process_local" 时,IsResumable 会被强制置 false,原因文案为"进程内 checkpoint 不能跨实例恢复"。本地开发时这类 checkpoint 仅供 当次进程内 preview,不要把它们当作可恢复点。

ListSessionCheckpoints

列出某 session 下的 checkpoint,支持按 RunIdFramework 过滤与分页。

字段默认约束含义
AgentId必填目标 Agent id,必须与 session 的 agent_id 一致
SessionId必填目标 session id
RunId可选仅返回该 run 的 checkpoint
Framework可选仅返回该框架的 checkpoint,如 langgraph
OnlyResumablefalse可选仅返回 IsResumable=true 的 checkpoint
Offset0>=0分页偏移
Limit不限1..500每页上限 500
list_checkpoints.sh
curl -sS -X POST "https://<public-endpoint>/agentengine/api/v1/ListSessionCheckpoints" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "AgentId": "my-agent",
    "SessionId": "<sid>",
    "OnlyResumable": true,
    "Limit": 50
  }'
list_checkpoints_response.json
{
  "Code": 0,
  "Message": "Success",
  "RequestId": "req-abc123",
  "Action": "ListSessionCheckpoints",
  "Data": {
    "Checkpoints": [
      {
        "EventId": "evt_001",
        "SessionId": "<sid>",
        "InvocationId": "inv_xyz",
        "RunId": "run_001",
        "CheckpointId": "ckpt_002",
        "Framework": "langgraph",
        "IsResumable": true,
        "ResumeStatus": "resumable",
        "IsTerminal": false,
        "ResumeDisabledReason": "",
        "NextNode": "research_summarize",
        "Backend": "langgraph_store",
        "Scope": "session",
        "Durable": true,
        "LastResumedAt": null,
        "ResumeCount": 0,
        "ReplayAllowed": true,
        "ExpiresAt": "2026-07-04T12:00:00Z",
        "CheckpointStatus": "active"
      }
    ],
    "Total": 1,
    "Offset": 0,
    "Limit": 50
  }
}
HTTPdetail.code触发条件
404session 不存在,或 AgentId 与 session 的 agent_id 不一致

GetCheckpointResumePreview

预览从某 checkpoint resume 的影响面:包括工具回执、副作用风险等级、是否需要先 preview。

字段约束含义
AgentId必填目标 Agent id
SessionId必填目标 session id
RunId必填目标 run id
CheckpointId必填要预览的 checkpoint id
get_resume_preview.sh
curl -sS -X POST "https://<public-endpoint>/agentengine/api/v1/GetCheckpointResumePreview" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "AgentId": "my-agent",
    "SessionId": "<sid>",
    "RunId": "run_001",
    "CheckpointId": "ckpt_002"
  }'
resume_preview_response.json
{
  "Code": 0,
  "Message": "Success",
  "RequestId": "req_def456",
  "Action": "GetCheckpointResumePreview",
  "Data": {
    "Preview": {
      "Checkpoint": { "CheckpointId": "ckpt_002", "IsResumable": true },
      "Capabilities": {
        "Checkpoints": true,
        "CheckpointResume": true,
        "ToolReceipts": true,
        "IdempotentToolReplay": true
      },
      "CanResume": true,
      "Reason": "",
      "NextNode": "research_summarize",
      "ExpectedAction": "resume_from_checkpoint",
      "ToolReceipts": [
        {
          "ReceiptId": "rcpt_001",
          "ToolName": "write_workspace_file",
          "ToolCallId": "call_01",
          "RunId": "run_001",
          "CheckpointId": "ckpt_001",
          "Status": "succeeded",
          "Replayed": false
        }
      ],
      "Risk": {
        "Level": "medium",
        "DuplicateSideEffectRisk": true,
        "SideEffectReceiptCount": 1,
        "FailedReceiptCount": 0
      },
      "Summary": {
        "RunId": "run_001",
        "CheckpointId": "ckpt_002",
        "Phase": "after_research",
        "ToolReceiptCount": 1
      }
    }
  }
}

ExpectedAction 取值:resume_from_checkpoint(可直接 resume)、 preview_required(ResumeStatus=unknown,必须先 preview)、disabled(不可恢复)。

Risk.Level 取值:

Level触发条件
low无副作用工具回执,且无失败回执
medium存在副作用工具回执(write_workspace_file 等)
high存在 Status=failed 的回执
HTTPdetail触发条件
404"Session not found"session 不存在或 AgentId 不匹配
404"Checkpoint not found"指定 RunId + CheckpointId 组合不存在

ResumeRun

从 checkpoint 恢复 run 执行。0.6.7 新增 ResumeInstructionEnabled / ResumeInstruction 字段,允许在 resume 时注入额外指令;并补充 409 错误码区分不可恢复与重复 resume。

字段默认约束含义
AgentId必填目标 Agent id,须与 session agent_id 一致
SessionId必填目标 session id
RunId必填要恢复的 run id
CheckpointId必填恢复起点 checkpoint id
ResumeAttemptId可选resume 尝试 id;缺省由运行时生成 resume_<hex>
InvocationId可选新 invocation id;缺省用 ResumeAttemptId
Streamfalse可选true 返回 SSE 流(同 RunAgent stream)
Model可选本次 resume 的模型覆盖
ModelMetadata可选模型能力提示(0.6.7)
ModelOptions可选provider 特定选项
ResumeInstructionEnabledfalse可选0.6.7;是否启用 resume 指令注入
ResumeInstruction可选0.6.7;resume 注入的额外指令文本
resume_run.sh
curl -sS -X POST "https://<public-endpoint>/agentengine/api/v1/ResumeRun" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "AgentId": "my-agent",
    "SessionId": "<sid>",
    "RunId": "run_001",
    "CheckpointId": "ckpt_002",
    "ResumeInstructionEnabled": true,
    "ResumeInstruction": "用更简洁的语气重做总结",
    "Stream": false
  }'

非 stream 模式返回 Responses 风格 payload:

resume_run_response.json
{
  "Code": 0,
  "Message": "Success",
  "RequestId": "req_ghi789",
  "Action": "ResumeRun",
  "Data": {
    "id": "resp_<hex>",
    "object": "response",
    "model": "my-agent",
    "output": [
      { "type": "message", "role": "assistant", "content": [{ "type": "output_text", "text": "..." }] }
    ]
  }
}

终态 checkpoint 的 resume 会被视为 noop,直接返回 status=noop 并写一条 run_resume + run_status=completed 事件,不再实际执行:

resume_run_noop.json
{
  "Code": 0,
  "Action": "ResumeRun",
  "Data": {
    "status": "noop",
    "Reason": "该 checkpoint 已是终态;可选择更早恢复点重跑",
    "CheckpointId": "ckpt_002",
    "RunId": "run_001",
    "ResumeAttemptId": "resume_<hex>"
  }
}

Stream=true 时返回 text/event-stream,语义同 RunAgent stream。每个事件为 data: { ... }\n\n,事件体见 _event_to_action_payload 形态。终态 run_status 后服务端发送 data: [DONE]

resume_run_stream.sh
curl -sS -N -X POST "https://<public-endpoint>/agentengine/api/v1/ResumeRun" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{
    "AgentId": "my-agent",
    "SessionId": "<sid>",
    "RunId": "run_001",
    "CheckpointId": "ckpt_002",
    "Stream": true
  }'
HTTPdetail.code触发条件
404session 不存在或 AgentId 不匹配
404RunId + CheckpointId 不存在
409checkpoint_not_resumablecheckpoint 不可恢复(IsResumable=false),含原因
409resume_already_running同一 session+run 已有 resume 在执行

checkpoint_not_resumable 响应体:

409_checkpoint_not_resumable.json
{
  "detail": {
    "code": "checkpoint_not_resumable",
    "reason": "该 checkpoint 已恢复过,当前策略不允许重复恢复",
    "checkpoint_id": "ckpt_002",
    "run_id": "run_001",
    "resume_status": "disabled",
    "is_terminal": false
  }
}

resume_already_running 响应体:

409_resume_already_running.json
{
  "detail": {
    "code": "resume_already_running",
    "message": "A checkpoint resume is already running for this session and run.",
    "InvocationId": "inv_existing",
    "SessionId": "<sid>",
    "RunId": "run_001"
  }
}

并发 resume 防抖

同一 (session_id, run_id) 上若已有 resume 在执行,新请求会被 409 resume_already_running 拒绝。客户端应等待既有 resume 终态或取消后再重试, 不要并发对同一 run 发起多个 resume。

CancelRun

取消正在进行的 run。0.6.7 起 InvocationId 成为主键,AgentId 改为可选(仅用于 runner 端 cancel 上下文,不再做 session 归属校验)。

字段默认约束含义
InvocationId必填要取消的 invocation id;0.6.7 起为主键
AgentId可选0.6.7 改为可选;用于 runner cancel 上下文
cancel_run.sh
curl -sS -X POST "https://<public-endpoint>/agentengine/api/v1/CancelRun" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "InvocationId": "inv_xyz"
  }'
cancel_run_response.json
{
  "Code": 0,
  "Message": "Success",
  "RequestId": "req_jkl012",
  "Action": "CancelRun",
  "Data": {
    "Cancelled": true,
    "Found": true,
    "Status": "cancelling",
    "RunnerCancelStatus": "accepted"
  }
}
字段含义
Cancelled是否已请求取消(detached stream 或 runner 接受)
Found是否找到该 invocation 的 detached stream
Statuscancelling / not_found / unsupported / error
RunnerCancelStatusrunner 端 cancel 结果:accepted / cancelling / cancelled / not_found / unsupported / error

CancelRun 不返回 4xx,即便 invocation 不存在也返回 { Cancelled: false, Found: false, Status: "not_found" },客户端据此判断。

ListToolReceipts

列出某 run / checkpoint 下的工具调用回执,用于 resume 前评估副作用或事后审计。

字段默认约束含义
AgentId必填目标 Agent id,须与 session agent_id 一致
SessionId必填目标 session id
RunId可选仅返回该 run 的回执
CheckpointId可选仅返回该 checkpoint 的回执
list_tool_receipts.sh
curl -sS -X POST "https://<public-endpoint>/agentengine/api/v1/ListToolReceipts" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "AgentId": "my-agent",
    "SessionId": "<sid>",
    "RunId": "run_001"
  }'
list_tool_receipts_response.json
{
  "Code": 0,
  "Message": "Success",
  "RequestId": "req_mno345",
  "Action": "ListToolReceipts",
  "Data": {
    "ToolReceipts": [
      {
        "EventId": "evt_010",
        "SessionId": "<sid>",
        "InvocationId": "inv_xyz",
        "SeqId": 10,
        "Timestamp": "2026-07-03T10:00:00Z",
        "ReceiptId": "rcpt_001",
        "IdempotencyKey": "idem_abc",
        "ToolName": "write_workspace_file",
        "ToolCallId": "call_01",
        "RunId": "run_001",
        "CheckpointId": "ckpt_001",
        "Status": "succeeded",
        "Replayed": false,
        "Metadata": { "tool_name": "write_workspace_file" }
      }
    ]
  }
}
字段含义
ReceiptId回执 id,幂等键对应
IdempotencyKey幂等键,重复 replay 时用于去重
ToolName工具名;副作用工具(write_workspace_file 等)会标记 DuplicateSideEffectRisk
ToolCallId对应的 tool call id
RunId / CheckpointId归属 run / checkpoint
Statussucceeded / failed
Replayed是否为 replay 产生的回执
HTTPdetail触发条件
404"Session not found"session 不存在或 AgentId 不匹配

ResumeMode

GetAgentUiBootstrap 返回的 RuntimeCapabilities.ResumeRun.ResumeMode 描述框架级 resume 能力,取值与框架适配相关:

ResumeMode含义
time_travel可回档到历史 checkpoint(LangGraph runner)
forward_only只能沿 invocation 连续性向前续跑,不能回档(ADK runner)
none该框架无框架级 resume 能力

RunLifecycle 能力门控

前端 resume 入口不能只看 ResumeMode,必须同时满足 GetAgentUiBootstrap 返回的 RunLifecycle 两个标志:

  • RunLifecycle.Checkpoints = true:session 存在可用 checkpoint。
  • RunLifecycle.CheckpointResume = true:运行时支持从 checkpoint resume。

任一为 false 时,应视为不支持 resume,前端不应展示 ResumeRun 入口。 CheckpointResumePreview 标注是否提供 preview 能力。

SubscribeRunEvents 续订

SubscribeRunEvents 是 hosted UI 的重连入口,基于持久化事件而非原 TCP 流:

curl -sS -N "https://<public-endpoint>/agentengine/api/v1/SubscribeRunEvents?SessionId=<sid>&InvocationId=<iid>&AfterSeqId=42" \
  -H "Authorization: Bearer <api_key>" \
  -H "Accept: text/event-stream"
字段含义
SessionId目标 session id
InvocationId目标 invocation id
AfterSeqId续订起点 seq_id,返回 seq_id > AfterSeqId 的事件;默认 0 表示从头订阅

5 分钟服务端保护超时

SubscribeRunEvents 服务端保护超时为 5 分钟(5 * 60 秒)。超时后服务端主动关闭 SSE 流,客户端必须用最后消费的 seq_id 作为新的 AfterSeqId 重新发起续订,直到 观察到终态 run_status(completedfailedcancelledinterrupted)。

终态 run_status(completedfailedcancelledinterrupted)出现后服务端 发送 data: [DONE] 并结束流;否则客户端在 5 分钟超时后必须用最新 seq_id 重连续订。

会话列表与事件分页

Hosted UI 提供会话与事件列表 action,支持分页。公开 API 客户端通常不直接对接, 优先使用 OpenAI 兼容的 /v1/*

ListSessions

请求字段:

字段默认约束含义
AgentId必填目标 Agent id
UserIduser可选用户维度隔离
Page1>=1页码,从 1 开始
PageSize201..200每页条数,上限 200

响应 Data 字段:

字段含义
Sessions当前页 session 列表
Total命中条件 session 总数
Page当前页码
PageSize当前每页条数
curl -sS -X POST https://<public-endpoint>/agentengine/api/v1/ListSessions \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"AgentId":"my-agent","UserId":"user","Page":1,"PageSize":20}'

ListSessionEvents

请求字段:

字段默认约束含义
SessionId必填目标 session id
Offset0>=0事件偏移量
Limit不限制>=1返回条数上限;缺省时返回全部事件

响应 Data 字段:

字段含义
Events当前页事件列表
Totalsession 下事件总数
Offset当前偏移量
Limit实际生效的 limit
curl -sS -X POST https://<public-endpoint>/agentengine/api/v1/ListSessionEvents \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"SessionId":"<sid>","Offset":0,"Limit":50}'

设计原则

  • 会话连续性交给 KsADK runtime,不放进全局变量。
  • 业务状态放在框架 state,例如 LangGraph state。
  • 大文件和二进制产物通过 workspace 或 UI 文件面板处理。
  • 共享后端要配置 namespace,避免不同 Agent 或环境互相污染。

本页导航