Skip to main content

Python SDK for building NPC Protocol servers

Project description

npc-protocol

Python SDK for building NPC Protocol servers.

Stop selling APIs. Wrap yourself into an NPC and let it earn for you while you sleep.


What is NPC Protocol?

NPC Protocol is an open standard for packaging domain knowledge as a "black box" agent service that AI agents can delegate to — in natural language, with persistent memory and explicit safety contracts. Built on top of MCP.

Your coworker became a skill. Your ex became a skill. Now it's your turn.

Install

pip install npc-protocol

Quick Start

from npc import NPCServer, NPCCard, NPCContext
from npc.response import GateLevel

card = NPCCard(
    name="DNS Manager",
    domain="DNS record management",
    confirmation_gates=[
        {"id": "delete_zone", "level": "destructive", "description": "Deleting a DNS zone"}
    ],
)

npc = NPCServer(card=card)

@npc.instruction_handler
async def handle(instruction: str, session_id: str, ctx: NPCContext):
    if "delete" in instruction.lower():
        return ctx.require_confirmation(
            gate_id="delete_zone",
            gate_level=GateLevel.DESTRUCTIVE,
            prompt="This will permanently delete the zone and all its records.",
            protected_resources=[
                {"type": "dns_zone", "name": "example.com", "risk": "All DNS records deleted"}
            ],
        )
    return ctx.complete(result="DNS record updated")

npc.run()

Links

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npc_protocol-0.2.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

npc_protocol-0.2.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file npc_protocol-0.2.0.tar.gz.

File metadata

  • Download URL: npc_protocol-0.2.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for npc_protocol-0.2.0.tar.gz
Algorithm Hash digest
SHA256 82e638708c86cabf13c693c85275ffbbd512b33442592f0bca45b8ecdcd7c68c
MD5 fae300d5253489f3c638287340f491a8
BLAKE2b-256 54d628c5c46da7adefafe7c2cd060772463328769d5063711238f27be900c5a2

See more details on using hashes here.

File details

Details for the file npc_protocol-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: npc_protocol-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for npc_protocol-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf25e02c26191e7bd799214239b0a571d587b83f1bbeaf5d102cc55d31eeb43e
MD5 7fed05f7e96bb137a30bff7d03d142c4
BLAKE2b-256 85e3035b588064ef8ea4a1253541b6621cf3abd94d765c09e7fb45ad4b1a94e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page