Set up an application
1
Open Agent Chats
In BuildBetter, open Library → Agent Chats, then select Set up Agent Chats. Ask a workspace administrator if Agent Chats is not available in your workspace.
2
Create an application
Give the application a name and a stable key. Use one application for each agent or product whose conversations you want to filter separately. This registers your existing agent. It does not build a new agent. The setup action also creates its first ingest credential.
3
Configure privacy
Set content capture, participant type, allowed environments, retention, redaction, and conversation access before you send production data.
4
Create an ingest credential
Copy the secret when BuildBetter shows it. The secret is shown once. Store it in a server-side secret manager and do not put it in browser code. Use Manage ingest credentials to create or revoke credentials later. These credentials are upload secrets, not billing credits.
Authentication
Send the ingest secret inX-BuildBetter-Agent-Key. This is an ingestion-only credential. It is different from your organization API key.
agentKey. BuildBetter validates that the key and secret belong to the same application.
Send a conversation
Send events to:pending means BuildBetter accepted the data and queued signal extraction. It does not mean extraction is complete.
Session and event identity
BuildBetter usesagentKey plus externalSessionId as the stable session identity. Continue to send new events with the same values while the conversation is active.
Each event needs:
externalEventId: a stable ID from your system.sequence: the event’s position in the session. Sequence numbers must be unique.revision: start at1. Increase it when you correct an existing event.occurredAt: an ISO 8601 timestamp.type: such asuser_message,assistant_message, orfeedback.
sequence to order them. Open sessions wait at sequence gaps. Ended or abandoned sessions process through permanent gaps.
Finalize a session
Sendstatus: "ended" after the conversation ends. You can send only the final lifecycle update if the earlier events already exist, but every ingest request must contain at least one event. A common pattern is to include the last new event with the terminal status.
Use status: "abandoned" when the user leaves before the agent reaches an outcome.
Send message feedback
Send feedback as its own event.targetEventExternalId must point to an earlier assistant_message in the same session.
positive or negative. A feedback event can contain a rating, labels, a comment, or any combination of them. BuildBetter creates explicit-feedback Signals deterministically and does not use model credits for that conversion. The normal qualitative analysis of finalized assistant responses uses response credits.
In Signals, use the Agent Chat source filters to separate explicit_feedback from qualitative_inference and to filter positive or negative ratings.
Vercel AI SDK
See the Node SDK and Vercel wrapper preview for the planned SDK integration. The package is not published to npm. For an HTTP integration, persist finalized messages in your server-side completion handler. Send only visible user and assistant text through the conversation endpoint above. Include only text parts, not reasoning, files, system prompts, or tool inputs and outputs. Assign each event its sequence and timestamp when you first persist it. Keep those values stable when you filter hidden content or send only new messages. Do not recalculate sequences from the current batch index. Check the HTTP response status. If delivery fails, retain the event data for a retry. Do not expose the ingest secret in browser code. One request accepts at most 500 events and 2 MiB. One event accepts at most 256 KiB.Context and filters
Set context at the session level when it applies to the whole chat. An event can also supply context to override the session defaults.
These fields make Agent Chats filterable by agent, product area, surface, environment, and related object.
Participant identity
Use a stableexternalId for each participant. If you send displayName, username, or email, externalId is required. You can also send a BuildBetter personId UUID when you already know the canonical Person.
Set boundary to:
externalfor a customer, prospect, or other product user.internalfor a team member.
personId takes precedence. Unknown or cross-workspace Person UUIDs are rejected. This endpoint does not create or modify people.
companyExternalId stores your company’s external ID on the participant. It does not create or link a canonical Company record. Participant properties store up to 50 custom JSON values. See the identity and properties reference for limits and SDK field mappings.
ownerUserId controls access, not customer identity. Use an active BuildBetter user UUID from the destination workspace for owner-only chats. If omitted, the application’s access policy applies. Workspace access is the default. Enabling Agent Chats does not connect another workspace’s data.
Privacy and retention
Application settings apply before storage and hashing.- Status: Active accepts uploads. Disabled stops new uploads without deleting stored conversations.
- Content capture: Turn it off to retain counts and status without message content. On the next ingest for a session, stored content, participants, jobs, and Signals for that session are permanently deleted.
- Redacted field names: Remove matching keys from message payloads, feedback, model metadata, usage, traces, context, and participant identity fields.
- Redacted text patterns: Replace exact sensitive text before storage.
- Retention: Set a value from 1 through 3650 days, or leave it blank for no application-specific limit. Reducing retention can permanently delete older conversations.
- Allowed environments: Leave the list blank to accept all environments. If you configure a list, each request must resolve to an allowed
context.environment. This does not select a destination workspace. - Conversation access: Use workspace access or restrict the application to selected BuildBetter user UUIDs. Reducing access also restricts existing chats and Signals. A later change back to workspace access does not restore historical access.
Billing
BuildBetter metersagent_response_processed units. One visible finalized assistant response is one response unit. Appending a new response adds only the new unit. A successful idempotent retry does not add another unit.
Explicit positive or negative feedback creates its explicit-feedback Signal without model credits. The session can still use credits when BuildBetter runs normal qualitative analysis on finalized assistant responses.
Coding-agent sessions and Projects through MCP
The MCP Agent Session tools are for uploaded coding-agent session artifacts, such as Codex or Claude Code sessions. They are separate from the Agent Chats ingestion endpoint above. To create a Projects V2 project and attach an uploaded coding-agent session:- Call
create-projectand keep the returned projectpublicId. - Call
upload-agent-sessionwith either normalized events or supported native JSONL. - Call
associate-agent-sessionwithresourceType: "project", the projectpublicId, and the uploaded session ID. - Call
get-projectorlist-associated-agent-sessionsto verify the association.
Troubleshooting
If a retry returns a high
deduplicatedEventCount, the API is working as intended. If processingStatus is billing_blocked, add credits or adjust the relevant quota. If it is capture_disabled, enable content capture in the application settings before you send more content.