Construye plugins potentes para Adverant Nexus con nuestro SDK completo
npm install @adverant-nexus/sdk
El SDK es compatible con Node.js 18+ e incluye definiciones TypeScript.
pip install adverant-nexus-sdk
El SDK de Python requiere Python 3.9 o superior.
Los plugins extienden Nexus a través del Model Context Protocol (MCP), proporcionando herramientas, recursos y prompts que los agentes de IA pueden descubrir y usar.
El Cliente Nexus proporciona acceso a los servicios centrales de la plataforma:
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']
})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()// 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 })Un plugin básico que proporciona una herramienta de saludo:
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()