Build a Team Memory Multi-Agent Collaboration Workflow with TencentDB Agent Memory
TencentDB Agent Memory crossed 20,000 GitHub stars in 90 days and launched Team Memory on August 13, 2026 — shared long-term memory that lets agents pool conversations, documents, code, and institutional knowledge. This workflow builds a LangGraph multi-agent pipeline where every agent reads and writes a shared memory namespace with ownership, TTL, and conflict resolution.
Deepak Bagada
CEO, SaaSNext
- TencentDB Agent Memory passed 20,000 GitHub stars in 90 days and launched Team Memory on August 13, 2026, extending long-term memory from a single user to an entire team of agents.
- Shared memory is a governance problem first: ownership metadata, TTL, and conflict resolution determine whether pooled context helps agents or quietly poisons them.
- A typed memory schema — facts, decisions, artifacts, running state — keeps retrieval precise and prevents agents from treating stale or conflicting entries as ground truth.
- Namespaces and write-write conflict rules are what make team memory safe for production multi-agent fleets, not just demos.
By Deepak Bagada, CEO at SaaSNext & Principal AI Architect.
Introduction
On August 13, 2026, Tencent Cloud announced that TencentDB Agent Memory — its open-source project giving AI agents durable long-term memory — had passed 20,000 GitHub stars in 90 days, and launched Team Memory in the same release. The new feature extends long-term memory from a single user to a whole team: agents can now share conversations, documents, code, and institutional knowledge with each other. The signal is unambiguous — memory has become a core product layer for multi-agent collaboration, and the market responded to it faster than almost anything else this year.
But shared memory is a double-edged sword. Pooled context makes agents dramatically more useful — a researcher agent's findings feed a writer agent's draft, a planner's decisions steer a reviewer's checklist — and it is also dramatically harder to control. This workflow builds the team-memory-engine: a LangGraph pipeline that gives a multi-agent swarm a shared memory namespace with typed entries, ownership metadata, TTL-based expiry, and explicit conflict resolution. If you are cataloguing the tooling layer as you go, the MCP directory tracks the connector side, while this workflow covers the memory layer itself.
Why shared memory is a governance problem first
Every agent team that tries shared memory learns the same lesson: the hard part is not storing context, it is trusting it. A single agent's memory is a diary; a team's memory is a shared filing system where one wrong entry gets read by everyone. Three failure modes dominate:
- Stale facts. Agent A writes "vendor pricing is $4/1M tokens" on Monday; the vendor reprices on Wednesday; agent B reads the stale entry on Thursday and builds a budget on it.
- Conflicting writes. Two agents research the same question and store different answers. Whichever writes last silently wins, and nobody knows the conflict happened.
- Ownership drift. A decision is stored with no owner and no expiry. Months later, an agent treats a retired plan as current policy.
Team Memory as a product solves the storage problem. The workflow has to solve the trust problem — by making every memory entry typed, owned, and time-boxed, and by making conflicts visible instead of silent. This is the same discipline the AI workflows library applies to state management: state you cannot audit is state you cannot operate.
Architecture overview
graph TD
subgraph Agents[Agent Fleet]
A1[Researcher Agent] --> M[(Team Memory Namespace)]
A2[Planner Agent] --> M
A3[Writer Agent] --> M
A4[Reviewer Agent] --> M
end
M --> R1[Typed Entry Store]
M --> R2[Ownership Index]
M --> R3[TTL Sweeper]
M --> R4[Conflict Resolver]
R1 --> Q[Retrieval Layer]
Q --> AG[Agent Context Builder]
The engine has three layers. The write layer — agents persist entries through a typed API that enforces schema, ownership, and TTL. The store layer — a typed entry store with an ownership index and a sweeper that expires stale entries. The read layer — a retrieval path that filters by namespace, freshness, and type, and surfaces conflicts instead of hiding them. Every agent in the fleet reads and writes through these layers, never directly.
Part 1 — The memory schema
.env
MEMORY_DSN=mysql://user:pass@localhost:3306/team_memory
MEMORY_DEFAULT_TTL_HOURS=72
MEMORY_CONFLICT_POLICY=flag
MEMORY_NAMESPACE_ROOT=acme-platform
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
schemas.py
from pydantic import BaseModel, Field
from typing import List, Literal
from datetime import datetime
MemoryType = Literal["fact", "decision", "artifact", "running"]
class MemoryEntry(BaseModel):
entry_id: str
namespace: str # acme-platform.research or acme-platform.planner
type: MemoryType
content: str
writer: str # which agent wrote it
owner: str # human or team accountable for it
evidence: List[str] = Field(default_factory=list)
ttl_hours: int = 72
created_at: datetime
version: int = 1
supersedes: str | None = None
The type field is the governance lever. A fact requires evidence pointers and a writer identity — it is the only type agents may treat as ground truth. A decision requires an owner and supersedes links. An artifact points at produced work (docs, code, reports) rather than duplicating it. running holds transient state that the sweeper expires aggressively. Typing entries is what keeps retrieval precise and prevents a planner's guess from looking like a researcher's verified fact.
Part 2 — The read/write API
memory_store.py
import json, time, hashlib
import pymysql
from datetime import datetime, timedelta
class TeamMemory:
def __init__(self, dsn, namespace_root):
self.conn = pymysql.connect(...) # from DSN
self.ns_root = namespace_root
def write(self, entry: MemoryEntry) -> str:
# conflict check: same namespace + type + normalized content
existing = self._find_conflict(entry)
if existing and existing["version"] >= entry.version:
return self._resolve(entry, existing)
entry.entry_id = hashlib.sha256(
f"{entry.namespace}|{entry.content}".encode()).hexdigest()[:16]
self._insert(entry)
return entry.entry_id
def read(self, namespace: str, types: list[str] | None = None,
max_age_hours: int = 72) -> list[MemoryEntry]:
rows = self._query(
"SELECT * FROM entries WHERE namespace=%s "
"AND created_at > NOW() - INTERVAL %s HOUR "
"AND expires_at > NOW() ORDER BY created_at DESC",
(namespace, max_age_hours))
return [MemoryEntry(**r) for r in rows]
def _find_conflict(self, entry):
return self._query_one(
"SELECT * FROM entries WHERE namespace=%s AND type=%s "
"AND content_hash=%s AND status='active'",
(entry.namespace, entry.type, hash_content(entry.content)))
def _resolve(self, new_entry, existing):
if CONFLICT_POLICY == "flag":
# surface the conflict to the orchestrator; keep both versions
self._insert(new_entry, status="flagged")
return new_entry.entry_id, "conflict_flagged"
# last-write-wins with supersede chain
self._deactivate(existing["entry_id"])
self._insert(new_entry, supersedes=existing["entry_id"])
return new_entry.entry_id, "superseded"
The _find_conflict check is the heart of the engine: before a new fact lands, the store looks for an active entry in the same namespace with the same normalized content hash. With CONFLICT_POLICY=flag, the second write is stored as flagged and the orchestrator is notified — the conflict becomes a task for a human or a reviewer agent instead of a silent overwrite. With superseded, the old entry is deactivated and the chain is preserved so any consumer can trace the history.
Part 3 — The LangGraph shared-memory workflow
graph.py
from langgraph.graph import StateGraph, END
from typing import TypedDict, Annotated, List
import operator
class SwarmState(TypedDict):
task: str
findings: Annotated[List[dict], operator.add]
conflicts: Annotated[List[dict], operator.add]
shared_memory: dict
def research(s: SwarmState) -> SwarmState:
findings = run_researchers(s["task"])
for f in findings:
entry = MemoryEntry(namespace="acme-platform.research",
type="fact", content=f["claim"],
writer="researcher", owner=s["task"]["owner"],
evidence=f["sources"])
store.write(entry)
s["findings"] = findings
return s
def plan(s: SwarmState) -> SwarmState:
facts = store.read("acme-platform.research", types=["fact"])
decision = MemoryEntry(namespace="acme-platform.planner",
type="decision", content=build_plan(facts),
writer="planner", owner=s["task"]["owner"])
store.write(decision)
s["shared_memory"] = {"plan": decision.entry_id}
return s
def review(s: SwarmState) -> SwarmState:
flagged = store.read("acme-platform.research", status="flagged")
if flagged:
s["conflicts"].append({"flagged": [f.entry_id for f in flagged]})
return s
g = StateGraph(SwarmState)
g.add_node("research", research)
g.add_node("plan", plan)
g.add_node("review", review)
g.set_entry_point("research")
g.add_edge("research", "plan")
g.add_edge("plan", "review")
g.add_edge("review", END)
app = g.compile()
main.py
if __name__ == "__main__":
result = app.invoke({
"task": {"goal": "Q3 pricing analysis", "owner": "finance-team"},
"findings": [], "conflicts": [], "shared_memory": {},
})
print("Conflicts flagged:", result["conflicts"])
Retry rules: memory writes are idempotent — retry on network failure up to 3 times with 400ms exponential backoff, and the content-hash dedupe makes replays harmless. Conflict resolution is never retried automatically: a flagged conflict is a review task, and auto-superseding a second time requires an explicit policy decision. Read failures are retried once with a short backoff, then the orchestrator falls back to the freshest cached copy — a slow memory store should degrade agent speed, not agent correctness. These are the same retry-and-failover rules we document across the AI workflows library.
Part 4 — Retrieval, namespaces, and the TTL sweeper
Retrieval is where shared memory pays off or poisons you. The read layer filters on three dimensions:
- Namespace. Per-capability namespaces (
research,planner,writer) prevent a noisy researcher from polluting what the writer agent reads. Cross-agent artifacts live in a sharedteamnamespace with the strictest ownership rules. - Freshness.
max_age_hoursdefaults to the entry TTL; stale entries are excluded by the sweeper before any agent sees them. The sweeper runs on a 15-minute cycle and marks expired entriesarchived— history is kept for audit, but never served as context. - Type. Retrieval requests are typed (
types=["fact"]for ground truth,types=["decision"]for policy). An agent that needs facts never receives running state, and vice versa.
Observability matters too: every read and write emits an OpenTelemetry span, so a bad decision can be traced back to the exact memory entry that influenced it. That correlation — between a downstream decision and the upstream memory that seeded it — is the same traceability the latest AI news coverage of agent observability keeps coming back to, and it is non-negotiable once memory is shared.
The production checklist
- Type every entry. Facts carry evidence, decisions carry owners, artifacts point to work, running state expires fast. Typed memory is retrievable memory.
- Scope namespaces. Per-capability namespaces plus one governed team namespace beats a single shared bucket every time.
- Make conflicts visible. Flag-then-review beats silent last-write-wins; a visible conflict is a task, a silent one is a bug.
- Sweep the TTL. Archived history stays for audit, but only live entries reach agents — stale context is how agents confidently repeat outdated answers.
- Trace reads and writes. Every memory access emits a span so decisions are explainable and bad entries are findable.
- Start with two agents. Wire shared memory between a researcher and a writer first, prove the ownership and conflict model, then scale the swarm. That staged rollout pattern runs through the AI workflows hub.
Frequently Asked Questions
Q: What is TencentDB Agent Memory and why did it go viral?
A: TencentDB Agent Memory is an open-source project from Tencent Cloud that gives AI agents durable long-term memory. It passed 20,000 GitHub stars in 90 days because agent memory was the missing piece for production agents, and on August 13, 2026 it added Team Memory for shared multi-agent context.
Q: What is Team Memory and how is it different from personal agent memory?
A: Team Memory lets agents share conversations, documents, code, and institutional knowledge across a team, extending long-term memory from one user to a whole group of agents. Personal memory is per-agent; Team Memory is a shared namespace with ownership and governance.
Q: How do you stop shared memory from becoming shared hallucination?
A: By treating memory entries as typed, owned, and time-boxed data: facts carry evidence and a writer identity, decisions carry an owner, every entry has a TTL, and conflicting writes resolve through explicit rules instead of last-write-wins silence.
Q: Should every agent in a fleet share one memory namespace?
A: No. Start with per-agent namespaces and a shared team namespace for cross-agent artifacts. Scoping namespaces by capability and sensitivity keeps retrieval precise and prevents one noisy agent from polluting what every other agent reads.
Q: Does team memory replace vector databases or RAG?
A: No — it complements them. Vector stores and RAG solve retrieval over documents; agent memory solves continuity over time. A shared memory layer sits in front of retrieval so agents persist what they learned, decided, and built across sessions.
Closing thoughts
TencentDB Agent Memory's 20,000 stars in 90 days is the market's verdict: agent memory was the missing layer, and now it has a team edition. The engineering lesson for the rest of us is that shared memory only compounds in value when it is governed — typed entries, owned decisions, expiring facts, and visible conflicts. Build that discipline into your swarm now, and your agents will collaborate like a well-run team instead of a shared hallucination machine. For more on the connector and tooling layer, keep the MCP directory handy, and browse the AI workflows library for the full orchestration patterns.
Enjoyed this breakdown? Get our morning dispatch in your inbox.
Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.
Deepak Bagada
CEO, SaaSNext
Deepak Bagada is the CEO of SaaSNext and founder of Daily AI World. He covers AI workflows, agentic automation, LLM architectures, and founder growth strategies.
Build a Cross-Tool Agent Handoff Workflow with the DeepJudge Agent Handoff Protocol
Next Story →Build an Evidence-Grounded Research Agent Workflow with Zero-Hallucination Citation Verification
Related Intelligence Analysis
The Step-by-Step Guide to Automating Meeting Tasks with Whisper
You're spending 45 minutes after every client meeting typing up notes and manually assigning tasks in Jira. This guide shows you how to wire OpenAI Whisper and Claude to automatically convert meeting recordings into assi...
Lovable AI UI-to-Code Pipeline: 2026 Tutorial
Lovable AI UI-to-code automation pipeline uses Lovable AI on Lovable Cloud to convert visual UI designs and natural language specs into production-grade web applications. UI/UX designers and frontend developers bridging...
Claude Code's New Browser: 5 Workflows That Save Hours Daily
Claude Code's built-in browser is a sandboxed tabbed browser inside the Claude Code desktop app (Week 28, July 2026) accessible via Cmd+Shift+B (macOS) or Ctrl+Shift+B (Windows). It lets Claude open websites, read docume...