Skip to main content

Overview

Agent comments let your AI agents participate in collaboration the same way humans do: by leaving comments and findings anchored to a document. Instead of building a separate UI for agent output, your agent calls the same REST APIs that power the Comments feature, and the findings render in the standard Velt comments experience. Any agent that can make an HTTP request can do this: a custom agent you create with the Review Agents API, or an external agent running in your own framework (LangChain, CrewAI, a cron job, etc.).

How it works

  1. Your agent runs and produces a finding (a spelling error, an accessibility issue, a code-review note, etc.).
  2. Your agent calls the Add Comment Annotations API with an agent block attached to the root comment.
  3. The finding renders in Velt as a suggestion with Accept and Reject buttons that humans can review.
  4. Your app reacts to the outcome: read agent comments back with the Get Comment Annotations API, or subscribe to the suggestionAccepted / suggestionRejected events in your frontend.

Properties

  • An agent comment is a regular comment annotation with an agent block attached to its root comment. There is no separate agent-comments API or data store. You add, read, update, and delete agent comments with the same Comment Annotations and Comments REST APIs.
  • When you attach an agent block to the root comment (commentData[0]), the server stamps sourceType: "agent" on both that comment and the annotation, and generates the annotation-level agent block. When you attach it to a reply instead, only that comment is marked as agent-authored; the annotation root stays a normal comment.
  • Set the annotation type to "suggestion" so the finding is classified as an agent suggestion and renders with Accept / Reject buttons instead of as a regular comment.
  • Agent comments support two origins: velt (a built-in agent like spell-check, or a custom agent you create with the Review Agents API; the agentId is verified server-side) and external (an agent running in your own framework, where the agentName you supply is the source of truth).
  • When a reviewer accepts or rejects a finding, the outcome is emitted on the comment element as the suggestionAccepted / suggestionRejected events, so you can apply the change to your own data or trigger follow-up logic.

APIs

Backend APIs

Add Agent Comments

  • Add an agent comment using the Add Comment Annotations REST API. Attach an agent block to the root comment (commentData[0]) and set the annotation type to "suggestion". Learn more
  • See The agent object below for all the fields you can send.
The most common path is an agent running in your own framework. Use agentSource: "external" and supply your own agentName:
For a built-in agent or a custom agent created with the Review Agents API, use agentSource: "velt" and pass its agentId instead. The agent’s name is resolved server-side.

Reply as an Agent

  • Add an agent-authored reply to an existing comment annotation using the Add Comments REST API with an agent block on the comment. Learn more
  • Annotation-level fields such as type are set when the annotation is created. They are not accepted on this endpoint.

Get Agent Comments

  • Get agent comments using the Get Comment Annotations REST API with agent-specific filters. Learn more
  • Only one agent filter may be supplied per request.
cURL
  • Agent annotations in the response carry type: "suggestion" and sourceType: "agent" at the annotation root, an annotation-root agent block, and an agent block on each agent-authored comment (comments[].agent).
  • To retrieve individual comments within a specific annotation, use the Get Comments REST API. Learn more

Update Agent Comments

  • Update annotation-level fields (status, assignee, location, etc.) using the Update Comment Annotations REST API. Learn more
  • Update the content of individual comments within an annotation using the Update Comments REST API. Learn more

Delete Agent Comments

  • Delete entire agent comment threads using the Delete Comment Annotations REST API. Filter by annotationIds or userIds (e.g. your agent’s user ID), or use the combinable agent filters — agentId, agentSuggestions, and agentUrls — to delete e.g. one agent’s still-pending suggestions for specific pages. Learn more
  • Delete individual comments within a thread using the Delete Comments REST API. Learn more

Frontend APIs

Handle Accept / Reject Events

Because agent findings render with Accept and Reject buttons on the comment dialog, the outcome is emitted on the comment element. Subscribe to the suggestionAccepted and suggestionRejected events to apply the change to your own data or trigger follow-up logic. The SDK records the outcome and persists the suggestion. Applying the change is your code’s job.
For the full suggestion lifecycle (statuses, applying newValue, and the other suggestion-stream events), see the Suggestions guide.

The agent object

Attach an agent object to the root comment (commentData[0]) when adding an agent comment, or to any comment when replying as an agent. It is discriminated on agentSource:

The reason object

The reason object carries the finding’s details. Here’s each field with a description and an example value.
Don’t conflate the two “fix” fields: suggestion is prose meant for a human to read in the comment, while suggestedFix is the actual replacement value your code applies. In the color-contrast example above, suggestion explains the change (“Darken the button background to at least #1A1A1A.”) while suggestedFix is just the value itself ("#1A1A1A").
Putting it together, a fully-populated reason looks like:
Only the first three (title, description, severity) are required. Everything else is optional, and any extra custom fields you add beyond this list are preserved by the server.