TencentCloud/TencentDB-Agent-Memory · error · ParamError

team_id is required for effective prompt lookup

Error message

team_id is required for effective prompt lookup

What it means

get_effective resolves the effective prompt for a team/agent/layer combination; the API requires at least a team_id. If neither the explicit team_id argument nor the instance-level self._team_id (set at construction) yields a value, the client raises ParamError because the server cannot scope the lookup without it.

Source

Thrown at sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py:74

    def create(self, *, name: str, layer: str, prompt: str) -> Dict[str, Any]:
        return self._stub.post(f"{_ROOT}/create", {
            "name": _required("name", name), "layer": layer, "prompt": _required("prompt", prompt),
        })

    def get(self, memory_prompt_id: str) -> Dict[str, Any]:
        return self._get(f"{_ROOT}/get", {"memory_prompt_id": _required("memory_prompt_id", memory_prompt_id)})

    def list(self, *, layer: Optional[str] = None, limit: Optional[int] = None,
             offset: Optional[int] = None, time_order: Optional[str] = None) -> Dict[str, Any]:
        return self._get(f"{_ROOT}/get", _strip_none({
            "layer": layer, "limit": limit, "offset": offset, "time_order": time_order,
        }))

    def get_effective(self, *, layer: str, team_id: Optional[str] = None,
                      agent_id: Optional[str] = None) -> Dict[str, Any]:
        team, agent = team_id or self._team_id, agent_id or self._agent_id
        if not team:
            raise ParamError("team_id is required for effective prompt lookup")
        return self._get(f"{_ROOT}/get", _strip_none({"team_id": team, "agent_id": agent, "layer": layer}))

    def update(self, memory_prompt_id: str, *, name: Optional[str] = None,
               prompt: Optional[str] = None) -> Dict[str, Any]:
        if name is None and prompt is None:
            raise ParamError("name or prompt is required")
        return self._stub.post(f"{_ROOT}/update", _strip_none({
            "memory_prompt_id": _required("memory_prompt_id", memory_prompt_id), "name": name, "prompt": prompt,
        }))

    def delete(self, memory_prompt_ids: Iterable[str]) -> Dict[str, Any]:
        return self._stub.post(f"{_ROOT}/delete", {"memory_prompt_ids": _ids(memory_prompt_ids, "memory_prompt_ids")})

    def apply(self, memory_prompt_id: str, *, layer: str, team_id: Optional[str] = None,
              agent_ids: Optional[List[str]] = None) -> Dict[str, Any]:
        team = team_id or self._team_id
        _target(team, agent_ids)
        return self._stub.post(f"{_ROOT}/set", _strip_none({

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Pass team_id explicitly: get_effective(layer="system", team_id="my-team").
  2. Construct MemoryPrompt with a default team_id so it is inherited by every call.
  3. If scoping per agent, still supply the owning team_id alongside agent_id.

Example fix

# before
client = MemoryPrompt(endpoint=E, api_key=K, service_id=S)
client.get_effective(layer="system")  # raises

# after
client = MemoryPrompt(endpoint=E, api_key=K, service_id=S, team_id="my-team")
client.get_effective(layer="system")
Defensive patterns

Strategy: validation

Validate before calling

team = team_id or client._team_id
if not team:
    raise ValueError("team_id is required for get_effective")
result = client.get_effective(layer=layer, team_id=team, agent_id=agent_id)

Type guard

def is_nonempty_str(v: object) -> bool:
    return isinstance(v, str) and bool(v.strip())

Try / catch

try:
    prompt = client.get_effective(layer="system", team_id=team_id)
except ParamError as e:
    logging.warning("Effective prompt lookup rejected: %s", e)
    prompt = None  # fall back to a default prompt

Prevention

When it happens

Trigger: Calling get_effective(layer=...) with no team_id argument on a client constructed without team_id, even if agent_id is provided.

Common situations: Scripts that construct MemoryPrompt without the optional team_id and later call get_effective; teams/instances renamed so the stored default team_id was dropped; snippets copied from examples that always pass team_id.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/8fe3fc3cf4888e9d. Report an issue: GitHub.