JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q33734F
  • License ISC

A library for creating and deploying gaming agents at scale

Package Exports

  • arc-agents

Readme

Stargazers Unlicense License LinkedIn


Logo

arc-agents

Bringing decision-making agents to every game
Explore the docs »

Getting Started

This package is used for imitation learning and reinforcement learning in games.

Installation

To start using the package, you can install it as follows:

npm install arc-agents

Basic Setup

To get started using agents on the platform, you first need to register the agent. Only organization admins have this ability, and you will need to provide an api key:

const { Registry } =  require("arc-agents")

Registry.setApiKey("admin-api-key")

In order to use an agent, you need to set the gameId and apiKey

const { BaseAgent } =  require("arc-agents")

BaseAgent.setGameId("game-id")
BaseAgent.setApiKey("training-api-key")

Registration

Before creating an agent, we must register its architecture. Admins can also do this via the (dashboard)[https://arcagents.ai]

const registry = new Registry("game-id")

const modelType = "simple"
const architectureId = "my-first-model"
const numberOfStates = 10
const possibleActions = { direction: ["up", "down", "idle"] }

await registry.register(modelType, architectureId, numberOfStates, [], possibleActions)

Create an Agent

Once you've registered a model architecture, you can use the architectureId to create a model for any user:

const { FrequencyTable } =  require("arc-agents")

const agent = new ImitationLearningAgent(architectureId, userId, slotIdx)
await agent.initialize()

Take an Action

In order to take an action in the game, call the selectAction function, where the input is a 2D array.

const action = agent.selectAction(state)

Collect Data

To collect data, call the collect function. At a minimum, the data object must have the current state and the action selected (as a one-hot encoded vector). Additionally, you can provide more info which can be useful for reward shaping.

agent.collect({ state, action, info })