TencentCloud/TencentDB-Agent-Memory · error · ParamError

team_id is required with agent_ids

Error message

team_id is required with agent_ids

What it means

_target in memory_prompt.py enforces that agent-scoped prompt operations (apply, clear) supply a team_id whenever agent_ids is given: agent-level targeting requires the team context, so a falsy team_id raises this ParamError.

Source

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

def _required(name: str, value: str) -> str:
    if not isinstance(value, str) or not value.strip():
        raise ParamError(f"{name} must be a non-empty string")
    return value


def _ids(values: Iterable[str], name: str) -> List[str]:
    result = list(dict.fromkeys(values))
    if not result or any(not isinstance(item, str) or not item.strip() for item in result):
        raise ParamError(f"{name} must be a non-empty list of non-empty strings")
    return result


def _target(team_id: Optional[str], agent_ids: Optional[List[str]]) -> None:
    if agent_ids is not None:
        _ids(agent_ids, "agent_ids")
        if not team_id:
            raise ParamError("team_id is required with agent_ids")


class MemoryPromptClient:
    """Synchronous Prompt CRUD, target binding, resolution and setting-log client."""

    def __init__(self, endpoint: str = "", api_key: str = "", service_id: Optional[str] = None,
                 *, team_id: Optional[str] = None, agent_id: Optional[str] = None,
                 timeout: float = 30, verify: bool = True, stub: Optional[Stub] = None) -> None:
        if stub is not None:
            self._stub = stub
        else:
            if not service_id:
                raise ParamError("service_id must be provided")
            self._stub = HttpStub(endpoint, api_key, service_id, timeout=timeout, verify=verify)
        self._team_id = team_id
        self._agent_id = agent_id

    def _get(self, path: str, query: Dict[str, Any]) -> Dict[str, Any]:

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Pass team_id together with agent_ids in apply/clear calls
  2. Use team-only targeting (team_id without agent_ids) if you intend the whole team
  3. Load the team id from your tenant context/config before calling

Example fix

// before
client.apply(agent_ids=['agent-1'])
// after
client.apply(team_id='team-42', agent_ids=['agent-1'])
Defensive patterns

Strategy: validation

Validate before calling

if agent_ids is not None and not team_id:
    raise ValueError('team_id is required when targeting agent_ids')

Type guard

def valid_agent_target(team_id, agent_ids) -> bool:
    return agent_ids is None or bool(team_id and str(team_id).strip())

Try / catch

try:
    client.apply(team_id=team_id, agent_ids=agent_ids)
except ParamError as e:
    logger.error('prompt target misconfigured: %s', e)

Prevention

When it happens

Trigger: apply(team_id=None, agent_ids=['a1']) or clear(agent_ids=[...]) without team_id — i.e. agent_ids provided while team_id is None or empty string.

Common situations: Multi-tenant setups where the team id was not propagated to the prompt client call; callers assuming service-level default team; refactor dropping a team_id argument from the call signature.

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/9a82807705ad16ce. Report an issue: GitHub.