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 multimodal AI applications, agentic AI, and knowledge graphs. It provides a unified interface for interacting with various local and cloud LLM providers, reducing the complexity of context engineering and multi-agent orchestration. It also addresses the-gap between prompt-based compliance and software-enforced compliance through its NPC Context-Agent-Tool data layer.

How it works

The library uses a NPC (Non-Player Character) class to define personas with specific directives. It supports a wide range of providers (including Ollama, llama.cpp, Gemini, and others) and offers specialized agent types:

  • Agent & ToolAgent: Agents that can use default tools (like shell, Python, and web search) or custom Python functions as tools.
  • CodingAgent: An agent that automatically executes code blocks generated by the LLM.
  • NPCArray: A framework for running parallel inference and multi-agent debates where agents can critique and refine each other's responses.
  • Knowledge Graph: A system for extracting facts and concepts from text, with a "sleep/dream" lifecycle for consolidation and speculative connection generation.
  • Team: A system for orchestrating multiple NPCs using configuration files (.npc, .jinx, team.ctx) to define roles and shared context.

Who it’s for

Developers and researchers building complex AI agents, multi-agent systems, and multimodal applications that require flexible model provider switching and structured memory systems.

Highlights

  • Multi-Provider Support: Works with local providers like Ollama and LM Studio, and cloud providers like Gemini and OpenAI.
  • Multi-Agent Orchestration: Supports parallel inference, iterative refinement, and structured team delegation via the Team class.
  • Multimodal Capabilities: Integrated support for image, audio, and video generation.
  • Structured Output: Built-in support for JSON and Pydantic models for auto-parsed responses.
  • Knowledge Graph Memory: A unique memory system that evolves incrementally and uses a sleep/dream process to prune and expand knowledge.
  • Executable Configs: Ability to define agents and skills (jinxes) in YAML-based files that can be executed directly from the shell.

Related

  • Project
  • Project
  • Project
  • Project
  • Project