---
title: "Agent Account Provisioning"
description: "Agent account provisioning provides a zero-friction mechanism for autonomous AI agents to bootstrap platform credentials, establish ownership identities, and interact with remote memory services wi..."
last_updated: "2026-10-11T17:37:10.214965+00:00"
canonical_url: "https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/cli-tools/agent-account-provisioning"
---

<details>
<summary>Relevant source files</summary>

The following files were used as context for generating this wiki page:

- [cli/python/src/mem0_cli/commands/init_cmd.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/init_cmd.py)
- [cli/node/src/commands/init.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/init.ts)
- [integrations/openclaw/cli/commands.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/cli/commands.ts)
- [cli/node/src/commands/agent-mode.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts)
- [cli/python/src/mem0_cli/commands/agent_mode_cmd.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py)
- [integrations/mem0-agent-plugin/core/memory_cli.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/memory_cli.py)
- [cli/python/src/mem0_cli/app.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/app.py)
- [cli/python/src/mem0_cli/commands/identify_cmd.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/identify_cmd.py)
- [cli/node/src/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/index.ts)
- [cli/node/src/commands/identify.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/identify.ts)
- [cli/python/src/mem0_cli/commands/whoami_cmd.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/whoami_cmd.py)
- [integrations/mem0-agent-plugin/core/telemetry.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/mem0-agent-plugin/core/telemetry.py)
- [integrations/agent-plugin-core/python/telemetry.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/agent-plugin-core/python/telemetry.py)
- [cli/python/src/mem0_cli/commands/agent_rush_cmd.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_rush_cmd.py)
- [integrations/openclaw/index.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/index.ts)
- [cli/node/src/commands/agent-rush.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-rush.ts)
- [cli/node/src/agent-detect.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/agent-detect.ts)
- [cli/node/src/commands/whoami.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/whoami.ts)
- [cli/python/src/mem0_cli/agent_detect.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/agent_detect.py)
- [cli/node/src/state.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/state.ts)
- [integrations/openclaw/isolation.ts](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/integrations/openclaw/isolation.ts)
- [cli/python/src/mem0_cli/output.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/output.py)
- [cli/python/src/mem0_cli/state.py](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/state.py)
</details>

## Overview

Agent account provisioning provides a zero-friction mechanism for autonomous AI agents to bootstrap platform credentials, establish ownership identities, and interact with remote memory services without manual browser-based authentication. By evaluating environment heuristics and state flags, the command-line interface automatically detects autonomous execution contexts and initiates backend provisioning to mint shadow API keys and slug-derived user identifiers. This workflow addresses the friction of programmatic onboarding, enabling unattended initialization while maintaining secure pathways for human operators to claim and upgrade provisioned accounts to permanent email-bound identities via one-time passwords. Once configured, agents can self-identify, manage metadata schemas, and execute specialized remote workloads such as `[[AGENTRUSH]]` operations under fully provisioned credentials.

Sources: [cli/python/src/mem0_cli/commands/init_cmd.py:214-239](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/init_cmd.py#L214-L239), [cli/node/src/commands/agent-mode.ts:38-55](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L38-L55), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:52-70](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L52-L70), [cli/python/src/mem0_cli/agent_detect.py:1-13](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/agent_detect.py#L1-L13)

## Agent Context Detection

### Environment Heuristics and Curated Runtimes

The command-line interface determines whether it is running within an autonomous agent context by inspecting environment heuristics, state flags, and specific runtime indicators. During initialization via `mem0 init`, the detection logic checks if an explicit agent flag is active, evaluates global agent mode state flags, or queries runtime environment variables for recognized AI agent frameworks.

The detection module scans the environment for curated environment variables mapped to known agent runtimes. This check serves as a context trigger only; it enables zero-friction auto-bootstrap UX but does not automatically populate canonical agent identity fields on platform records.

| Agent Runtime | Associated Environment Variables |
| :--- | :--- |
| `claude-code` | `CLAUDECODE`, `CLAUDE_CODE` |
| `cursor` | `CURSOR_AGENT`, `CURSOR_SESSION_ID` |
| `codex` | `CODEX_CLI`, `OPENAI_CODEX` |
| `cline` | `CLINE_AGENT`, `CLINE` |
| `continue` | `CONTINUE_AGENT`, `CONTINUE_SESSION` |
| `aider` | `AIDER_SESSION` |
| `goose` | `GOOSE_AGENT` |
| `windsurf` | `WINDSURF_AGENT` |

Sources: [cli/node/src/agent-detect.ts:14-31](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/agent-detect.ts#L14-L31), [cli/python/src/mem0_cli/agent_detect.py:19-36](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/agent_detect.py#L19-L36)

> [!NOTE]
> Environment variable detection returns a canonical short name or `null`. Unrecognized environment variables fall through to `null`, treating the caller as a non-agent unless overridden by explicit CLI flags.

Sources: [cli/python/src/mem0_cli/agent_detect.py:9-12](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/agent_detect.py#L9-L12)

### State Flags and Resolution Rules

The composite agent context check (`_agent_ctx`) combines three distinct Boolean conditions evaluated sequentially during initialization:

```python
_agent_ctx = agent or _global_agent_mode() or (detect_agent_caller() is not None)
```

Sources: [cli/python/src/mem0_cli/commands/init_cmd.py:266-266](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/init_cmd.py#L266-L266)

State management utilities track whether the root option handler has enabled agent mode globally, while individual commands access or mutate this state.

> [!WARNING]
> When running in agent mode, standard pipe detection via `stdinIsPiped()` forces a return value of `false` to prevent interactive stream blocking.

Sources: [cli/node/src/state.ts:44-46](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/state.ts#L44-L46)

## Autonomous Backend Bootstrapping

### Request Dispatch and Platform Envelopes

When autonomous agent context detection is triggered during initialization, the command-line interface executes a unattended HTTP POST request to the remote platform endpoint `/api/v1/auth/agent_mode/`. Both the Python and Node.js client implementations transmit custom client language and source headers alongside optional payload fields such as the analytics source tag and the self-declared `agent_caller` identity. 

```typescript
const SOURCE_HEADERS = {
	"X-Mem0-Source": "cli",
	"X-Mem0-Client-Language": "node",
} as const;

export interface BootstrapEnvelope {
	api_key: string;
	default_user_id: string;
	org_id: string;
	project_id: string;
	mcp_url?: string;
	smoke_test_url?: string;
	claim_command?: string;
	mem0_notice?: string;
}
```
Sources: [cli/node/src/commands/agent-mode.ts:11-25](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L11-L25), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:26-29](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L26-L29)

The backend responds with a JSON bootstrap envelope containing the provisioned API credentials, organizational scopes, and default user identifiers. The client validation logic enforces strict type checks to ensure that required fields such as `api_key` and `default_user_id` are populated strings before persisting the configuration locally.

| Envelope Field | Type | Description |
| :--- | :--- | :--- |
| `api_key` | `string` | Provisioned shadow API authentication token |
| `default_user_id` | `string` | Slug-derived user identifier for memory scoping |
| `org_id` | `string` | Associated platform organization identifier |
| `project_id` | `string` | Associated platform project identifier |
| `mcp_url` | `string` (optional) | Remote Model Context Protocol endpoint |
| `smoke_test_url` | `string` (optional) | Automated verification endpoint |
| `claim_command` | `string` (optional) | Terminal command to bind account to an email |
| `mem0_notice` | `string` (optional) | Unclaimed account reminder message |

Sources: [cli/node/src/commands/agent-mode.ts:16-25](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L16-L25), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:32-50](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L32-L50)

> [!CAUTION]
> If the backend response omits required fields or returns a null API key, the client aborts immediately with a non-zero exit code to prevent persisting malformed or undefined credentials.

Sources: [cli/node/src/commands/agent-mode.ts:116-124](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L116-L124), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:32-50](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L32-L50)

### Error Handling and Rate Limiting

The bootstrap workflow intercepts specific HTTP status codes to handle network interruptions, service availability, and rate-limiting constraints without leaking raw backend tracebacks.

| Status Code | Trigger Condition | Handled Message / Action |
| :--- | :--- | :--- |
| `429` | Request frequency limit exceeded | Rate-limited message; exits with status `1` |
| `503` | Platform maintenance or feature toggle | Temporary disablement notice; exits with status `1` |
| `403` | Django REST Framework `PermissionDenied` | Daily signup limit reached (5/day per IP); exits with status `1` |
| Other `!ok` | General API error or invalid payload | Extracts `error` or `detail` field from JSON body; exits with status `1` |

Sources: [cli/node/src/commands/agent-mode.ts:82-113](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L82-L113), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:89-112](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L89-L112)

> [!WARNING]
> The backend rate limiter raises a generic `PermissionDenied` exception translated by Django REST Framework into an HTTP 403 status code with an opaque message. The CLI inspects this response for permission strings and normalizes it into a daily network signup quota warning.

Sources: [cli/node/src/commands/agent-mode.ts:101-110](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L101-L110), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:102-110](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L102-L110)

## Interactive Claim and Upgrade Flow

### OTP Verification and Upgrade Sequence

The claim workflow allows human operators to bind an agent-provisioned shadow account to a permanent email identity without requiring a browser session or polling loops. When an existing configuration contains an active agent mode API key and a user passes the `--email` flag to the initialization command, the CLI dispatches a device claim flow using a one-time passcode.

```python
if email and CONFIG_FILE.exists():
    existing = load_config()
    if existing.platform.agent_mode and existing.platform.api_key:
        email = email.strip().lower()
        _validate_email(email)
        print_info(console, f"Claiming Agent Mode account to {email}...")
        claim_via_otp(existing, email=email, code=code)
        _fire_init("email", claimed=True)
        return
```
Sources: [cli/python/src/mem0_cli/commands/init_cmd.py:252-260](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/init_cmd.py#L252-L260)

The upgrade process executes in two explicit phases across both the Python and Node.js implementations:

1. **Passcode Generation Request**: Unless a verification code is provided directly via the `--code` flag, the CLI transmits a `POST` request to `/api/v1/auth/email_code/` containing the target email address. If the terminal is running in an interactive TTY session, it prompts the operator for the received code; non-interactive environments without a supplied code terminate immediately with a usage hint.
2. **Atomic Verification and Claim**: The client sends a `POST` request to `/api/v1/auth/email_code/verify/` carrying the email, the trimmed verification code, and the raw agent mode API key under the parameter `agent_mode_api_key`. The backend processes this inline to execute an upgrade-in-place transaction.

```typescript
// Step 1: request OTP (unless --code was supplied)
if (!code) {
	const sendResp = await fetch(`${baseUrl}/api/v1/auth/email_code/`, {
		method: "POST",
		headers: { ...SOURCE_HEADERS, "Content-Type": "application/json" },
		body: JSON.stringify({ email }),
		signal: AbortSignal.timeout(30_000),
	});
	if (sendResp.status === 429) {
		printError("Too many attempts. Try again in a few minutes.");
		process.exit(1);
	}
	if (!sendResp.ok) {
		let detail: string = sendResp.statusText;
		try {
			const errBody = (await sendResp.json()) as { error?: string };
			if (errBody.error) detail = errBody.error;
		} catch {
			/* leave as statusText */
		}
		printError(`Failed to send code: ${detail}`);
		process.exit(1);
	}

	printSuccess(`Verification code sent to ${email}. Check your inbox.`);

	if (!process.stdin.isTTY) {
		printError(
			"No --code provided and terminal is non-interactive.",
			`Re-run: mem0 init --email ${email} --code <code>`,
		);
		process.exit(1);
	}

	console.log();
	code = await promptLine(`  ${brand("Verification Code")}`);
	if (!code) {
		printError("Code is required.");
		process.exit(1);
	}
}

// Step 2: verify + claim atomically
const verifyResp = await fetch(`${baseUrl}/api/v1/auth/email_code/verify/`, {
	method: "POST",
	headers: { ...SOURCE_HEADERS, "Content-Type": "application/json" },
	body: JSON.stringify({
		email,
		code: code.trim(),
		agent_mode_api_key: rawKey,
	}),
```
Sources: [cli/node/src/commands/agent-mode.ts:180-230](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L180-L230), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:165-208](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L165-L208)

> [!NOTE]
> During the upgrade-in-place transaction, the underlying shadow API key value remains completely unchanged. The backend updates account ownership associations while preserving existing authentication tokens.

Sources: [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:143-153](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L143-L153)

### State Mutations and Error Handling

Upon receiving a successful verification response confirming `claimed: true`, the local configuration file is mutated to reflect the permanent identity state. The `platform.agent_mode` flag is disabled, `platform.claimed_at` is stamped with the verification timestamp (or current UTC time), `platform.user_email` is populated with the verified address, and `platform.created_via` switches from `agent_mode` to `email`.

```python
claim_body = verify.json()
if not claim_body.get("claimed"):
    print_error(err_console, f"Unexpected verify response: {claim_body}")
    raise typer.Exit(1)

config.platform.agent_mode = False
config.platform.claimed_at = claim_body.get("claimed_at") or _utcnow_iso()
config.platform.user_email = email
config.platform.created_via = "email"
save_config(config)
print_success(console, f"Agent claimed to {email}. Your API key is unchanged.")
```
Sources: [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:225-235](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L225-L235)

| Response Error Code | Trigger Condition | Handled Action / Guidance |
| :--- | :--- | :--- |
| `email_already_claimed` | The target email is already bound to another Mem0 account | Prints error details alongside a tip instructing the operator to sign in at `app.mem0.ai`; exits with status `1` |
| Other `!ok` status | General validation failure, expired OTP, or network rejection | Extracts the error message or response text and terminates with status `1` |

Sources: [cli/node/src/commands/agent-mode.ts:234-260](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L234-L260), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:210-224](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L210-L224)

> [!WARNING]
> If a verification request fails because the email address is already registered to a separate account (`email_already_claimed`), the CLI prevents accidental credential overwrites and guides the user toward standard web authentication.

Sources: [cli/node/src/commands/agent-mode.ts:250-265](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-mode.ts#L250-L265), [cli/python/src/mem0_cli/commands/agent_mode_cmd.py:219-223](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_mode_cmd.py#L219-L223)

## Agent Ownership Identification

### Identification Commands and Schema Mutations

When an agent-mode initialization occurs without supplying an explicit `--agent-caller` argument, the platform backend initializes the row with `agent_caller=NULL`. To resolve this, active agents execute `mem0 identify <name>` (`run_identify` in Python and TypeScript implementations) to issue a schema mutation against the platform backend.

```python
Used when `mem0 init --agent` ran without --agent-caller, so the backend
saved agent_caller=NULL. The agent re-runs `mem0 identify <name>` to PATCH
its own row with its real identity. Idempotent — running it again just
overwrites.
"""
```
Sources: [cli/python/src/mem0_cli/commands/identify_cmd.py:3-7](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/identify_cmd.py#L3-L7)

The CLI validates that an active API key exists and that `agent_mode` is enabled in the local configuration before transmitting payloads. Requests target the endpoint `/api/v1/auth/agent_mode/caller/` via HTTP `PATCH` with headers specifying `X-Mem0-Source: cli`, `X-Mem0-Client-Language` (`python` or `node`), and a bearer token authentication header.

```python
_SOURCE_HEADERS = {
    "X-Mem0-Source": "cli",
    "X-Mem0-Client-Language": "python",
}


def run_identify(name: str) -> None:
    """PATCH the active agent-mode key's agent_caller field."""
    config = load_config()
    if not config.platform.api_key:
        print_error(
            err_console,
            "No API key configured. Run `mem0 init --agent` first.",
        )
        raise typer.Exit(1)
    if not config.platform.agent_mode:
        print_error(
            err_console,
            "This command only works on unclaimed agent-mode keys.",
        )
        raise typer.Exit(1)

    name = (name or "").strip()
    if not name:
        print_error(err_console, "Agent name is required.")
        raise typer.Exit(1)

    base_url = (config.platform.base_url or "https://api.mem0.ai").rstrip("/")
    try:
        with httpx.Client(timeout=30.0) as client:
            resp = client.patch(
                f"{base_url}/api/v1/auth/agent_mode/caller/",
                headers={
                    **_SOURCE_HEADERS,
                    "Authorization": f"Token {config.platform.api_key}",
                    "Content-Type": "application/json",
                },
                json={"agent_caller": name},
            )
```
Sources: [cli/python/src/mem0_cli/commands/identify_cmd.py:21-59](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/identify_cmd.py#L21-L59), [cli/node/src/commands/identify.ts:12-50](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/identify.ts#L12-L50)

> [!NOTE]
> The identify command is idempotent; running it multiple times overwrites the existing row value. If the response returns a canonicalized `agent_caller` field, the local configuration updates to match the server-side normalization.

Sources: [cli/python/src/mem0_cli/commands/identify_cmd.py:5-6](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/identify_cmd.py#L5-L6), [cli/python/src/mem0_cli/commands/identify_cmd.py:72-74](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/identify_cmd.py#L72-L74)

### AGENTRUSH Identifier Resolution

To inspect the provisioned agent's `default_user_id` without network traversal, agents execute `mem0 whoami` (`run_whoami` / `cmdWhoami`). This command reads directly from local configuration storage to output the assigned AGENTRUSH session identifier and directs operators to view their row at `https://mem0.ai/agentrush`.

```python
"""mem0 whoami — print the active agent's default_user_id (AGENTRUSH identifier)."""

from __future__ import annotations

import typer
from rich.console import Console

from mem0_cli.branding import BRAND_COLOR, print_error, print_info
from mem0_cli.config import load_config

console = Console()
err_console = Console(stderr=True)


def run_whoami() -> None:
    config = load_config()
    session_id = config.platform.default_user_id if config.platform else None
    if not session_id:
        print_error(
            err_console,
            "No default_user_id found. Run `mem0 init --agent` first.",
        )
        raise typer.Exit(1)
    console.print(f"Your AGENTRUSH identifier:  [{BRAND_COLOR}]{session_id}[/{BRAND_COLOR}]")
    print_info(console, "Find your row at https://mem0.ai/agentrush")
```
Sources: [cli/python/src/mem0_cli/commands/whoami_cmd.py:1-25](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/whoami_cmd.py#L1-L25), [cli/node/src/commands/whoami.ts:1-18](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/whoami.ts#L1-L18)

> [!WARNING]
> If `default_user_id` is absent from local settings, `mem0 whoami` halts execution and instructs the operator to execute `mem0 init --agent` first.

Sources: [cli/python/src/mem0_cli/commands/whoami_cmd.py:18-23](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/whoami_cmd.py#L18-L23), [cli/node/src/commands/whoami.ts:11-15](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/whoami.ts#L11-L15)

## Provisioned Agent Runtime Capabilities

### AGENTRUSH Execution and API Routing

Provisioned agents interact with the platform using dedicated game commands wrapped by `mem0 agent-rush add` and `mem0 agent-rush search`. These commands issue `POST` requests to hardcoded endpoints `/v1/agent-rush/memories/` and `/v1/agent-rush/memories/search/` using base URLs resolved from local configuration files. 

```python
"""mem0 agent-rush — AGENTRUSH game commands.

Wraps the platform's /v1/agent-rush/{memories/, memories/search/} endpoints.
Hardcoded routing; no flags needed.
"""
```
Sources: [cli/python/src/mem0_cli/commands/agent_rush_cmd.py:1-5](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_rush_cmd.py#L1-L5), [cli/node/src/commands/agent-rush.ts:1-4](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-rush.ts#L1-L4)

All runtime requests carry specialized source headers including `X-Mem0-Source: cli`, `X-Mem0-Client-Language` (`python` or `node`), `X-Mem0-Mode: agent-rush`, and an authorization header containing the agent's API token.

```python
_SOURCE_HEADERS = {
    "X-Mem0-Source": "cli",
    "X-Mem0-Client-Language": "python",
    "X-Mem0-Mode": "agent-rush",
}
```
Sources: [cli/python/src/mem0_cli/commands/agent_rush_cmd.py:29-33](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_rush_cmd.py#L29-L33), [cli/node/src/commands/agent-rush.ts:50-57](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-rush.ts#L50-L57)

### Verification and Error Handling

When errors occur during runtime execution, the CLI parses response codes from platform payloads and maps them to descriptive user hints.

| Error Code | Descriptive Hint Text |
| :--- | :--- |
| `agentrush_search_first` | Run 3 'mem0 agent-rush search' commands before adding. |
| `agentrush_search_quota` | You've used your 3 lifetime searches. |
| `agentrush_add_quota` | You've used your 3 lifetime adds. |
| `agentrush_not_agent_mode` | Re-run 'mem0 init --agent' to bootstrap an agent-mode key. |
| `agentrush_length` | Memory text must be 50-1000 characters. |
| `agentrush_no_urls` | URLs are not allowed. |
| `agentrush_blocklist` | Content contains a blocked term. |
| `agentrush_global_quota` | Event-wide cap reached. Try again later. |
| `agentrush_not_provisioned` | AGENTRUSH is not provisioned in this environment. |

```python
_ERROR_HINTS = {
    "agentrush_search_first": "Run 3 'mem0 agent-rush search' commands before adding.",
    "agentrush_search_quota": "You've used your 3 lifetime searches.",
    "agentrush_add_quota": "You've used your 3 lifetime adds.",
    "agentrush_not_agent_mode": "Re-run 'mem0 init --agent' to bootstrap an agent-mode key.",
    "agentrush_length": "Memory text must be 50-1000 characters.",
    "agentrush_no_urls": "URLs are not allowed.",
    "agentrush_blocklist": "Content contains a blocked term.",
    "agentrush_global_quota": "Event-wide cap reached. Try again later.",
    "agentrush_not_provisioned": "AGENTRUSH is not provisioned in this environment.",
}
```
Sources: [cli/python/src/mem0_cli/commands/agent_rush_cmd.py:35-45](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_rush_cmd.py#L35-L45), [cli/node/src/commands/agent-rush.ts:18-31](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-rush.ts#L18-L31)

> [!WARNING]
> AGENTRUSH memories are fully public and visible to other participants. In interactive TTY environments, submission blocks until the operator explicitly acknowledges the PII warning and persists the timestamp under `acknowledged_at`. In non-interactive agent runs lacking a TTY, the CLI prints the warning to standard error and proceeds without blocking.

Sources: [cli/python/src/mem0_cli/commands/agent_rush_cmd.py:86-115](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/python/src/mem0_cli/commands/agent_rush_cmd.py#L86-L115), [cli/node/src/commands/agent-rush.ts:100-119](https://github.com/blade47/mem0/blob/b7ad69afda6b6ed030347c66d48a13e4de9dec08/cli/node/src/commands/agent-rush.ts#L100-L119)

## Related

- [Python CLI Architecture](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/cli-tools/python-cli-architecture)
- [Node.js CLI Architecture](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/cli-tools/node-js-cli-architecture)


## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/llms.txt) for all pages in this wiki.
