npcpy

by cagostino

1.4k stars
625 downloads
Not rated
GitHub

About

The python library for research and development in NLP, multimodal LLMs, Agents, ML, Knowledge Graphs, and more.

Details

Author
cagostino
GitHub stars
1,420
Downloads
625
Categories
Other, AI

- Primitives for multimodal LLMs, agentic AI, and knowledge graphs
- Support for local and cloud model providers
- Multi‑agent debate and orchestration via NPCArray
- Context‑Agent‑Tool data layer for safety compliance
- Pre‑built agent tools: shell, Python, edit_file, web_search
- CodingAgent for automated code execution

Install with pip install npcpy. Then import the library to create NPC personas, run direct LLM calls, build agents with built‑in or custom tools, orchestrate multi‑agent debates via NPCArray, or manage knowledge graphs with sleep/dream lifecycle functions. Example code is provided for each major feature.

npcpy

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 (ollama, llama.cpp, omlx, LM Studio) 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

Quick Examples

Create and use personas

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!

Direct LLM call

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.

```python

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.