> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

## Package Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @graphysdk/agents-sdk
  ```

  ```bash yarn theme={null}
  yarn add @graphysdk/agents-sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @graphysdk/agents-sdk
  ```
</CodeGroup>

## Peer Dependencies

The AI SDK requires `@graphysdk/core` for the `GraphConfig` type:

<CodeGroup>
  ```bash npm theme={null}
  npm install @graphysdk/core
  ```

  ```bash yarn theme={null}
  yarn add @graphysdk/core
  ```

  ```bash pnpm theme={null}
  pnpm add @graphysdk/core
  ```
</CodeGroup>

## Import

```typescript theme={null}
import { GraphyAiSdk } from '@graphysdk/agents-sdk';
import type { GraphConfig } from '@graphysdk/core';
```

## TypeScript Configuration

The SDK is written in TypeScript and ships with type definitions. No additional `@types` packages are needed.

Minimum TypeScript version: 4.7+

Recommended `tsconfig.json` settings:

```json theme={null}
{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true
  }
}
```

## Environment Setup

First, [create an API key in the Graphy console](/agents/api-keys). Then store it in an environment variable:

```bash theme={null}
# .env
GRAPHY_API_KEY=graphy_...
```

Access it in your code:

```typescript theme={null}
const ai = new GraphyAiSdk({
  apiKey: process.env.GRAPHY_API_KEY,
  baseUrl: 'https://agents.graphy.dev',
});
```

<Warning>Never commit API keys to version control. Use environment variables or a secrets manager.</Warning>

## Verify Installation

```typescript theme={null}
import { GraphyAiSdk } from '@graphysdk/agents-sdk';

const ai = new GraphyAiSdk({
  apiKey: process.env.GRAPHY_API_KEY,
  baseUrl: 'https://agents.graphy.dev',
});

// Check connectivity
const health = await ai.ping();
console.log(health); // { ok: true, latency: 45 }
```
