Plugin SDK

종합 SDK로 Adverant Nexus를 위한 강력한 플러그인을 구축하세요

설치

TypeScript/JavaScript

npm install @adverant-nexus/sdk

SDK는 Node.js 18+와 호환되며 TypeScript 정의를 포함합니다.

Python

pip install adverant-nexus-sdk

Python SDK는 Python 3.9 이상이 필요합니다.

핵심 개념

플러그인 아키텍처

플러그인은 Model Context Protocol (MCP)을 통해 Nexus를 확장하며, AI 에이전트가 검색하고 사용할 수 있는 도구, 리소스, 프롬프트를 제공합니다.

  • 도구: 작업을 수행하는 함수 (예: 데이터 분석, 이메일 전송)
  • 리소스: 플러그인이 노출하는 데이터 소스 (예: 데이터베이스, API)
  • 프롬프트: 일반적인 워크플로를 위한 사전 구성된 프롬프트

Nexus 클라이언트

Nexus 클라이언트는 핵심 플랫폼 서비스에 대한 접근을 제공합니다:

import { NexusClient } from '@adverant-nexus/sdk'

const nexus = new NexusClient({
  apiKey: process.env.BRAIN_API_KEY
})

// Access GraphRAG memory
await nexus.graphrag.storeMemory({
  content: 'Important information',
  tags: ['customer', 'analysis']
})

// Orchestrate sub-agents
await nexus.agents.orchestrate({
  task: 'Analyze customer feedback',
  agents: ['sentiment', 'summarization']
})

API 레퍼런스

플러그인 서버 생성

import { NexusPluginServer, Tool } from '@adverant-nexus/sdk/server'

const server = new NexusPluginServer({
  name: 'my-plugin',
  version: '1.0.0',
  description: 'My awesome plugin'
})

// Define a tool
server.tool(new Tool({
  name: 'analyze_data',
  description: 'Analyzes data and returns insights',
  inputSchema: {
    type: 'object',
    properties: {
      data: { type: 'array' },
      options: { type: 'object' }
    },
    required: ['data']
  },
  execute: async (input) => {
    // Your implementation
    return { insights: [...] }
  }
}))

// Start the server
await server.start()

Nexus 서비스 접근

// GraphRAG Memory
await nexus.graphrag.storeMemory({ content, tags })
await nexus.graphrag.query({ query, limit: 10 })

// Agent Orchestration
await nexus.agents.orchestrate({ task, agents })

// Learning System
await nexus.learning.recordPattern({ pattern, feedback })

예제

간단한 플러그인 예제

인사 도구를 제공하는 기본 플러그인:

import { NexusPluginServer, Tool } from '@adverant-nexus/sdk/server'

const server = new NexusPluginServer({
  name: 'greeter',
  version: '1.0.0'
})

server.tool(new Tool({
  name: 'greet',
  description: 'Greets a user by name',
  inputSchema: {
    type: 'object',
    properties: {
      name: { type: 'string' }
    },
    required: ['name']
  },
  execute: async ({ name }) => {
    return { message: `Hello, ${name}!` }
  }
}))

await server.start()

다음 단계