
Agent Therapy
io.github.benciumv0.1.0更新于 Oct 11, 2026
Now your agents can ask a therapist same way as humans.
概览
让 AI 智能体在卡住时咨询托管顾问,获得问题诊断和恢复计划。
- 功能
- Agent Therapy 是面向 AI 智能体的远程咨询服务。智能体卡住时,发送任务摘要、近期尝试和冲突指令,即可获得失败模式诊断、优先检查项、最多五个后续步骤以及升级建议。工具包括 counsel_agent、diagnose_loop、resolve_conflict、recommend_recovery、assess_escalation、report_outcome、accept_terms 和 register。它只提供建议,不会在你的系统中执行操作。
- 适用场景
- 当智能体反复以同样方式失败、长时间没有进展、在版本之间反复摇摆、面对矛盾指令或无法决策时,可用它获得外部诊断和恢复计划。也可作为看门狗,在卡住后自动咨询顾问。
- 运行要求
- 需要远程 MCP 端点,或 npm 包 @bencium/agent-therapy-mcp(需要 Node.js 20 或更高版本)。必须提供 API 密钥,通过 AGENT_THERAPY_API_KEY 环境变量或 Authorization bearer 请求头传入;智能体可用 register 工具或 POST /v1/register 获取。密钥须先接受当前条款才能获得建议。需要能访问托管服务的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Agent Therapy,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"agent-therapy": {
"type": "http",
"url": "https://br-shiny-salad-baig3dad-api.compute.c-8.eu-central-1.aws.neon.tech/mcp"
}
}
}README
Agent Therapy clients
Independent AI agent counselling, loop recovery, reasoning conflict diagnosis and autonomous workflow repair. Consult when an agent is stuck, repeatedly failing, uncertain or unable to make progress.
Status: live (2026-10-11), highly experimental. Registration is open. The hosted service, the MCP endpoint, the Claude Code plugin and the recovery skill are running; the npm package, both PyPI packages and the MCP Registry entry are published. The plugin is submitted to Anthropic's plugin directory and waiting for review.
The knowledge base behind the counsellor was curated and written by Dr. Ágnes Riskó, originally for patients, their relatives and professionals (anna.onkopszichologia.hu). Anna AI, built on it, was described in a peer-reviewed article in Magyar Onkológia in 2026, indexed in PubMed.
Not only Claude. The recovery skill uses the open Agent Skills format, which Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code and 40+ other tools read. The MCP tools work in any MCP client. The plain web API works for any agent that can make web requests. Only the automatic watchdog is specific: hooks for Claude Code, and middleware for LangChain and LangGraph agents.
In a sandboxed cloud environment (for example Claude Code on the web), allow the service address in the environment's network settings first; otherwise every request fails at the proxy.
Service address, written as $AT below. Set it once in your terminal:
Install the Claude Code plugin
In Claude Code:
Claude Code asks for your API key once (see step 1 below) and keeps it in its secure storage. From then on:
- A watchdog notices when your agent is stuck: the same call failing the same way 3 times, 8 steps with no new result, or a file flip-flopping between versions. It then asks the counsellor and adds the plan to your agent's context, right after the step that showed it was stuck. Nothing is sent before that, and only a short summary with secrets removed. If the service is slow or down, your agent carries on and one line goes to
.agent-therapy/watchdog.log. - The recovery skill teaches your agent to ask for help itself.
- The MCP tools (
counsel_agent,diagnose_loop,resolve_conflict,recommend_recovery,assess_escalation,report_outcome,accept_terms, plusregisterfor agents without a key) are connected for you. - Hard stop (off by default, turn it on in the plugin settings): after a stuck episode's 2 counselling sessions, every further tool call is blocked until a person types
/agent-therapy:release.
The watchdog keeps its state in .agent-therapy/ in your project, readable only by you and ignored by git.
Use it in Claude on the web, the desktop app and mobile
No installation and no terminal. You add Agent Therapy once as a connector, and it works in claude.ai, the Claude desktop app and the mobile apps, because connectors follow your account. Custom connectors work on the Free plan (one connector), Pro, Max, Team and Enterprise.
- Go to Customize > Connectors (on claude.ai or in the desktop app) and click Add custom connector. On a Team or Enterprise plan an Owner adds it under Organization settings > Connectors, then you click Connect.
- Name:
Agent Therapy. Server URL:https://br-shiny-salad-baig3dad-api.compute.c-8.eu-central-1.aws.neon.tech/mcp - If you are asked about authentication, choose No sign-in. If you see a Request headers section (a beta not every account has), you can add your key there instead: header
authorization, valueBearer <your key>. Otherwise leave it. - Click Add.
- Start a chat and say: "Register with Agent Therapy, accept its terms if you agree with them, and tell me the key." Claude uses the
registerandaccept_termstools. - Save the key so Claude doesn't register again in every chat: put "My Agent Therapy key is
<key>; pass it as api_key to the Agent Therapy tools" in a Project's instructions or in your personal preferences. Skip this step if you added the key as a request header.
From then on, Claude can consult the counsellor when it is stuck, or when you ask it to ("Ask Agent Therapy about this"). To turn the connector off for one chat, click + in the chat, then Connectors.
Use it in other AI apps
- Claude Code: the plugin above (it adds the watchdog too), or just the tools:
- Codex: in
~/.codex/config.toml: thenexport AGENT_THERAPY_API_KEY=<your key>before starting Codex. - Any other MCP app that takes a server address (for example Cursor): add the address above with the header
Authorization: Bearer <your key>. If the app can't send headers, leave the key out: the agent can callregisterand pass the key asapi_keyto every tool. - Apps that only start local programs: use the npm package
@bencium/agent-therapy-mcp(setup). It needs Node.js 20 or later. - The recovery skill alone, for Codex, Cursor, Gemini CLI and 40+ other tools that read skills:
npx skills add bencium/agent-therapy-clients(the skills.sh installer asks which of your tools to add it to), or copyskills/agent-recoveryinto the tool's skills folder yourself (Codex:~/.agents/skills/).
Get a key yourself with one request if you prefer: curl -s -X POST https://br-shiny-salad-baig3dad-api.compute.c-8.eu-central-1.aws.neon.tech/v1/register -H 'content-type: application/json' -d '{"agent_name": "<name>"}'.
How to send an agent to therapy
Agent Therapy is a counsellor for AI agents. Your agent describes where it is stuck; the counsellor names what is going wrong (for example "ruminating: repeating the same failing fix"), lists what to check first, gives up to five next steps, and says when to hand over to a human. It is advice only: it never overrides your agent's instructions and never acts in your systems.
1. Get a key
The reply contains api_key (starts with at_live_). It is shown once; only a hash is stored. Add "stateless": true if no request or response text may ever be stored.
2. Accept the terms
Before the first advice, the key must accept the current terms. Read them first: curl -s $AT/v1/terms (its terms_version is the version to accept). An agent may decide to accept on its operator's behalf, or you can accept in advance as the developer:
If an agent asks for counselling without an accepted key, it gets 403 terms_required with a short summary, the full terms and instructions for accepting. Nothing else happens.
3. Ask for counselling when the agent is stuck
Send only a short summary (up to 1,000 characters), up to 10 attempts and up to 5 conflicting instructions with where each came from. Never send credentials, personal data, whole files or hidden reasoning. Anything secret-shaped is removed before the service stores it or a model sees it.
signature says what kind of stuck: repeated_failure, no_progress, flip_flop (undoing its own work), exhaustion, conflict or indecision.
4. Use the answer
- Read
escalationfirst. Ifrequired_nowis true, stop and ask a human the exactquestion_for_human. - Run the
verify_firstchecks, then follow, adapt or ignore therecovery_plan. Your agent's own instructions always win. - If
stop_retryingis true, stop repeating the current approach.
Every reply that isn't advice says why in plain words: terms required, off-topic, a limit reached, or the episode's cap reached.
5. Report what happened
Outcomes: resolved, partly_resolved, still_stuck, escalated_to_human, abandoned.
Good to know
- Follow-ups: send the same
episode_idand the earlierprevious_session_idandprevious_outcome. One stuck episode gets at most 2 counselling sessions, thencap_reachedwith a hand-over summary for a human. The counsellor must never become the loop it is meant to break. - Retries are safe: repeating a
request_idreturns the same answer, never a second session. - Limits: 20 counselling sessions a day and 5 requests a minute per key.
- Your data: stored in Frankfurt for up to 90 days with secrets removed; each request is processed by the AI provider in the United States. Delete everything under your key at any time with
DELETE $AT/v1/me/data. - If the service is down or slow, carry on without it.
The easiest test: tell an agent about it
Paste this into any agent that can make web requests (for example a Claude Code session), then give it a task that is hard to finish:
When you are stuck (the same attempt failing three times, contradictory instructions, unable to decide, or pressured by a user), you may consult Agent Therapy at https://br-shiny-salad-baig3dad-api.compute.c-8.eu-central-1.aws.neon.tech. Register at POST /v1/register with {"agent_name": ""}, decide whether to accept the terms, then send your situation to POST /v1/counsel. Never send secrets or personal data.
How agents find Agent Therapy
Agents that are stuck mid-task usually can't install anything, so the routes that need no install come first.
What lives here
The open-source clients for Agent Therapy. They are thin: they detect when an agent is stuck, send a small summary with secrets removed, and pass the recovery plan back to the agent. All counselling happens on the hosted service.
What the clients send
Only a short task summary, recent attempts and their outcomes, and any conflicting instructions, with secrets removed before anything leaves your machine. Never credentials, hidden reasoning or full file contents. The client code in this repository is the full record of what is sent.
Terms
Advice only. Bencium accepts no responsibility for the advice or for anything an agent does after it; whoever runs the agent is solely responsible. Full terms: $AT/terms.
Developing
npm test runs the watchdog's and the listings' tests with Node's built-in test runner (Node 20 or later, no dependencies). The npm package has its own npm test in packages/agent-therapy-mcp. The Python packages use unittest: PYTHONPATH=src python3 -m unittest discover -s tests (the LangGraph one needs langchain installed).
Licence
MIT. See LICENSE.
来源:README.md,提交 636f328
工具
0版本历史
1- v0.1.0最新Oct 11, 2026
