npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xpander-sdk

v1.12.3

Published

**Xpander Open Source SDK** empowers developers to build intelligent and reliable AI Agents capable of managing complex, multi-step tasks across diverse systems and platforms. The SDK simplifies challenges like function calling, schema definition, graph e

Downloads

885

Readme

Xpander SDK

Xpander Open Source SDK empowers developers to build intelligent and reliable AI Agents capable of managing complex, multi-step tasks across diverse systems and platforms. The SDK simplifies challenges like function calling, schema definition, graph enforcement, and prompt group management.

With support for leading LLM providers such as OpenAI, Amazon Bedrock, and NVIDIA NIM, the Xpander SDK seamlessly integrates into your existing systems.

ai-agents-with-xpander

📦 Installation

Choose your preferred package manager:

npm

npm install xpander-sdk

pip

pip install xpander-sdk

🚀 Getting Started

Prerequisites

  1. Visit app.xpander.ai
  2. Retrieve your Agent Key from the Agent Settings page
  3. Install the SDK and make sure you have Node.js installed (required as the SDK runs as a Node.js app under the hood)

Quick Start Examples

import { XpanderClient } from 'xpander-sdk';
import * as dotenv from 'dotenv';

dotenv.config();

const xpanderAPIKey = process.env.XPANDER_API_KEY || '';
const xpanderAgentID = process.env.XPANDER_AGENT_ID || '';

const xpanderClient = new XpanderClient({ apiKey: xpanderAPIKey });
const agent = await xpanderClient.agents.get(xpanderAgentID);

// Get available tools for the agent
const tools = await agent.getTools();

// This is a placeholder for AI to analyze the tools and decide which to invoke
// You would typically send these tools to your AI provider (e.g., OpenAI, Anthropic)
// The AI will return a structured response indicating which tools to call
const llmResponse = await yourAIProvider.chat.completions.create({
  messages: [userMessage],
  tools: tools // The tools are formatted for the AI to understand
  // ... other AI configuration
});

// Parse LLM response automatically into tool calls
const toolsToRun = XpanderClient.extractToolCalls(llmResponse);

// Execute multiple tool calls at once
const results = await agent.runTools(toolsToRun);
const { XpanderClient } = require('xpander-sdk');
require('dotenv').config();

const xpanderAPIKey = process.env.XPANDER_API_KEY || '';
const xpanderAgentID = process.env.XPANDER_AGENT_ID || '';

const xpanderClient = new XpanderClient({ apiKey: xpanderAPIKey });
const agent = await xpanderClient.agents.get(xpanderAgentID);

// Get available tools for the agent
const tools = await agent.getTools();

// This is a placeholder for AI to analyze the tools and decide which to invoke
// You would typically send these tools to your AI provider (e.g., OpenAI, Anthropic)
// The AI will return a structured response indicating which tools to call
const llmResponse = await yourAIProvider.chat.completions.create({
  messages: [userMessage],
  tools: tools // The tools are formatted for the AI to understand
  // ... other AI configuration
});

// Parse LLM response automatically into tool calls
const toolsToRun = XpanderClient.extractToolCalls(llmResponse);

// Execute multiple tool calls at once
const results = await agent.runTools(toolsToRun);
from xpander_sdk import XpanderClient
from dotenv import load_dotenv
import os

load_dotenv()

xpanderAPIKey = os.environ.get("XPANDER_API_KEY", "")
xpanderAgentID = os.environ.get("XPANDER_AGENT_ID", "")

xpander_client = XpanderClient(api_key=xpanderAPIKey)
agent = xpander_client.agents.get(agent_id=xpanderAgentID)

# Get available tools for the agent
tools = agent.get_tools()

# This is a placeholder for AI to analyze the tools and decide which to invoke
# You would typically send these tools to your AI provider (e.g., OpenAI, Anthropic)
# The AI will return a structured response indicating which tools to call
llm_response = your_ai_provider.chat.completions.create(
    messages=[user_message],
    tools=tools  # The tools are formatted for the AI to understand
    # ... other AI configuration
)

# Parse LLM response automatically into tool calls
tools_to_run = XpanderClient.extract_tool_calls(llm_response=llm_response.model_dump())

# Execute multiple tool calls at once
results = agent.run_tools(tools_to_run)
using Xpander.Sdk;
using DotEnv.Net;

new DotEnvLoader().Load();

var xpanderAPIKey = Environment.GetEnvironmentVariable("XPANDER_API_KEY") ?? "";
var xpanderAgentID = Environment.GetEnvironmentVariable("XPANDER_AGENT_ID") ?? "";

var xpanderClient = new XpanderClient(xpanderAPIKey);
var agent = await xpanderClient.Agents.GetAsync(xpanderAgentID);

// Get available tools for the agent
var tools = await agent.GetToolsAsync();

// This is a placeholder for AI to analyze the tools and decide which to invoke
// You would typically send these tools to your AI provider (e.g., OpenAI, Anthropic)
// The AI will return a structured response indicating which tools to call
var llmResponse = await yourAIProvider.chat.completions.create({
  messages: [userMessage],
  tools: tools // The tools are formatted for the AI to understand
  // ... other AI configuration
});

// Parse LLM response automatically into tool calls
var toolsToRun = XpanderClient.ExtractToolCalls(llmResponse);

// Execute multiple tool calls at once
var results = await agent.RunToolsAsync(toolsToRun);

📚 Documentation

For comprehensive documentation, tutorials, and API references, visit:

⚙️ Technical Note

The library is compiled using Projen and runs as a Node.js application under the hood. Ensure you have Node.js installed for optimal performance.

🤝 Contributing

We welcome contributions to improve the SDK. Please see our CONTRIBUTING.md for guidelines on how to submit improvements and bug fixes.