Skip to main content

Package Installation

npm install @graphysdk/agents-sdk
yarn add @graphysdk/agents-sdk
pnpm add @graphysdk/agents-sdk

Peer Dependencies

The AI SDK requires @graphysdk/core for the GraphConfig type:
npm install @graphysdk/core
yarn add @graphysdk/core
pnpm add @graphysdk/core

Import

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:
{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true
  }
}

Environment Setup

First, create an API key in the Graphy console. Then store it in an environment variable:
# .env
GRAPHY_API_KEY=graphy_...
Access it in your code:
const ai = new GraphyAiSdk({
  apiKey: process.env.GRAPHY_API_KEY,
  baseUrl: 'https://agents.graphy.dev',
});
Never commit API keys to version control. Use environment variables or a secrets manager.

Verify Installation

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 }