Notion API: Custom Agent をID指定でメンション・アサインする方法 #AI - Qiita
@picnic

Notion API: How to Mention and Assign a Custom Agent by ID

  • Notion
  • API
  • AI
  • LLM
  • Automation
0
Posted at 2026-11-10

Introduction

With the Notion API update on November 10, 2026, you can now mention a shared Custom Agent in rich text by agent ID or bot user ID, or assign it to a people property. Either operation may trigger an agent run.

At the time of the initial release (November 9), assignment required a bot user ID, and mentions in rich text returned a validation_error. This update removes these restrictions, making it easier to invoke Custom Agents from integrations.

📌 Who is affected

  • Developers who want to invoke Custom Agents from Notion API integrations
  • People who wrote code to work around the restrictions in place at the initial release (such as code to retrieve a bot user ID from a people property)
  • Teams building task automation and workflows using Custom Agents

Overview of the changes

Changes

1. Shared Custom Agents can be mentioned and assigned (severity: high)

Item Details
Required capability “View sessions and interact with agents”
Target Shared Custom Agent
Mention Supported in rich text
Assign Supported in people properties
ID that can be specified Either an agent ID or a bot user ID
Side effects Either operation may start an agent run

When reading, a bot user object is returned, and the two IDs are stored as follows:

Field Value
agent_id Agent ID
id Bot user ID

💡 Tips
Mentions and assignments may start an agent run. When testing, it is safer to use a validation page or agent to ensure that no unintended runs occur.

2. Resolution of the initial release restrictions (severity: medium)

Item At initial release From 11/10 onward
ID used for assignment Bot user ID required Agent ID can also be used
Rich text mentions validation_error Supported
Retrieving the bot user ID Guidance to read it from the people property to which the agent is assigned Guidance removed

The description “Two limits apply” in the November 9 entry was rewritten, and the guidance on the workaround for retrieving the bot user ID from the people property was also removed.

3. Remaining restriction (severity: low)

The “List all users” endpoint continues to not return Custom Agents (“still omits Custom Agents”). The previously provided workaround guidance has been removed, and only the restriction is now described.

Impact and mitigation

Actions developers should take

  1. Checking capability: Check whether the integration has the "View sessions and interact with agents" capability.
  2. Reviewing the workaround: If the bot user ID was being extracted from the people property, consider revising the implementation to use the agent ID directly (this is the point marked with action_required in this change).
  3. Updating the documentation – CLAUDE.md: Delete the statements "Rich text mentions are validation_error" and "The bot user ID is obtained from the people property," as they are now outdated.
  4. Design that does not depend on List all users: Since Custom Agents do not appear in the list, manage agent IDs separately.
  5. Checking for unintended execution: Since agent runs can start through mentions or assignments, be careful about automation chains and duplicate execution.

Code examples

Note: Since the input data does not include concrete request/response code, the following is aconceptual illustration of the specification described above. Check the actual payload structure in Notion's official documentation.

Bot user object when reading (example)

{ "object": "user", "type": "bot", "id": "<bot user ID>", "agent_id": "<agent ID>" }

Operational rules: Before / After (for CLAUDE.md)

Before

- Rich-text mentions of Custom Agents result in a validation_error - Retrieve the bot user ID from the people property to which the agent is assigned

After

- Custom Agents can be invoked via rich-text mentions or by assigning them to the people property (Either the agent ID or the bot user ID can be used. The required capability is “View sessions and interact with agents”) - Either action may start an agent run - When reading, the bot user object’s agent_id contains the agent ID, and id contains the bot user ID - List all users does not return Custom Agents (this limitation remains)

Summary

  • It is now possible to mention or assign a shared Custom Agent using either an agent ID or a bot user ID (requires the “View sessions and interact with agents” capability).
  • Either mentioning or assigning may start an agent run.
  • In the bot user object when reading, agent_id is the agent ID, and id is the bot user ID.
  • The validation_error from the initial release and the restriction requiring a bot user ID have been resolved. If a workaround has already been implemented, consider reviewing it.
  • Because List all users still does not return Custom Agents, manage the agent ID separately.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently review useful information
  3. You can use the dark theme
What you can do by signing up
Sign upLogin