Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Event ingestion guide

Share events with a workspace API key carrying traces:write. The native reference includes request fields, examples, responses, and errors.
For persistent actor identity, runtime executions, waits, and committed state transitions, use the separate durable agent lifecycle contract. Session event versions remain unchanged.
For failures, retries, and negative feedback, see Report and investigate issues for the event conditions that create issues, grouping rules, and a working SDK example.

Batch fields

FieldContract
version1 for session events or 2 for swarm events.
sessionRequired; UUID. Reuse it for subsequent batches in the same session.
segmentRequired; coding, managed, or business. Cannot change within a session.
titleOptional; up to 4,096 UTF-8 bytes, without NUL. Whitespace is trimmed. A nonempty title updates the session title.
eventsRequired; 1–256 events.
Each event requires id, task, attempt, at, and observation. Identifiers contain 1–128 characters from a-z, A-Z, 0-9, ., _, :, @, /, and -. at is an RFC 3339 timestamp, with optional fractional seconds, normalized to UTC on ingestion. Unknown batch, event, and observation fields are rejected.
The body is limited to 262,144 bytes and each session to 10,000 events. A batch commits atomically. Retrying identical events with the same IDs is safe: existing events are not counted as inserted. Reusing an event ID in the same session with different content returns 409.

Customer users and conversations

Set each event's optional context to {userId, conversationId}. These are application identifiers, scoped to a workspace project; each accepts 1–256 UTF-8 bytes without control characters. Keep the technical session UUID separate. Reuse the same context across turns, retries, subagents and asynchronous follow-ups, including when they use different technical sessions. A conversation can include several customer users. Events without identity remain anonymous.
The TypeScript SDK accepts this context on native events and on createVercelAITrace options. For example, an application boundary can record a response and then submit feedback to an existing boolean rubric:
import { Effect } from 'effect'; import { createAgentTraceHook, recordQualityScore } from '@halfspan/sdk'; const project = process.env.HALFSPAN_PROJECT_ID!; const context = { userId: 'customer-42', conversationId: 'support-2026-42' }; const emit = createAgentTraceHook({ apiUrl: process.env.HALFSPAN_URL!, ingestToken: process.env.HALFSPAN_API_KEY!, projectId: project, }); await emit({ session: '30000000-0000-4000-8000-000000000001', segment: 'managed', task: 'support', attempt: '1', id: 'answer-1', at: new Date(), context, kind: 'agent_response', text: 'Your reviewed response', }); await Effect.runPromise(recordQualityScore({ baseUrl: process.env.HALFSPAN_URL!, apiKey: process.env.HALFSPAN_API_KEY!, project, }, { definitionId: process.env.HALFSPAN_FEEDBACK_RUBRIC_ID!, definitionVersion: 1, target: { conversationId: context.conversationId }, value: true, source: 'runtime', evaluatorId: 'support-feedback-v1', idempotencyKey: 'feedback-support-2026-42-1', expectedVersion: 0, }));
Reuse the original event timestamp, IDs and feedback idempotency key when retrying. This example submits application-reported feedback; authenticated human review records the reviewer separately. Rubrics are versioned and validate numeric bounds, boolean values, categories or text before mutation. Missing scores remain unavailable.
Open Users or Sessions in the selected project to inspect the retained evidence. The trace's Customer context links provide a propagation diagnostic. Read the same relation through GET /api/v1/observability/agent-sessions/{session}/customer-context?workspaceProject={project}. Omitted content and unpriced usage remain explicit. Conversation snapshots have an explicit cutoff; later arrivals remain in the live conversation and require a new snapshot. Source unsharing, expiry and forgetting revoke derived evidence access.
Evaluation, human-review and evaluator dashboard pages currently retain their Coming soon visibility gate. Their scoped API contracts and SDK helpers are available in source; the SDK package remains private.

Stream acknowledgements

On a stream-enabled deployment, a regular machine ingest request returns its existing database receipt. To buffer a native session or lifecycle batch, add Prefer: respond-async to POST /v1/agent-events or POST /v1/agent-lifecycle-events. HTTP 202 means that the replicated stream accepted the validated batch. The JSON body contains a receipt UUID and the Location header gives its status URL.
Poll GET /v1/agent-event-receipts/{receipt} with the same publishing identity. A completed lookup returns HTTP 200 with receipt, the batch's terminal status, and its result. A batch with conflicting event content has terminal status 409. A 404 lookup can mean the batch is still pending, the receipt has expired, or the publishing identity differs. Back off between polls. Completed receipts are retained for 30 days by the retention job. Wait for terminal success before uploading dependent artifacts or retiring a producer outbox entry. On HTTP 503 or a lost response, retry with the original event IDs and payload.

Swarm envelopes

For version 2, include swarm with a UUID id, project and environment. Optional fields are title (up to 512 UTF-8 bytes) and budget_usd_micros. Each event includes coordination with agent, producer and a nonnegative integer sequence. Keep that sequence unique within the producer's swarm. Optional links reference up to 32 predecessor events by kind, session and event. Set wait_for_end on a link when the consumer had to wait for the predecessor to finish. Agent instances can share from separate sessions while sharing the swarm UUID. Older sharers may use mission as the envelope field. Supplying both fields is rejected. The lifecycle kinds swarm_started and swarm_outcome share event identity and semantics with their original mission_started and mission_outcome spellings.
For timed operations, supply end_at in coordination. To link to a distributed trace, include both trace_id (32 hexadecimal digits) and span_id (16 hexadecimal digits). Swarm events support session observations and coordination evidence such as artifact_produced, artifact_consumed, handoff_sent, handoff_received and swarm_outcome. See SDK swarm propagation for a complete example.
Self-hosted operators can set HALFSPAN_MISSION_EVENTS_PER_MINUTE to bound swarm ingestion for each tenant. The default is 600,000 events per minute. Retain unconfirmed events in the producer outbox and retry after backpressure.
artifact_produced requires artifact, version and a lowercase SHA-256 digest. An optional object_ref carries an opaque object identifier scoped by the sharer. Its optional capture is references, redacted or omitted. Only an explicitly redacted artifact can include a text preview, limited to 2,048 UTF-8 bytes. Redact it before export. The API also scrubs common credential strings in previews during ingest.
To retain an artifact, redact its bytes before hashing, share the production event with capture: "redacted", then send POST /v1/agent-artifacts?session=SESSION_UUID&event=EVENT_ID with the same sharer credential. Send a JSON object containing capture set to "redacted" and content set to the standard base64 encoding of up to 128 KiB. The server checks the SHA-256 digest against the event and rejects recognizable credentials. A successful response includes digest and bytes. Retrying the same upload is safe. Managed content requires a configured object archive. The authenticated dashboard accepts the same request at /api/v1/observability/agent-artifacts.
GET /api/v1/observability/swarms/SWARM_UUID/artifact?session=SESSION_UUID&event=EVENT_ID returns the retained content in standard base64 with its digest and byte count. Machine readers use a key with traces:read. SDK upload and verified read example
handoff_sent, handoff_received and handoff_consumed require a correlation ID, sender and recipient. Use the optional context to identify a context manifest. Each sharer can declare its own capture policy for the handoff and attach a redacted body.

Common observations

Place one of these objects in observation:
KindFields after kind
spanspan, tool: identifiers; parent: "root", "unknown", or {"span":"parent-id"}. Omitted parent becomes "unknown".
usageinput_tokens, output_tokens: nonnegative integers; usd_micros: nonnegative integer or null (also nullable when omitted). Cost is in millionths of a US dollar.
application_logcode: identifier; severity: info, warning, or error. Optional fields include capture, body, severity_number (0–24), severity_text (up to 64 ASCII characters) and route (an instrumented route template, up to 256 characters).
user_prompt, agent_responsetext: nonblank string, up to 32,768 UTF-8 bytes, without NUL.
reasoning_summarytext: nonblank string, up to 4,096 UTF-8 bytes, without NUL.
contextkey: repository, worktree, model, harness, instructions, ci, or owner; value: identifier.
retryprevious_attempt: identifier.
tool_receiptoperation, reference: identifiers; state: pending, settled, or failed.
outcomeresult: failed, or the segment's success value below; receipt: identifier.
attempt_started, approval_waiting, compactionNo additional fields.
For application logs and swarm handoffs, capture accepts references, omitted or redacted. Only an event with capture: "redacted" can include body, a string of up to 4,096 UTF-8 bytes without NUL. Redact the message before sending it. Ingestion also scrubs recognizable credentials before committing the event. Leaving out the policy records no capture decision.
Success values are required_checks_passed for coding, customer_resolved for managed, and deliverable_accepted for business. See code attribution for the code_attribution observation.
The same batch contract is accepted at POST /api/v1/observability/agent-sessions and POST /api/v1/cli/agent-events, with traces:write. The CLI route additionally supports resharing.

OTLP ingestion

POST /v1/traces, POST /v1/logs, and POST /v1/metrics accept OTLP JSON or protobuf and optional gzip compression. Use a bearer key with traces:write. Each request is limited to 262,144 bytes before and after decompression. Successful exports return HTTP 200 with an empty export response in the request encoding. Failures return a google.rpc.Status message. A configured native gRPC listener accepts the corresponding Collector Export services with the same bearer credential.
Metric points support gauges, sums, explicit histograms, exponential histograms, and summaries. Without a supplied session ID, metrics use a stable session per series and hour. Monitoring uses trace spans when the selected period contains span data. For periods without spans, it displays exported metrics. The analytics query accepts "source":"metrics" to inspect metric data directly.
The GenAI mapper retains provider and model, operation, tool, prompt version, usage, and status. Exceptions and failed tool calls feed Issues. GenAI prompt and completion content require workspace-enabled redacted capture and a successful local redaction adapter. Unpriced spans with recognized models and token counts get a catalog estimate. Responses label the estimate and record the catalog version.
The mapping version is halfspan.otlp.v1. A resource may specify halfspan.session.id (UUID), halfspan.segment, halfspan.task.id and halfspan.attempt.id as string attributes. When a session ID is absent, the importer derives a stable session UUID from the record's trace ID. The default segment is managed; missing task and attempt IDs are unknown.
To attach OTLP records to a swarm, supply all five string resource attributes below and add the integer attribute halfspan.producer.sequence to each span or log record. Use the same source IDs and sequence on retry. A single record can produce separate tool, usage and span observations. The importer namespaces their producer IDs by observation kind to preserve the original sequence. An imported swarm record carries its source event ID or trace/span pair in coordination.source_id.
Resource attributeValue
halfspan.swarm.idSwarm UUID (older sharers can supply halfspan.mission.id instead)
halfspan.project, halfspan.environmentProject and environment identifiers
halfspan.agent.id, halfspan.producer.idRunning agent and source stream identifiers
Each span needs a nonzero 32-digit hexadecimal traceId, a nonzero 16-digit hexadecimal spanId, and startTimeUnixNano. Instrumented tool spans can supply gen_ai.tool.name. Model spans can supply both gen_ai.usage.input_tokens and gen_ai.usage.output_tokens, with an optional halfspan.cost.usd_micros. The importer preserves available end times, parent span IDs and up to 32 OTLP span links. Use swarm coordination events to record actual delegation, message delivery and artifact consumption. A corrected link identifies the replaced record. Its replacement must carry the same kind, producer and task and a higher producer sequence. Both records remain available for review.
Each log record requires timeUnixNano and a session or trace ID. Set string attributes halfspan.event.id and halfspan.log.code for a stable source event identity and a searchable code. Without an event ID, the importer hashes the record. The default code is otel.log. Severity numbers from 13 through 16 map to warning, and 17 or higher maps to error. Other values map to info. By default the importer retains the code and coarse severity and omits the body.
Set the string attribute halfspan.log.capture on a resource to choose a default capture policy or on a log record to override it. With an explicit policy, ingestion preserves the OTLP severityNumber (0–24), severityText and http.route when supplied. Supply a route template such as /reviews/{id}. For redacted, send the already-redacted text in body.stringValue. An absent or nontext body records capture: "omitted". The references and omitted policies retain metadata only.
An OTLP request can produce several ingest transactions. If a later batch fails, replay the original request to deduplicate any earlier committed batches.