NPC-Worldwide/npcpy
The python library for research and development in NLP, multimodal LLMs, Agents, ML, Knowledge Graphs, and more.
What it solves
npcpy is a library designed to simplify the development of complex AI applications by providing primitives for multimodal language models, agentic AI, and knowledge graphs. It addresses the challenge of managing multiple AI personas, coordinating multi-agent teams, and integrating diverse tools and providers (both local and cloud) within a single framework.
How it works
The library uses a "Context-Agent-Tool" data layer to manage AI behavior and compliance. It provides several specialized agent types:
- NPC: A persona-based agent with a primary directive.
- Agent: An agent with default tools like shell access, Python execution, and web search.
- ToolAgent: An agent that can be extended with custom Python functions as tools.
- CodingAgent: An agent that automatically executes code blocks generated by the LLM.
- NPCArray: A utility for running parallel inference across multiple agents, enabling multi-agent debates and iterative refinement.
- Team: An orchestration layer for managing groups of NPCs, which can be defined via code or configuration files (
.npc,.jinx,.ctx).
It also includes a knowledge graph system with a "sleep/dream" lifecycle for consolidating and generating speculative connections from text, and supports Model Context Protocol (MCP) server integration for external tool access.
Who it’s for
- AI researchers and developers building agentic workflows.
- Developers creating multi-agent simulations or collaborative AI teams.
- Engineers needing a unified interface for local (Ollama, llama.cpp) and cloud LLM providers.
Highlights
- Multi-Agent Orchestration: Support for parallel debates, consensus building, and complex delegation via the
Teamclass. - Multimodal Capabilities: Integrated support for image, audio, and video generation.
- Flexible Tooling: Built-in tools for shell and Python execution, plus support for custom tools and MCP servers.
- Knowledge Graph Memory: A unique lifecycle for evolving, pruning, and dreaming within a knowledge graph.
- Provider Agnostic: Works with local providers like Ollama and LM Studio as well as cloud APIs.