Skip to content
Letta Platform Letta Platform Letta Docs
Sign up

List Blocks For Agent

client.agents.blocks.list(stringagentID, BlockListParams { after, before, limit, 2 more } query?, RequestOptionsoptions?): ArrayPage<BlockResponse { id, value, base_template_id, 16 more } >
get/v1/agents/{agent_id}/core-memory/blocks

Retrieve the core memory blocks of a specific agent.

ParametersExpand Collapse
agentID: string

The ID of the agent in the format 'agent-'

minLength42
maxLength42
query: BlockListParams { after, before, limit, 2 more }
after?: string | null

Block ID cursor for pagination. Returns blocks that come after this block ID in the specified sort order

before?: string | null

Block ID cursor for pagination. Returns blocks that come before this block ID in the specified sort order

limit?: number | null

Maximum number of blocks to return

order?: "asc" | "desc"

Sort order for blocks by creation time. 'asc' for oldest first, 'desc' for newest first

Accepts one of the following:
"asc"
"desc"
order_by?: "created_at"

Field to sort by

ReturnsExpand Collapse
BlockResponse { id, value, base_template_id, 16 more }
id: string

The id of the block.

value: string

Value of the block.

Deprecatedbase_template_id?: string | null

(Deprecated) The base template id of the block.

created_by_id?: string | null

The id of the user that made this Block.

Deprecateddeployment_id?: string | null

(Deprecated) The id of the deployment.

description?: string | null

Description of the block.

Deprecatedentity_id?: string | null

(Deprecated) The id of the entity within the template.

Deprecatedhidden?: boolean | null

(Deprecated) If set to True, the block will be hidden.

is_template?: boolean

Whether the block is a template (e.g. saved human/persona options).

label?: string | null

Label of the block (e.g. 'human', 'persona') in the context window.

last_updated_by_id?: string | null

The id of the user that last updated this Block.

limit?: number

Character limit of the block.

metadata?: Record<string, unknown> | null

Metadata of the block.

Deprecatedpreserve_on_migration?: boolean | null

(Deprecated) Preserve the block on template migration.

project_id?: string | null

The associated project id.

Deprecatedread_only?: boolean

(Deprecated) Whether the agent has read-only access to the block.

tags?: Array<string> | null

The tags associated with the block.

Deprecatedtemplate_id?: string | null

(Deprecated) The id of the template.

Deprecatedtemplate_name?: string | null

(Deprecated) The name of the block template (if it is a template).

List Blocks For Agent
import Letta from '@letta-ai/letta-client';

const client = new Letta({
  apiKey: process.env['LETTA_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const blockResponse of client.agents.blocks.list('agent-123e4567-e89b-42d3-8456-426614174000')) {
  console.log(blockResponse.id);
}
[
  {
    "id": "id",
    "value": "value",
    "base_template_id": "base_template_id",
    "created_by_id": "created_by_id",
    "deployment_id": "deployment_id",
    "description": "description",
    "entity_id": "entity_id",
    "hidden": true,
    "is_template": true,
    "label": "label",
    "last_updated_by_id": "last_updated_by_id",
    "limit": 0,
    "metadata": {
      "foo": "bar"
    },
    "preserve_on_migration": true,
    "project_id": "project_id",
    "read_only": true,
    "tags": [
      "string"
    ],
    "template_id": "template_id",
    "template_name": "template_name"
  }
]
Returns Examples
[
  {
    "id": "id",
    "value": "value",
    "base_template_id": "base_template_id",
    "created_by_id": "created_by_id",
    "deployment_id": "deployment_id",
    "description": "description",
    "entity_id": "entity_id",
    "hidden": true,
    "is_template": true,
    "label": "label",
    "last_updated_by_id": "last_updated_by_id",
    "limit": 0,
    "metadata": {
      "foo": "bar"
    },
    "preserve_on_migration": true,
    "project_id": "project_id",
    "read_only": true,
    "tags": [
      "string"
    ],
    "template_id": "template_id",
    "template_name": "template_name"
  }
]