A library for interacting with the cogment.ai framework.

Table of contents




Type aliases


Ƭ ActorImplementation<ActionT, ObservationT, RewardT>: (session: ActorSession) => Promise<void>

A function that implements the participation of this actor class in a trial.

param An ActorSession instance the actor controls to interact with a trial.

Type parameters:

Name Type Description
ActionT Message The action space type for this actor class
ObservationT Message The observation space type for this actor class
RewardT Message The reward type for this actor class

Type declaration:

▸ (session: ActorSession<ActionT, ObservationT, RewardT>): Promise<void>


Name Type
session ActorSession<ActionT, ObservationT, RewardT>

Returns: Promise<void>

Defined in: cogment/CogmentService.ts:44


Ƭ JoinTrialArguments: object

Arguments to joinTrial

Type declaration:

Name Type Description
actorClass? string The class of the actor; this must correspond with a CogmentYaml.actor_classes.
actorName? string Unique identifier for this actor connecting to the trial. Used for message passing.
trialId string The id of the trial to join.

Defined in: cogment/TrialController.ts:381


Ƭ JoinTrialReturnType: TrialJoinReply.AsObject & { config: any }

Defined in: cogment/TrialController.ts:375


Ƭ SendMessageReturnType: TrialMessageReply.AsObject

Defined in: cogment/TrialController.ts:372


Ƭ StartTrialReturnType: TrialStartReply.AsObject

Defined in: cogment/TrialController.ts:373


Ƭ VersionReturnType: object

Type declaration:

Name Type
version VersionInfo.AsObject[versionsList]

Defined in: cogment/TrialController.ts:376



createService(__namedParameters: { cogSettings: CogSettings ; grpcURL: string ; streamingTransportFactory?: grpc.TransportFactory ; unaryTransportFactory?: grpc.TransportFactory }): CogmentService

Creates a new CogmentService from a generated CogSettings. Optionally accepts transports used by gRPC clients.

example Instantiating the cogment API.

import {createService} from 'cogment';
import cogSettings from 'CogSettings';

const cogment = createService(cogSettings);


Name Type Description
__namedParameters object -
__namedParameters.cogSettings CogSettings Settings loaded from a generated CogSettings file.
__namedParameters.grpcURL string HTTP(S) url of grpc-web reverse proxy to orchestrator. Defaults to //${window.location.hostname}:8080
__namedParameters.streamingTransportFactory? grpc.TransportFactory A grpc.TransportFactory used to instantiate streaming connections to the backend. Defaults to grpc.WebsocketTransport().
__namedParameters.unaryTransportFactory? grpc.TransportFactory A grpc.TransportFactory used to make unary (non-streaming) requests to the backend. Defaults to grpc.CrossBrowserHttpTransport({withCredentials: false}).

Returns: CogmentService

Defined in: cogment/Cogment.ts:61