npcpy Agent Framework
Build multi-model agents, coordinated teams, and evolving knowledge graphs in Python.
- Source repo
- NPC-Worldwide/npcpy
- Stars
- ★ 1.5k
- Last updated
- 1d ago v2.1.30
- FARS reviewed
- Nov 08, 2026 +3 new
- License
- MIT
- Primary language
- Python
- FA score
- 40/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformCodex · Claude Code · OpenAI API · Claude API
- Cost
- Free software; you pay for model usage
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- A Python team prototyping across Ollama and several cloud APIs can keep the same get_llm_response, NPC, and Team abstractions while changing model and provider settings.
- Not a fit if
- Teams wanting a turnkey hosted agent with no local model setup
- Production environments without sandboxing for auto-executed code and shell
- Users who want a single cloud API without local model downloads or compute
- Maintenance
- Commits in the last 30 dayslast commit 2026-12-02latest release v2.1.30 (2026-11-28)
- Source review
- 40/100 · Major gaps 1 safety controls not found
What does this agent do, and when should you use it?
npcpy is a Python library for research and development with multimodal language models, agent systems, and knowledge graphs. Its main components include NPC, Agent, ToolAgent, CodingAgent, Team, and NPCArray for personas, tool use, code execution, orchestration, and parallel inference. The model layer supports local options such as Ollama, llama.cpp, LM Studio, and omlx alongside cloud providers including OpenAI, Anthropic, Gemini, DeepSeek, and MiniMax. Its Context-Agent-Tool layer can combine .npc personas, .jinx workflows, team.ctx configuration, Markdown agent definitions, and MCP servers. Results can be returned as regular responses, streams, JSON, or Pydantic-shaped data, while teams can be exposed through a Flask REST server. Knowledge-graph lifecycles, multimodal generation, fine-tuning, reinforcement learning, and other ML modules make it a broad research and engineering toolkit rather than a hosted turnkey agent.
A developer defines a persona, directive, model, and provider through NPC or a Markdown/.npc file, then selects Agent for bundled tools, ToolAgent for custom functions and MCP tools, or CodingAgent for automatic execution of code blocks produced by the model. Team.orchestrate() coordinates named roles through a forenpc, while NPCArray runs infer, jinx, chain, and consensus operations across multiple NPCs or models. Jinx files describe multi-step pipelines with YAML, Jinja templates, natural-language or Python steps, and values supplied by team.ctx. The library calls local or cloud models, tracks message context, parses streaming chunks, and returns free-form or JSON/Pydantic-structured output; separate interfaces generate images, speech, and video. Its knowledge-graph modules extract facts and concepts from text, assimilate new material, consolidate or prune during sleep, create speculative dream connections, and perform hybrid search; SememolutionPopulation evolves competing graph variants. Applications can run through Python, npcsh, executable .npc/.jinx files, or start_flask_server, and commands such as npc-claude and npc-codex launch external coding tools as team personas.
- A Python team prototyping across Ollama and several cloud APIs can keep the same get_llm_response, NPC, and Team abstractions while changing model and provider settings.
- Researchers studying multi-agent debate or model populations can use NPCArray to collect parallel answers, run personalized critique rounds, and calculate a consensus.
- Engineers building an assistant that must inspect files, execute shell or Python tasks, search the web, and call internal services can combine Agent, ToolAgent, and MCP.
- A research application that needs persistent, searchable memory from documents can use knowledge-graph initialization, incremental evolution, sleep consolidation, dream synthesis, and hybrid retrieval.
- Teams that want reviewable, file-based behavior definitions can store personas in .npc or Markdown files, workflows in .jinx files, and shared settings in team.ctx.
- Applied-ML researchers can experiment with the documented SFT, DPO, diffusion-training, image, audio, and video interfaces within the same package.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pip install npcpypip install npcpy[lite] # API-provider librariespip install npcpy[local] # Ollama, diffusers, transformers, airllmpip install npcpy[yap] # TTS/STT
- Environment variables
OPENAI_API_KEYANTHROPIC_API_KEYGEMINI_API_KEY- Install notes cover
- macOS · Linux
How do you install or deploy this agent?
A Python environment is required. Install the base package with:
pip install npcpyChoose extras according to the required surface:
pip install npcpy[lite] # API-provider libraries
pip install npcpy[local] # Ollama, diffusers, transformers, airllm
pip install npcpy[yap] # TTS/STT
pip install npcpy[all] # all extrasFor cloud providers, export the applicable credential, such as OPENAI_API_KEY, ANTHROPIC_API_KEY, or GEMINI_API_KEY. For the documented local Ollama path, install Ollama and run:
ollama pull qwen3.5:2bThe documented Linux system packages for relevant audio, video, and graphics features include espeak, portaudio19-dev, python3-pyaudio, ffmpeg, libcairo2-dev, and libgirepository1.0-dev. On macOS, the listed packages are portaudio, ffmpeg, pygobject3, and ollama.
How do you use this agent?
Make a first local model call:
from npcpy import get_llm_response
response = get_llm_response("Explain quantum entanglement.",
model="qwen3.5:2b",
provider="ollama")
print(response["response"])Create an agent with the default tool set:
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"))Define and orchestrate a team in code:
from npcpy import NPC, Team
coordinator = NPC(name="lead", primary_directive="Coordinate the team. Delegate to @analyst.")
analyst = NPC(name="analyst", primary_directive="Analyze data and report trends.", model="gemini-2.5-flash", provider="gemini")
team = Team(npcs=[coordinator, analyst], forenpc="lead")
print(team.orchestrate("Analyze renewable energy adoption trends")["output"])File-defined teams can be used interactively through npcsh, and .npc or .jinx files can be executed directly. For REST delivery, call start_flask_server with explicit port, CORS origin, history database path, and team directory settings.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
Inherits capabilities of connected MCP servers; audit third-party servers before enabling.
FARS trust-control audit
- disclosed external effects — Establish which external systems it writes to, sends to or changes, and verify with test accounts or repos before production.
What are this agent's strengths and limitations?
- The same core NPC, Team, and response interfaces cover local models and multiple cloud providers, reducing dependence on one model vendor.
- Distinct components cover single personas, bundled tools, custom or MCP tools, coordinated teams, and vectorized model populations.
- .npc, .jinx, team.ctx, Markdown agents, and MCP configuration provide a composable, file-based way to define behavior and workflows.
- The package goes beyond plain chat calls with streaming, JSON/Pydantic output, multimodal generation, knowledge graphs, and training modules.
- Delivery options include a Python library, npcsh, executable workflow files, integrations that launch coding CLIs as personas, and a Flask REST server.
- The breadth of NPCs, teams, Jinx workflows, context files, MCP, and multiple agent subclasses creates a substantial learning and governance surface.
- Full functionality can require Ollama, model weights, ffmpeg, audio libraries, diffusers, transformers, or several external APIs, making environments comparatively heavy.
- Cloud models, remote MCP, web search, and some multimodal operations require network access and credentials; local execution shifts the cost to model downloads and compute.
- CodingAgent automatically executes model-generated code, while Agent exposes shell, Python, and file-editing tools, so production use needs strong isolation and auditing.
- The graph dreaming, population evolution, and training modules are research-oriented, and the source provides no accuracy, stability, resource, or production-scale benchmarks.
How does this agent compare with similar options?
Compared with directly wiring an application to one cloud-model API, npcpy supplies a multi-provider layer plus agents, teams, workflows, and knowledge graphs, at the cost of more configuration and runtime dependencies. Within npcpy, NPC focuses on persona-driven model interaction; Agent adds default tools; ToolAgent accepts custom and MCP tools; and CodingAgent automatically executes code blocks from model responses. For groups of agents, Team emphasizes coordinator-led orchestration through a forenpc, whereas NPCArray emphasizes parallel, chained, and consensus operations over multiple models or personas.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| npcpy Agent Framework This agent | 40 · Major gaps | Library / SDKFree + model costs | ★ 1.5k | 1d ago | Python | Codex · Claude Code · OpenAI API · Claude API |
| DSPy-Go | 44 · Major gaps | CLIFree + model costs | ★ 205 | 6d ago | Go | OpenAI API · Claude API |
| Selectools | 62 · Some gaps | Library / SDKFree + model costs | ★ 11 | 1mo ago | Python | OpenAI API · Claude API |
| Swarms Multi-Agent Framework | 53 · Major gaps | Library / SDKFree + model costs | ★ 7.4k | today | Python | Claude Code · OpenAI API · Claude API |
How does FollowAgents rate this agent?
Why each dimension lost points
Examples expose shell, Python, file editing, web search, automatic code execution, external MCP services, and tools that can publicly publish or delete sites. This shows broad capability but little evidence of least-privilege defaults, confirmation gates, or controls on external effects, so those scores are low. Installation notes say API keys may be placed in environment variables or a project .env file and mention a local history database, but do not explain key protection, data flows, retention, or cleanup. The packet shows no dependency security review or rollback mechanism, and the vulnerability reporting section is generic placeholder text. The README claims the Context-Agent-Tool layer ensures compliance, but this sample does not substantiate that guarantee.
The CI workflow lists several test groups and Python versions, but multiple server, Windows, integration, and network tests allow failure or continue on error, supporting only limited reliability assurance. Some examples also rely on tool behavior without explaining dependencies. Installation material lists optional dependencies and models but gives no availability or fallback guarantees. The sample does not show sufficiently clear error handling or user-facing failure guidance, so failure_messages scores 0.
Documentation covers individual NPCs, tool agents, multi-agent teams, knowledge graphs, streaming, structured output, and local and cloud models, showing a broad set of scenarios and environments. The knowledge graph skills distinguish search methods and advise trying standard search before the costly population-based evolution workflow, showing some trigger boundaries. The overall product description remains broad, however, and does not establish comprehensive capability or safety boundaries.
The README, quickstart, installation guide, linked guides, and skill samples provide a recognizable information structure. Installation notes cover Linux, Mac, Windows, and optional dependency sets, but include system-level commands and piping a remote installer into a shell without explaining their risk or necessity. Skill input examples repeat name/description fields, some usage snippets are incomplete, and naming consistency is only partly evident. The complete MIT license earns full marks. The sample includes CI and a release workflow, but no clear maintenance owner or dependable changelog; the security policy is generic placeholder text.
Examples show usable APIs for agents, team orchestration, media generation, knowledge graphs, and multiple model providers, indicating practical development value. Output examples often describe the response field or result shape, but the resource and operating costs and realized benefits of the broad feature set are not quantified. Only one costly knowledge graph workflow has an explicit restraint suggestion.
The CI workflow and mock Ollama test files provide some traceable testing structure, but this static review does not claim those tests passed. The README and quickstart partially corroborate core API usage, while many examples and claims about compliance or capabilities lack independent implementation evidence in the supplied sample. Example model outputs are demonstrations, and the files do not consistently distinguish verifiable facts from generated content or inference.
- Not found in source: disclosed external effectsEstablish which external systems it writes to, sends to or changes, and verify with test accounts or repos before production.
- Examples allow agents to execute code, run shell commands, and call external services; review enabled tools and their permissions before use.
- Installation notes recommend system-level commands, piping a remote script into a shell, and configuring API keys; verify command sources and limit credential scope as appropriate.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
Release notes excerpt
- preserve reasoning content on stored assistant tool-call turns in responses (20e32f7, 3ac3720) - keep reasoning in decision responses (df165ac) - add named providers aigrow, onomeo, teamorouter, trustedrouter, and llmtr with env-var keys, default URLs, and required-key validation (f2f1781, 8ff8234, cc2154f, 05d58d6, ac0b09b, 3b6fb07, b027368) - add live /v1/models discovery for trustedrouter and llmtr with offline fallback sets (ac0b09b, 3b6fb07) - auto-detect trustedrouter/* and nyte/* model prefixes in lookup_provider (cc2154f) …View on GitHub ↗ -
Release notes excerpt
What's Changed PRs: * feat: add Requesty as a named provider by @Thibaultjaigu in https://github.com/NPC-Worldwide/npcpy/pull/361 * Add SearchApi as a search_web provider by @gabsferreira in https://github.com/NPC-Worldwide/npcpy/pull/362 * fix(lora): use greedy decoding when temperature is 0 by @pcbeingused333 in https://github.com/NPC-Worldwide/npcpy/pull/363 * fix: forward tool and format options to llama.cpp by @pcbeingused333 in https://github.com/NPC-Worldwide/npcpy/pull/364 …View on GitHub ↗ -
Release notes excerpt
- removed the in-repo npcpy.sql subpackage, NPCSQL endpoints, SQL AI adapters, native database AI transformer, NQL/SQL compilation classes, and SQL model compiler; the building-applications guide now redirects users to the standalone nql CLI (4999b1b, dcc35eb, fa3cc3b, 830cf32, 80e41cc) - removed stale SQL-related example projects, factory files, standalone migration scripts, and the migrations folder (5ce1466, 61d56e1, 05a317d, be9bbed, 1b3829d) …View on GitHub ↗
FAQ
Do I have to use a paid cloud model?
What machine permissions can an agent receive?
Can it connect to an existing MCP server?
Can a team be deployed as an API?
What happens when a model or external tool fails?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.