***

title: Ghost (QA Testing)
subtitle: API-orchestrated automated test session control
slug: npm/ghost
---------------

Ghost functionality is provided via API-backed thunks.

## Start Session

```typescript
import { createSDKStore, startGhostThunk } from '@forbocai/core';

const store = createSDKStore();

const started = await store.dispatch(startGhostThunk({
  testSuite: 'exploration',
  duration: 300,
  apiUrl: 'https://api.forboc.ai',
  apiKey: process.env.FORBOCAI_API_KEY
})).unwrap();

console.log(started.sessionId, started.status);
```

## Status, Results, Stop, History

```typescript
import {
  getGhostStatusThunk,
  getGhostResultsThunk,
  stopGhostThunk,
  getGhostHistoryThunk
} from '@forbocai/core';

const status = await store.dispatch(getGhostStatusThunk({
  sessionId: 'ghost_session_id',
  apiUrl: 'https://api.forboc.ai',
  apiKey: process.env.FORBOCAI_API_KEY
})).unwrap();

const results = await store.dispatch(getGhostResultsThunk({
  sessionId: 'ghost_session_id',
  apiUrl: 'https://api.forboc.ai',
  apiKey: process.env.FORBOCAI_API_KEY
})).unwrap();

await store.dispatch(stopGhostThunk({
  sessionId: 'ghost_session_id',
  apiUrl: 'https://api.forboc.ai',
  apiKey: process.env.FORBOCAI_API_KEY
})).unwrap();

const history = await store.dispatch(getGhostHistoryThunk({
  limit: 10,
  apiUrl: 'https://api.forboc.ai',
  apiKey: process.env.FORBOCAI_API_KEY
})).unwrap();

console.log(status.status, results.totalTests, history.length);
```

## CLI

```bash
npx forbocai ghost run exploration
npx forbocai ghost status <sessionId>
npx forbocai ghost results <sessionId>
npx forbocai ghost stop <sessionId>
npx forbocai ghost history
```
