Prerequisite: Please install Node.js (version 19 or higher) before proceeding.

AVM Software Development Kit

The AVM (Agents Virtual Machine) SDK provides tools and libraries to integrate AVM’s distributed, high-performance code execution environment into your AI agents and applications. This SDK includes:

  • avm-vercel-ai: A Vercel AI SDK tool for running Python scripts via the AVM API.
  • avm-mcp: A Model Context Protocol (MCP) server implementation for integrating with MCP-compatible clients like Claude Desktop, Claude Code, and Cursor.

avm-vercel-ai

The @avm-ai/avm-vercel-ai package allows you to execute arbitrary Python scripts through AVM’s API from within the Vercel AI SDK.

Installation

Install the package:

npm install @avm-ai/avm-vercel-ai

Configuration

Create a .env file in your project root:

AVM_API_KEY=your-api-key-here

Usage

import { runPythonTool } from "@avm-ai/avm-vercel-ai";
import dotenv from "dotenv";
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

dotenv.config();

(async () => {
  const apiKey = process.env.AVM_API_KEY;
  if (!apiKey) {
    console.error("AVM_API_KEY environment variable is not set.");
    process.exit(1);
  }

  const tool = runPythonTool();

  const { text } = await generateText({
    model: openai("gpt-4o"),
    prompt:
      "Create a random noise signal of 50 datapoints, output the signal in a markdown table",
    tools: {
      runPython: tool,
    },
    maxSteps: 10,
  });

  console.log(text);
})();

Model Context Protocol (MCP) Server

The @avm-ai/avm-mcp package provides a MCP server that wraps AVM’s Code Interpreter API, exposing an execute_code tool for MCP-compatible clients.

What is MCP?

Model Context Protocol (MCP) is an open standard that standardizes how applications provide context to LLMs via a JSON-RPC-based client-server protocol. MCP servers expose tools and data sources to LLMs, allowing models to execute code or fetch context dynamically.

Installation

Install the package as a dev dependency (or globally):

npm install -D @avm-ai/avm-mcp

Running the MCP Server

Start the MCP server directly using npx:

npx @avm-ai/avm-mcp

Configuration with an MCP Client

Configure your MCP client (e.g., Claude Desktop, Claude Code, or Cursor) to use the AVM server:

{
  "mcpServers": {
    "avm-server": {
      "command": "npx",
      "args": ["@avm-ai/avm-mcp"],
      "env": {
        "AVM_API_KEY": "your-api-key"
      }
    }
  }
}

The execute_code tool will be available to your LLM, enabling secure execution of Python code via AVM.

Repositories