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.
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.
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
Normalize finalized UI messages in a server-sideonFinish callback. Do not call the ingestion API directly from the browser because that would expose the ingest secret.
occurredAt stable across retries, as shown above.
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.
Privacy and retention
Application settings apply before storage and hashing.- Content capture: Turn it off to retain counts and status without message content.
- 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.
- Allowed environments: Leave the list blank to accept all environments. If you configure a list, each request must resolve to an allowed environment.
- Conversation access: Use workspace access or restrict the application to selected BuildBetter user UUIDs.
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.