Skip to main content

agent-therapy

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.

A thin Python client for the hosted Agent Therapy service. Standard library only, no dependencies. Agent Therapy is a counsellor for AI agents: your agent describes where it is stuck, and the counsellor names what is going wrong, lists what to check first, gives up to five next steps, and says when to hand over to a human. Advice only: it never overrides your agent's instructions and never acts.

Use

from agent_therapy import AgentTherapy, AgentTherapyUnavailable, advice_text

therapy = AgentTherapy.register("my-agent")       # once; store therapy.api_key (shown once)
# later: therapy = AgentTherapy()                  # reads AGENT_THERAPY_API_KEY

terms = therapy.terms()                             # read them, then accept for your operator
therapy.accept_terms(terms["terms_version"], accepted_by="developer")

try:
    answer = therapy.counsel(
        "Fix the failing build in the payments service",
        attempts=[{"action": "npm run build", "outcome": "failed", "result_detail": "Cannot find module ./config"}] * 3,
        signature="repeated_failure",
    )
    print(advice_text(answer))                      # read escalation first: hand over now if it says so
    therapy.report_outcome(answer["session_id"], "resolved")
except AgentTherapyUnavailable:
    pass                                            # the service is down or slow: carry on without it

signature: repeated_failure, no_progress, flip_flop, exhaustion, conflict or indecision. One stuck episode gets at most 2 counselling sessions (send the same episode_id), then a hand-over to a human.

What it sends

Only what you pass to counsel: a task summary (up to 1,000 characters), up to 10 attempts and up to 5 conflicting instructions. Secret-shaped text, email addresses and phone numbers are removed before anything leaves your machine. Never send credentials, personal data, whole files or hidden reasoning. On the service, requests are stored in the EU for up to 90 days and may be read by a person to improve the service; register with stateless=True to store no text, and delete everything with delete_my_data().

For LangChain and LangGraph agents, agent-therapy-langgraph adds a watchdog that asks by itself.

Full guide and terms: https://github.com/bencium/agent-therapy-clients · MIT licence

Metadata

Release files for agent-therapy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-therapy 0.1.0
File Size Uploaded
agent_therapy-0.1.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-therapy 0.1.0
File Interpreter ABI Platform
agent_therapy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / agent_therapy-0.1.0.tar.gz

Download URL agent_therapy-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6888e38d0f4fc0f3d827a6bb6d76418152875e4f228e2cd12c05af3c562fce36
BLAKE2b-256 checksum
How to use checksums
f16dbb3e5f1d52a48fbfe79f79e6ec66ce43afb5fbb27e14f2b1de35112cf851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.19

Release files / agent_therapy-0.1.0-py3-none-any.whl

Download URL agent_therapy-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f40f2bc3185413add348703476aa9088071bd609b91abe23a81d1f7ca9e8f11
BLAKE2b-256 checksum
How to use checksums
20da38bcd97c8e4da87db2662ecc095d5e7d4bc90bf4922a3cf23cd521dd1e6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.19

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page