Most companies are trying to figure out how people and AI can naturally work
together. Our opinion on
[how humans and AI will work together](/blog/how-humans-and-ai-will-work-together-in-the-next-generation-of-apps)
is that the best place to start is with patterns people already understand, such
as comments. They’re familiar, they’re anchored to real context, and they turn
out to be one of the most natural ways to bring AI into a product.

Check out what we’ve recently released, whether you already have Comments live
or have been meaning to add them.

## Public and private threads

Comment threads now have a `visibility` property. Each thread is public by
default, private when you need it, with permissions to control exactly who can
see and reply. That unlocks internal-only notes, private review workflows, and
feedback that only the right people can see.

<Figure
  caption={
    <>
      Creating a private comment in our{" "}
      <Link href="/examples/comments-private/nextjs-comments-private">
        Private Commenting
      </Link>{" "}
      example.
    </>
  }
>
  <MuxVideo
    playbackId="MGkQwus2lk8crQNorXUd7P7r01iMFJ019VLsi5CI9qWnU"
    alt="Private comments blog"
    static={true}
  />
</Figure>

### How private commenting works

To enable creating private threads, pass the `visibility="private"` option to
[`Composer`](/docs/api-reference/liveblocks-react-ui#Composer).

```tsx
import { Composer } from "@liveblocks/react-ui";

function PrivateCommentComposer() {
  return (
    // +++
    <Composer visibility="private" />
    // +++
  );
}
```

To hide private threads from certain users, ensure they cannot see them with the
`"comments:private:none"` permission. For example, when creating a room, you can
create a group of users that has no access to see them. Below, `admin` users
will see _all_ threads, whereas `regular` users will not be able to see private
threads

```ts
const room = await liveblocks.createRoom("my-room-id", {
  groupAccesses: {
    admin: ["*:write"],
    // +++
    regular: ["*:write", "comments:private:none"],
    // +++
  },
});
```

### Get started with private commenting

To get started with this feature, follow our full guide on
[how to adding private commenting to your app](/docs/guides/how-to-add-private-commenting-to-your-app).
We also have a
[live example](/examples/comments-private/nextjs-comments-private) that shows
how to use it.

## A natural home for AI

A comment thread is anchored to a specific place in your app. So when someone
leaves a comment that says “make this bigger,” there’s no ambiguity about what
“this” is—and any AI working in the thread has the full conversation as context.

Add an AI assistant as a user people can `@` mention right in the composer, and
a comment becomes a way to put agents to work alongside your team.

<Figure
  caption={
    <>
      A contextual comment in our{" "}
      <Link href="/examples/collaborative-flowchart-ai/nextjs-react-flow-ai">
        Collaborative Flowchart AI
      </Link>{" "}
      example
    </>
  }
>
  <MuxVideo
    playbackId="BU5xkElYyVXGDBGksop022ym51H5vq001GvvdI1IvDEzs"
    alt="Collaborative Flowchart AI example"
    static={true}
  />
</Figure>

### How AI replying works

To enabling AI replies, you need to add an AI user to your app, the same way you
would add a human user.

```ts
const AI_USER_INFO = {
  id: "ai-123",
  info: {
    name: "AI Assistant",
    avatar: "https://example.com/ai.png",
  },
};
```

You can then listen for
[`commentCreated`](/docs/platform/webhooks#CommentCreatedEvent) webhook events,
check if the AI user was mentioned, and generate a response if they were.

```ts
if (event.type === "commentCreated") {
  // Only reply if the AI user was @-mentioned
  const mentions = getMentionsFromCommentBody(comment.body);
  if (!mentions.some((m) => m.id === AI_USER_INFO.id)) return;

  // Get the thread
  const thread = await liveblocks.getThread({ roomId, threadId });

  // Generate a response
  const { text } = await generateText({
    model: anthropic("claude-opus-4-8"),
    system: `Respond to the user's comment: ${thread}.`,
  });

  // Update the comment with the AI response
  await liveblocks.editComment({
    roomId,
    threadId,
    commentId: aiComment.id,
    data: {
      userId: AI_USER_INFO.id,
      body: markdownToCommentBody(text),
      metadata: {},
    },
  });
}
```

### Get started with AI replies

There are two ways to add AI replies to your existing Comments app:

- [AI comments](/docs/get-started/nextjs-comments-ai): Add an AI user that
  responds directly inside your comment threads. Use feeds to stream in
  responses.
- [Chat SDK bot](/docs/get-started/nextjs-chat-sdk-bot): Build a cross-platform
  bot that can reply in Comments, as well as other apps like Slack, Teams, and
  Discord.

## Haven’t added Comments yet?

We’ve expanded our get started guides with a range of new examples, so you can
drop in ready-made, contextual commenting and have it working in minutes, not
weeks.

<ButtonLink href="/docs/get-started/comments" size="lg">
  Get started with Comments
</ButtonLink>