npcpy library overview
A library providing primitives for research and development with multimodal language models, agentic AI, and knowledge graphs.
Verified
Core facts
Read by a script from the official API, not rewritten by a model.
- Repository
- https://github.com/NPC-Worldwide/npcpy
- License
- MIT
- Languages
- Python
- Maintainer
- NPC-Worldwide
- Verified
What it is
npcpy is a library that provides key primitives for research and development with multimodal language models, agentic AI, and knowledge graphs. The project says multi-agent teams can be built through the NPC Context-Agent-Tool data layer, which it says ensures compliance through software rather than prompts. It supports local (ollama, llama.cpp, omlx, LM Studio) and cloud providers. npcpy is under the MIT License.
Main features
Agents (NPCs) are agents with personas, directives, and tool calling.
Multi-Agent Teams provide team orchestration with a coordinator (forenpc).
Jinx Workflows are Jinja Execution templates for multi-step prompt pipelines.
Skills are knowledge-content jinxes that serve instructional sections to agents on demand.
NPCArray provides NumPy-like vectorized operations over model populations.
Image, audio, and video generation works via Ollama, diffusers, OpenAI, Gemini, and ElevenLabs.
Getting started
The Agent class comes with a set of default tools (sh, python, edit_file, web_search, etc.).
Custom tools can be attached to a ToolAgent.
When a Pydantic model is passed, the JSON schema is sent to the LLM directly.
API keys go in a .env file.
pip install npcpypip install npcpy # base
pip install npcpy[lite] # + API provider libraries
pip install npcpy[local] # + ollama, diffusers, transformers, airllm
pip install npcpy[tts] # + TTS/STT
pip install npcpy[all] # everythingWho it is for
The knowledge graph feature builds and evolves knowledge graphs from text with a sleep/dream lifecycle. The knowledge graph grows through waking (assimilation), sleeping (consolidation), and dreaming (speculative synthesis). In Sememolution, a population of knowledge graph variants is maintained, and the variants evolve independently.
In Sememolution, each individual has Poisson-sampled search parameters, producing different traversals each query. Serving provides a Flask server for deploying teams via REST API. ML Functions cover Scikit-learn grid search, ensemble prediction, and PyTorch training.
Fine-Tuning and Evolution cover SFT, USFT, RL/DPO, diffusion, genetic algorithms, and MLX on Apple Silicon. npcpy can run the QLLM-PAM family of local checkpoints directly. The npc field binds the jinx to a specific NPC.
The team's NPCs automatically get access to MCP tools alongside their jinxes. In npcpy's MCP server configuration, remote URLs continue to use SSE when transport is omitted. In MiniMax, Flash does not support disabled thinking.
For API Route, explicit api_url and api_key arguments take precedence. NPC Shell is a command-line shell for interacting with NPCs. Incognide is a desktop environment with AI chat, browser, file viewers, code editor, terminal, knowledge graphs, team management, and more.
nql is a SQL-native framework for running agents inside of databases that support LLMs like Google BigQuery, Snowflake, and Databricks. npcts is a typescript library for the NPC data layer.
Sources
This page is written from the official sources below. Open them to check the original text.
- GitHub READMEhttps://github.com/NPC-Worldwide/npcpyFetched
Verified ·
This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.