How to Stop the TencentDB Agent Memory Service: Complete Shutdown Guide

Run the ./stop-all.sh script from the deploy/global-images directory to gracefully stop the TencentDB Agent Memory service, using the optional --purge flag to permanently delete all persistent volumes, network configurations, and admin keys.

The TencentDB Agent Memory service, available in the TencentCloud/TencentDB-Agent-Memory repository, deploys as a coordinated multi-container Docker stack. Stopping the service properly requires the official shutdown utility rather than manual docker stop commands, ensuring clean termination of the memory engine, knowledge panel, and reverse proxy while optionally preserving or purging persistent state.

Understanding the Service Architecture

The TencentDB Agent Memory service consists of three interconnected containers orchestrated as a unified stack:

  • tdai-memory-core – The core gateway that runs the memory engine
  • tdai-memory-hub – The knowledge panel that serves the UI and stores memory data
  • tdai-proxy – The reverse proxy that exposes the service to external clients

These containers communicate over the dedicated Docker network tdai-memory-stack and mount persistent volumes for data retention. The deploy/global-images/stop-all.sh script manages the lifecycle of these components.

Graceful Shutdown While Preserving Data

To stop the TencentDB Agent Memory service without losing stored memories or configuration, execute the stop script without any flags. This approach is idempotent—running it multiple times is safe and will not error if containers are already stopped.

Navigate to the deployment directory and run the shutdown command:

cd deploy/global-images
./stop-all.sh

As implemented in deploy/global-images/stop-all.sh, the script performs the following actions:

  1. Detects running containers – Checks the Docker daemon for the three service containers (tdai-proxy, tdai-memory-hub, tdai-memory-core)
  2. Force removes containers – Executes docker rm -f on each detected container to ensure immediate termination
  3. Preserves persistent state – Retains the Docker volumes (tdai-memory-core-data, tdai-panel-data), the network bridge tdai-memory-stack, and the .admin-key authentication file

Typical output confirms the container removal:

停止并移除 tdai-proxy
停止并移除 tdai-memory-hub
停止并移除 tdai-memory-core
完成。

After this operation, you can restart the service using ./start-all.sh without losing any data, as the volumes defined in deploy/global-images/start-memory-core.sh remain intact.

Complete Service Reset with --purge

When you need to stop the TencentDB Agent Memory service and permanently erase all persistent data—such as after a corrupted volume, test environment teardown, or fresh deployment requirement—invoke the script with the --purge flag:

cd deploy/global-images
./stop-all.sh --purge

According to the source code in deploy/global-images/stop-all.sh, the --purge flag triggers a comprehensive cleanup that deletes:

  • Data volumes – Permanently removes tdai-memory-core-data and tdai-panel-data containing all stored memories
  • Network infrastructure – Deletes the tdai-memory-stack Docker network
  • Configuration files – Erases the .admin-key file and the generated configuration directories for both the proxy and memory-core components

The extended output confirms the additional cleanup steps:

停止并移除 tdai-proxy
停止并移除 tdai-memory-hub
停止并移除 tdai-memory-core
--purge 已启用:删除 volume + 网络 + admin key 文件
已删除 volume tdai-memory-core-data
已删除 volume tdai-panel-data
已删除网络 tdai-memory-stack
已删除 admin key 文件 /path/to/.admin-key
已删除 proxy config 目录 /path/to/.proxy-config
已删除 memory-core config 目录 /path/to/.memory-core-config
完成。

Warning: This action is irreversible. Only use --purge when you intend to completely reset the service state, as it removes all data that would otherwise persist across restarts.

Verifying Complete Termination

After executing the stop script, confirm that all TencentDB Agent Memory containers have been removed from the system:

docker ps -a --filter "name=tdai-*" --format "{{.Names}}"

If the command returns no output, the service has been completely stopped. If any containers persist, manually remove them with docker rm -f <container_name> before attempting to restart the stack.

Summary

  • Stop Script Location: deploy/global-images/stop-all.sh in the TencentCloud/TencentDB-Agent-Memory repository
  • Graceful Stop: ./stop-all.sh terminates containers while preserving volumes (tdai-memory-core-data, tdai-panel-data), network (tdai-memory-stack), and the .admin-key file
  • Full Reset: ./stop-all.sh --purge deletes all persistent state including volumes, network, admin keys, and configuration directories
  • Target Containers: The script manages three containers: tdai-memory-core, tdai-memory-hub, and tdai-proxy
  • Idempotent Behavior: Safe to run multiple times; only the --purge flag causes data destruction

Frequently Asked Questions

Will stopping the TencentDB Agent Memory service delete my stored memories?

No, executing ./stop-all.sh without flags preserves all stored memories. The script only removes the running containers while retaining the Docker volumes tdai-memory-core-data and tdai-panel-data defined in the deployment configuration. Memories are permanently deleted only when you explicitly use the --purge flag, which wipes all persistent storage and configuration files including .env configurations referenced by .env.example.

How do I restart the service after stopping it?

After running ./stop-all.sh without the --purge flag, simply execute ./start-all.sh from the same deploy/global-images directory. The start script recreates the three containers and reconnects them to the existing volumes, restoring all previous memory data and authentication settings. If you used --purge, you must reconfigure the service from scratch using the environment templates.

What is the difference between stopping and purging the service?

Stopping (./stop-all.sh) performs a container-only teardown, maintaining the Docker network tdai-memory-stack, data volumes, and the .admin-key authentication file for immediate restart capability. Purging (./stop-all.sh --purge) executes a complete infrastructure teardown, deleting containers, volumes, the network bridge, and all generated configuration directories, resulting in a pristine state equivalent to a fresh clone of the repository.

Where is the stop script located relative to the repository root?

The stop script is located at deploy/global-images/stop-all.sh. This directory also contains the complementary start-all.sh orchestration script and the underlying deploy/global-images/start-memory-core.sh launch script, which defines how the core container creates volumes and handles the admin key generation referenced during the cleanup process.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →