The python library for research and development in NLP, multimodal LLMs, Agents, ML, Knowledge Graphs, and more.
# Add to your Claude Code skills
git clone https://github.com/NPC-Worldwide/npcpyLast scanned: 11/29/2026
{
"issues": [
{
"file": "README.md",
"line": 1351,
"type": "remote-install",
"message": "Install command (remote install script piped to a shell — review the source before running): \"curl -fsSL https://ollama.com/install.sh | sh\"",
"severity": "low"
}
],
"status": "PASSED",
"scannedAt": "2026-11-29T12:49:30.843Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}npcpy is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by NPC-Worldwide. The python library for research and development in NLP, multimodal LLMs, Agents, ML, Knowledge Graphs, and more. It has 1,532 GitHub stars.
Yes. npcpy passed AgentsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/NPC-Worldwide/npcpy" and add it to your Claude Code skills directory (see the Installation section above).
npcpy is primarily written in Python. It is open-source under NPC-Worldwide on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh npcpy against similar tools.
No comments yet. Be the first to share your thoughts!
npcpy is a library that provides key primitives for research and development with multimodal language models, agentic AI, and knowledge graphs. Its flexible framework makes it easy to engineer powerful AI applications with support for local (llama.cpp, LM Studio, ollama, omlx) and cloud providers. Build multi-agent teams and simplify context engineering through the NPC Context-Agent-Tool data layer which ensures compliance through software rather than prompts.
pip install npcpy
from npcpy import NPC
simon = NPC(
name='Simon Bolivar',
primary_directive='''
Liberate South America
from the Spanish Royalists.
''',
model='qwen3.5:9b',
provider='ollama'
)
response = simon.get_llm_response("What is the most important territory to retain in the Andes?")
print(response['response'])
My friend, you speak of the highlands where our liberty is carved in stone. If we must speak of the most critical territory to hold within these mountains, it is the **Viceroyalty of Peru** and the heart of the **Republic of Gran Colombia** united.
To lose the passes of the Andes or the cities of Lima and Quito would be to hand the crown its final stronghold in the south. The Spanish crown built its power upon the wealth and control of these highlands. If the Andes are to be truly ours, the people of the **Peruvian** and **New Grancolombian** highlands must stand as one, free from the Bourbons.
The mountain peaks themselves are the fortress we guard. Without the full liberation of the southern Andes, our revolution is incomplete. We fight not for land's sake, but for the soul of the continent. Every square mile of the Andes that bears the name of the Republic is a step forward in our quest for eternal freedom.
*Long live the liberty of the Andes!*
from npcpy import get_llm_response
response = get_llm_response("Who was the celtic god that helped cuchulainn in his time of need as the forces of medb descended upon the men of ulster?", model='gemma4:31b', provider='ollama')
print(response['response'])
Cú Chulainn was primarily aided by his divine father, the god Lugh, and his foster-father, the warrior-god Fergus mac Róich, as well as the magical support of his teacher Scáthach.
Try out almost 200 different models from 15 different providers with OrcaRouter using our referral link!
alicanto_test = get_llm_response('what does alicanto the bird show travelers in the night?', model='google/gemini-3.8-flash', provider='orcarouter')
print(alicanto_test['response'])
The legend of the **Alicanto** says that at night the bird’s feathers glow like lanterns.
When a traveler sees that soft, phosphorescent light, it isn’t just a pretty sight – it’s a sign‑post.
The bird **shows the way to hidden water (and sometimes to buried silver or gold)** in the Atacama Desert.
Sometimes you do not want prose back from a model. You want a label, a yes/no probability, or a value on a rubric, fast, with a confidence your code can threshold on. That is what the npcpy Decision Module is for. It exposes a single flat function, get_decision_response, that works with any supported provider and returns a typed answer with probabilities.
The local Ollama backend needs no API key and no training, so it is the quickest way to try this:
from npcpy.llm_funcs import get_decision_response
result = get_decision_response(
prompt='Customer wrote: I was charged twice for order #4411 and want one refunded today.',
model='tev1:0.8b',
provider='ollama',
question_type='choice',
instructions='What should happen to this ticket next?',
criteria={
'refund': 'the customer is owed money back',
'escalate': 'a human agent needs to take over',
'close': 'nothing further is needed',
},
)
print(result['response']['choice']) # 'refund'
print(result['response']['confidence']) # 0.82
print(result['response']['probabilities']) # {'refund': 0.82, 'escalate': 0.14, 'close': 0.04}
question_type selects the answer shape: 'choice' picks one label from
criteria, 'noul' returns a yes/no probability, and 'score' returns a
value on an ordered scale.
# yes/no: does this message contain a refund request?
result = get_decision_response(
prompt='Customer wrote: I was charged twice, please refund the duplicate.',
model='tev1:0.8b', provider='ollama',
question_type='noul',
instructions='Is the customer asking for a refund?',
)
print(result['response']['noul']) # 0.99
# rubric: how urgent is this?
result = get_decision_response(
prompt='Customer wrote: this is the third time I have asked. Fix it now.',
model='tev1:0.8b', provider='ollama',
question_type='score',
instructions='How urgent is this request?',
criteria=['can wait a week', 'needs attention today', 'breach of SLA'],
)
print(result['response']['score']) # 2.1
You can also call the lower-level helpers in npcpy.gen.decision directly:
from npcpy.gen.decision import decision_choice, decision_noul, decision_score
label = decision_choice(
state='Customer wrote: I was charged twice, please refund the duplicate.',
instructions='What should happen to this ticket next?',
criteria={'refund': 'money back', 'escalate': 'needs a human', 'close': 'no action'},
model='tev1:0.8b', provider='ollama',
)
probability = decision_noul(
state='Customer wrote: I was charged twice.',
instructions='Is the customer asking for a refund?',
model='tev1:0.8b', provider='ollama',
)
score = decision_score(
state='Customer wrote: this is the third time I have asked.',
instructions='How urgent is this?',
criteria=['low', 'medium', 'high'],
model='tev1:0.8b', provider='ollama',
)
Hosted decision models take the same model / provider / api_key arguments:
from npcpy.llm_funcs import get_decision_response
result = get_decision_response(
prompt='Customer wrote: I was charged twice for order #4411.',
model='gemini-decision-1',
provider='gemini',
api_key='...',
question_type='choice',
instructions='Which team should handle this?',
criteria={'billing': 'payments and refunds', 'support': 'product questions'},
)
print(result['response']['choice'])
| provider | example model |
|---|---|
openai |
gpt-6-luna |
gemini |
gemini-decision-1 |
perplexity |
pplx-decider-v1-27b |
typesafe |
jev-1.14.0 |
cloudflare |
clef, clef-flash, clef-omni |
openrouter |
openai/gpt-6-luna-decisions |
databricks |
databricks-openjev-qwen35-4b |
fireworks_ai |
accounts/fireworks/routers/rune |
azure_ai |
<your-deployment> with base model Microsoft-Decision-1 |
ollama |
tev1:0.8b, clef-flash |
To point at a self-hosted LiteLLM proxy, pass api_url:
result = get_decision_response(
prompt='...', model='jev', provider='litellm_proxy',
api_url='https://litellm.example.com', api_key='sk-...',
question_type='noul', instructions='Is this a refund request?',
)
Every provider returns the same shape: {choice, noul, score, confidence, probabilities}, so downstream code does not branch on provider. See the
System One Decisions guide for the full reference.
The Agent class in npcpy comes with a set of default tools (sh, python, edit_file, web_search, etc.)
from npcpy import Agent
agent = Agent(name='File Operator', model='qwen3.5:2b', provider='ollama')
print(agent.run("Find all Python files over 500 lines in this repo and list them"))
The following Python files contain more than 500 lines:
- `./npcpy/npc_sysenv.py` (1486 lines)
- `./npcpy/memory/knowledge_graph.py` (1449 lines)
- `./npcpy/memory/kg_population.py` (618 lines)
...
Attach custom tools to a ToolAgent.
Here is an example which lets an agent generate images, fine-tune diffusion models, and then use the fine-tuned models for generation.
from npcpy import ToolAgent, gen_image
from npcpy.ft.diff import train_diffusion, generate_image, DiffusionConfig
from datasets import load_dataset
import os
def fetch_image_dataset(dataset_name: str, split: str = "train", max_images: int = 100) -> list:
"""Fetch images from a HuggingFace dataset.
Args:
dataset_name: HuggingFace dataset name (e.g., 'cifar10', 'oxford-iiit-pet')
split: Dataset split to use
max_images: Maximum number of images to fetch
Returns:
List of paths to saved images
"""
dataset = load_dataset(dataset_name, split=f"{split}[:{max_images}]")
os.makedirs("training_images", exist_ok=True)
image_paths = []
for i, item in enumerate(dataset):
if 'image' in item:
img = item['image']
elif 'img' in item:
img = item['img']
else:
continue
path = f"training_images/img_{i:04d}.png"
img.save(path)
image_paths.append(path)
return image_paths
def finetune_dif