Skip to main content
The Caliper client builds and sends learning events. Available routes, payload transformation, response fields, validation, and historical queries depend on the selected platform. Start with Event Contracts.

Platform capabilities

The default platform is BEYOND_AI. LEARNWITH_AI applies a destination-specific event transformation before submission. Changing only the base URL does not prove that the selected paths or payload schema match another API. The Partner Events API at /events/1.0 has a separate contract.

Installation

Send an activity

Run credentialed client code on a trusted backend. These examples explicitly select the legacy contract and supply synthetic identities. Replace them with assigned user, course, and app values.
The numeric XP value is supplied by the producer. It is not calculated from elapsed time. See Timeback activity and time events for metric fields and SDK events for SDK-specific construction.

Build once, retry the same event

sendActivity and sendTimeSpent create a fresh event ID and timestamp when you omit them. Calling a convenience method again without preserving those fields can create a distinct event. For durable delivery, build the event once using createActivityEvent or createTimeSpentEvent, retain the event payload, and send it with client.events.send(sensor, events). The Python factories are create_activity_event and create_time_spent_event. Preserve the original event and metric collection identities across transport retries. Do not edit a submitted payload and reuse its event ID as a replacement operation. The legacy event store retains the first content for an external ID. Use your integration’s correction procedure.

Methods

Validation, queries, and polling require a configured path for that operation. The send result’s jobId/job_id can be absent. The batch API’s compatibility value "0" is not a job to poll.

Job monitoring

For a legacy job, polling stops when queue state is completed, and raises for failed or timeout. It does not inspect every semantic error in the worker result. Inspect returnValue in TypeScript or return_value in Python, including any error or partial-result information. A completed queue job does not prove that all webhook subscribers or downstream analytics succeeded. Verify the expected persisted result separately.

Historical queries

Legacy event listing supports limit, offset, sensor, actor ID, actor email, start date, and end date. For example:
The legacy query store is not a complete search of events sent through other ingestion systems. Check the event destination before treating an empty query as a missing send.

Generic and question events

events.send accepts event objects, but the server still enforces its selected schema. Support for an event in one platform does not guarantee support in another, and schema acceptance does not itself award XP. The client also provides question-seen, question-answered, and question-graded factories. Their destination-specific shapes should be checked against the assigned contract before use. Use the Partner Event Reference or Platform Event Reference for those APIs.

Error handling

The current package does not export an ApiError class. Handle failures using the errors provided by your installed client version. A portable error boundary can inspect error instanceof Error for a message; avoid logging access tokens or raw student event payloads. Correct validation and authorization failures before retrying. For ambiguous network or server failures, retain event identity and use bounded retries. Confirm the resulting activity through the destination’s supported read APIs.