core.py

A routing module that combines many agent-related API route groups into one agent API.

In plain words
What is it for?
It registers agent endpoints, including circuit-breaker status and reset actions, model configuration, failed message recovery, awareness, and other agent features.
Why use it?
It keeps a large backend easier to maintain by separating areas such as files, chat history, costs, and failures into smaller modules.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/netmindai-open/narranexus/core.py
Clone the repo
git clone --depth 1 https://github.com/NetMindAI-Open/NarraNexus
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00759
Opus 5 $0.00000 $0.00380
Sonnet 5 $0.00000 $0.00152
Haiku 4.5 $0.00000 $0.00076

Measured 2d ago against content hash 59b2af5722dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

core.py scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.mindflow/mirror/backend/routes/agents/core.py.md · 49 lines

What it actually says

2026-07-13 — Agent 实时层熔断器接入

聚合进 agents_circuit_breaker 子路由(GET 熔断状态 + POST 手动 reset)。

2026-07-09 — mounted agents_llm_config sub-router

Aggregator now include_routers [[agents_llm_config]] (per-agent LLM config overrides), alongside awareness / social / files / etc. under /api/agents.

2026-07-02 — agents_bus_failures sub-router added

Added router.include_router(bus_failures_router), mounting backend/routes/agents/bus_failures.py's /{agent_id}/bus-failures (GET) and /{agent_id}/bus-failures/{message_id}/retry (POST) under /api/agents. This is the recovery half of the NetMindAI-Open/NarraNexus#52 fix — see agents/bus_failures.py.md.

agents/core.py — Agent 路由聚合器(原 agents.py)

为什么存在

agents.py 是一个纯聚合文件,没有任何路由定义,只做一件事:把多个 agents_* 子路由模块合并成一个 router,让 main.py 只需要 include_router(agents_router, prefix="/api/agents") 一次就能注册所有 agent 相关路由。

存在的原因是 agent 资源的子域太多(awareness、chat history、files、MCPs、social network、cost、bus-failures),全放在一个文件里会超过 2000 行,可维护性极差。这个文件是在重构过程中从原来的单体 1850 行文件中拆出来的聚合点。

上下游关系

  • 被谁用backend/main.pyinclude_router(agents_router, prefix="/api/agents")
  • 依赖谁agents/awareness.pyagents/social_network.pyagents/chat_history.pyagents/files.pyagents/attachments.pyagents/mcps.pyagents/cost.pyagents/bus_failures.py 的 router 实例

设计决策

被否决的方案是在 main.py 里逐一 include_router 所有 7 个子路由并分别加 prefix="/api/agents"。这样可以工作,但 main.py 的导入和注册部分会变得很长,而且如果需要在所有 agents 路由上加统一的 tag 或 dependency,要在 7 个地方修改。聚合器模式把这些关注点集中在一处。

Gotcha / 边界情况

子路由注册顺序对 agents/social_network.py 有影响,因为该文件内部有 /{agent_id}/social-network/search/{agent_id}/social-network/{user_id} 的路径冲突问题,但这是由子文件内部的路由定义顺序解决的,与本文件的聚合顺序无关。

新人易踩的坑

新增 agent 资源子域时,需要同时做两件事:创建新的 agents_xxx.py 文件,并在本文件里 import 并 router.include_router()。只做一步会导致路由要么缺失要么孤立。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 49 lines · 0 tokens per session scan A 59b2af5722dd

Subscribe to this mod's changes

core.py is an agent published in the GitHub repository NetMindAI-Open/NarraNexus (84 stars, last pushed 9d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 759 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens