Skip to content

feat(memory): add TOS ContextBucket long-term memory backend#703

Open
huangmorven wants to merge 1 commit into
volcengine:mainfrom
huangmorven:feat/mem-tos-context-bucket
Open

feat(memory): add TOS ContextBucket long-term memory backend#703
huangmorven wants to merge 1 commit into
volcengine:mainfrom
huangmorven:feat/mem-tos-context-bucket

Conversation

@huangmorven

Copy link
Copy Markdown

Introduce a tos_context long-term memory backend backed by Volcengine TOS ContextBucket, and wire it through configuration, the cloud harness, tests, and docs.

Backend & wiring

  • Add TosContextBucketLTMBackend that maps VeADK's memory abstraction onto ContextBucket coordinates (app_name/index -> context bucket, user_id -> context set), with lazy bucket ensure and the standard save/search hooks.
  • Register the backend under backend="tos_context" and strip the injected session_id / app_name kwargs the SDK does not accept.
  • Add TOSContextBucketConfig and the harness env mapping so the backend can be configured from config.yaml and provisioned on the cloud platform.

Credentials

  • Resolve credentials via _get_ak_sk_sts(): use explicit AK/SK (with the STS token from VOLCENGINE_SESSION_TOKEN) when both are present, otherwise fall back to the VeFaaS IAM credential file, mirroring VikingDBLTMBackend so keyless cloud (VeFaaS / AgentKit) deployments authenticate correctly.
  • Use the global VOLCENGINE_SESSION_TOKEN for the STS token instead of a standalone DATABASE_TOS_CONTEXT_SECURITY_TOKEN, matching TOS object storage and other components.

Fail-closed dependency handling

  • ContextBucket APIs require tos>=2.9.4b1 (beta). Keep the core dependency at tos>=2.8.4 and probe TosClientV2 for the required methods at init, raising a clear RuntimeError with the upgrade command when the installed SDK is too old.

Tests & docs

  • Add backend and harness tests covering the explicit / IAM-fallback / VOLCENGINE_SESSION_TOKEN-default credential paths and the env mapping.
  • Add zh/en wiki pages, update the long-term memory index and sidebar, and extend config.yaml.full with the tos_context section and credential notes.

@huangmorven
huangmorven force-pushed the feat/mem-tos-context-bucket branch 3 times, most recently from f6ab474 to 9dd6998 Compare July 23, 2026 05:43
@huangmorven
huangmorven force-pushed the feat/mem-tos-context-bucket branch from 9dd6998 to 118cdb7 Compare July 23, 2026 12:58
Introduce a `tos_context` long-term memory backend backed by Volcengine
TOS ContextBucket, wired through the runtime direct-connect path
(LongTermMemory(backend="tos_context")), configuration, tests, and docs.

Backend & wiring
- Add TosContextBucketLTMBackend that maps VeADK's memory abstraction onto
  ContextBucket coordinates (app_name/index -> context bucket, user_id ->
  context set), with lazy bucket ensure and the standard save/search hooks.
- Register the backend under backend="tos_context" and strip the injected
  session_id / app_name kwargs the SDK does not accept.
- Add TOSContextBucketConfig so the backend can be configured from
  config.yaml.

Credentials
- Resolve credentials via _get_ak_sk_sts(): use explicit AK/SK (with the STS
  token from VOLCENGINE_SESSION_TOKEN) when both are present, otherwise fall
  back to the VeFaaS IAM credential file, mirroring VikingDBLTMBackend so
  keyless cloud (VeFaaS / AgentKit) deployments authenticate correctly.
- Use the global VOLCENGINE_SESSION_TOKEN for the STS token instead of a
  standalone DATABASE_TOS_CONTEXT_SECURITY_TOKEN, matching TOS object storage
  and other components.

Fail-closed dependency handling
- ContextBucket APIs require tos>=2.9.4b1 (beta). Keep the core dependency at
  tos>=2.8.4 and probe TosClientV2 for the required methods at init, raising a
  clear RuntimeError with the upgrade command when the installed SDK is too old.

Tests & docs
- Add backend tests covering the explicit / IAM-fallback /
  VOLCENGINE_SESSION_TOKEN-default credential paths.
- Add zh/en wiki pages, update the long-term memory index and sidebar, and
  note in the backend comparison table that temporary credentials need
  VOLCENGINE_SESSION_TOKEN (with an anchor to the configuration section).
- Extend config.yaml.full with the tos_context section; the STS token uses the
  global VOLCENGINE_SESSION_TOKEN documented on the backend page rather than a
  dedicated placeholder.

Note: the backend targets the runtime direct-connect path only; the CLI
harness template and cloud harness env mapping are intentionally not wired
for tos_context.
@huangmorven
huangmorven force-pushed the feat/mem-tos-context-bucket branch from 118cdb7 to 43b2573 Compare July 23, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants