On this page
Sommatic Docs
Open portal

Services

Service classes of the React SDK - one per API resource, all built on BaseApi - and the stream classes that follow runs and task assignments over server-sent events.

View as Markdown
Open in

A service is a small class that knows the path of one API resource. You create it, call a method, and get back the API’s envelope. Services are cheap: create one where you need it instead of sharing a global instance.

The methods every service has

All services extend BaseApi:

MethodRequestUse
getByParameters(params)GET <resource>/<queryselector>?…Reads. params.queryselector is required; the rest goes to the query string.
create(payload)POST <resource>/Creates a record from the JSON body.
update(payload)PATCH <resource>/Updates the record whose id is in the body.
delete(payload)DELETE <resource>/Deletes the record whose id is in the body.
JavaScript
import { WorkflowOrchestrationFlowDefinitionService } from '@sommatic/react-sdk';

const definitions = new WorkflowOrchestrationFlowDefinitionService({ apiKey: token });

const page = await definitions.getByParameters({
  queryselector: 'organization-id',
  search: organizationId,
  exclude_status: 'deleted',
  page: 1,
  pageSize: 25,
});

await definitions.update({ id: 'wf-flow-definition-…', description: 'Routes inbound requests' });

Read selectors, pagination and the response envelope are the same as in the API: see Conventions.

Services by area

Each service maps to one group of the API reference.

AreaServicesExtra methods
Workflow designWorkflowOrchestrationFlowDefinitionService, WorkflowOrchestrationFlowVersionService, WorkflowOrchestrationTriggerService, WorkflowOrchestrationOperatorService, WorkflowOrchestrationDeploymentServicepublish({ id }) on flow definitions
TriggersWorkflowOrchestrationIngressBindingService
ExecutionWorkflowOrchestrationExecutionService, WorkflowOrchestrationFlowInstanceService, WorkflowOrchestrationFlowInstanceResultService, WorkflowOrchestrationNodeExecutionServiceexecuteWorkflow(payload)
Cognitive infrastructureCognitiveInfrastructureLLMProviderService, CognitiveInfrastructurePromptTemplateService, CognitiveInfrastructureKnowledgeResourceService, CognitiveInfrastructureKnowledgeResourceBindingService, CognitiveInfrastructureAgentProfileService, CognitiveInfrastructureCognitiveToolService, CognitiveInfrastructureMemoryStoreService, CognitiveInfrastructureDatasourceServicepublish({ id }) on knowledge resources
Human in the loopWorkManagementTaskServicetransition({ id, transition_name, payload })
ProjectsProjectManagementService
CredentialsPlatformInfrastructureCredentialService
Git SyncPlatformInfrastructureGitRepositoryService, PlatformInfrastructureGitSyncServicetest, tree, package on repositories; preview, apply, export, setLink on sync
ConversationsConversationExecutionServiceexecute(envelope), executeStream(envelope, callbacks)

Every service is exported by name and also through the services map, so services.WorkManagementTaskService and the named import are the same class. Shorter aliases exist for a few of them (LlmProviderService, WorkflowFlowDefinitionService, WorkflowFlowVersionService, WorkflowTriggerService, WorkflowOperatorService).

Collection helpers

The helpers take a service class and do the instantiation for you, returning null instead of throwing:

JavaScript
import { fetchEntityCollection, fetchMultipleEntities, ProjectManagementService } from '@sommatic/react-sdk';

const projects = await fetchEntityCollection({
  service: ProjectManagementService,
  payload: { queryselector: 'organization-id', search: organizationId, page: 1, pageSize: 10 },
  apiKey: token,
});

fetchEntityCollection defaults to queryselector: 'all', exclude_status: 'deleted', page: 1 and pageSize: 10. fetchMultipleEntities([...]) runs several of those requests in parallel and returns the answers in order. createEntityRecord, updateEntityRecord and deleteEntityRecord wrap the write methods the same way.

Streams

Two classes follow server-sent events with the browser’s EventSource and reconnect on their own (every 3 seconds by default):

ClassStream
WorkflowOrchestrationExecutionStreamServiceGET /workflow-orchestration/execution/stream: progress of runs, node by node.
WorkManagementTaskStreamServiceGET /work-management/task/stream: task events for a person.
JavaScript
import { WorkManagementTaskStreamService } from '@sommatic/react-sdk';

const stream = new WorkManagementTaskStreamService();
stream.setParams({ user_identity: userIdentity });
stream.on('task-assigned', (data) => console.log(data.task));
stream.connect();

// later
stream.disconnect();

on(event, callback) parses each message as JSON and supports several listeners for the same event; off(event) removes them. Both classes extend BaseStream.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs