Home/Tools/@tpmjs/tools-sprites-policy-set

spritesPolicySetTool

@tpmjs/tools-sprites-policy-set

Update the network policy for a sprite to control outbound network access with DNS-based filtering. Use 'allow' mode to block all traffic except listed domains, or 'deny' mode to allow all traffic except listed domains.

Official
sandbox
v0.1.3
MIT
⚠️

This tool is currently broken

Execution Failed
Runtime error with test parameters
Mode must be 'allow' or 'deny'

Last checked: 1/16/2026, 3:45:35 AM

Interactive Playground

Test @tpmjs/tools-sprites-policy-set (spritesPolicySetTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-sprites-policy-set
pnpm add @tpmjs/tools-sprites-policy-set
yarn add @tpmjs/tools-sprites-policy-set
bun add @tpmjs/tools-sprites-policy-set
deno add npm:@tpmjs/tools-sprites-policy-set

2. Import the tool

import { spritesPolicySetTool } from '@tpmjs/tools-sprites-policy-set';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { spritesPolicySetTool } from '@tpmjs/tools-sprites-policy-set';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { spritesPolicySetTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Parameters

Available configuration options

Auto-extracted
name
Required
Type: string

Name of the sprite to update policy for

mode
Required
Type: string

Policy mode - 'allow' blocks all except listed domains, 'deny' allows all except listed domains

domains
Required
Type: array

List of domains to allow or deny based on mode

Schema extracted: 1/16/2026, 3:45:34 AM

README

@tpmjs/sprites-policy-set

Update the network policy for a sprite to control outbound network access.

Installation

npm install @tpmjs/sprites-policy-set

Requirements

Usage

import { spritesPolicySetTool } from '@tpmjs/sprites-policy-set';

// Allow only specific domains (block everything else)
const result = await spritesPolicySetTool.execute({
  name: 'my-sandbox',
  mode: 'allow',
  domains: ['api.github.com', 'registry.npmjs.org', 'pypi.org']
});

console.log(result);
// {
//   policy: {
//     mode: 'allow',
//     domains: ['api.github.com', 'registry.npmjs.org', 'pypi.org']
//   },
//   applied: true
// }

// Block specific domains (allow everything else)
const blockResult = await spritesPolicySetTool.execute({
  name: 'my-sandbox',
  mode: 'deny',
  domains: ['malicious-site.com', 'tracking.example.com']
});

Input Parameters

ParameterTypeRequiredDescription
namestringYesName of the sprite to update policy for
mode'allow' | 'deny'YesPolicy mode
domainsstring[]YesList of domains to allow or deny based on mode

Output

FieldTypeDescription
policyNetworkPolicyThe applied network policy
appliedbooleanWhether the policy was successfully applied

NetworkPolicy Object

FieldTypeDescription
mode'allow' | 'deny'Policy mode
domainsstring[]List of domains affected by the policy
rulesobject[]?Optional additional filtering rules

Policy Modes

  • allow mode: Blocks all outbound traffic EXCEPT to listed domains

    • Use for maximum security when you know exactly which APIs are needed
  • deny mode: Allows all outbound traffic EXCEPT to listed domains

    • Use to block known-bad domains while allowing general access

Use Cases

  • Restrict sprite to only access required APIs
  • Block access to potentially harmful domains
  • Implement defense-in-depth security
  • Ensure code can only communicate with trusted services

Error Handling

The tool throws errors in these cases:

  • SPRITES_TOKEN environment variable is not set
  • Invalid mode (must be 'allow' or 'deny')
  • Domains must be an array
  • Sprite not found (HTTP 404)
  • Invalid or expired API token (HTTP 401)
  • Network timeout (30 second limit)
  • API errors with descriptive messages

License

MIT

Statistics

Downloads/month

322

GitHub Stars

0

Quality Score

84%

Bundle Size

NPM Keywords

tpmjs
sprites
sandbox
network
policy
ai

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai
spritesPolicySetTool | TPMJS | TPMJS