Skip to content

feat: hooks for Deep Agents Code - #4956

Merged
Johannes du Plessis (johannes117) merged 9 commits into
mainfrom
docs/deepagents-code-hooks-claude-compatible
Aug 4, 2026
Merged

feat: hooks for Deep Agents Code#4956
Johannes du Plessis (johannes117) merged 9 commits into
mainfrom
docs/deepagents-code-hooks-claude-compatible

Conversation

@johannes117

@johannes117 Johannes du Plessis (johannes117) commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Documents Hooks v2 as implemented, including lifecycle events, command I/O, project trust, reload behavior, legacy migration, and plugin-contributed hooks.


Updates the Hooks reference and Plugins page to match Deep Agents Code.

Test plan
  • vale on both changed pages
  • Docs pipeline build
  • git diff --check

Document the planned hooks redesign (MVP events, matchers, I/O contract, architecture) while preserving the current fire-and-forget behavior as a clearly labeled interim section.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added internal deepagents For docs changes to Deep Agents oss labels Jul 18, 2026
@johannes117 Johannes du Plessis (johannes117) changed the title Draft: Claude-compatible hooks for Deep Agents Code Draft: hooks for Deep Agents Code Jul 18, 2026
@johannes117 Johannes du Plessis (johannes117) changed the title Draft: hooks for Deep Agents Code feat: hooks for Deep Agents Code Jul 30, 2026
…e-compatible' into docs/deepagents-code-hooks-claude-compatible
Adds the parts of Hooks v2 the draft did not cover: plugin hook consent and
path variables, project trust outcomes, the sanitized handler environment,
transcript projections, matcher-field constraints, and where hook feedback
appears in a session.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
@open-swe

open-swe Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Pushed the Hooks v2 details the draft did not cover, checked against libs/code/deepagents_code/hooks and the plugin hooks PR (langchain-ai/deepagents#5198):

  • Plugin hooks: consent is install + enable (workspace trust covers project hooks only), /reload for newly enabled plugins, the ${CLAUDE_PLUGIN_ROOT} / ${CLAUDE_PLUGIN_DATA} / ${CLAUDE_PROJECT_DIR} variables with quoting vs argv guidance, and per-plugin isolation of invalid documents.
  • Precedence reworded so it is clear a lower-precedence handler still runs (and its side effects still happen) when a higher-precedence one stops the event.
  • Project trust outcomes: persisted trust store, deny keeps user and plugin hooks, cancel aborts startup, --trust-project-hooks for headless.
  • Handler environment: credential-looking variables are stripped before launch, so hooks cannot read API keys from the inherited environment.
  • transcript_path / agent_transcript_path point at JSONL projections under ~/.deepagents/transcripts, refreshed before handlers run.
  • UserPromptSubmit and Stop reject non-wildcard matchers at load time.
  • New "Troubleshoot hooks" section for where status text, systemMessage, and warning/error notices surface, plus DEEPAGENTS_CODE_DEBUG=1.

One thing to drop when the flag goes away: I added a <Note> that hooks require DEEPAGENTS_CODE_EXPERIMENTAL=1, since that gate is live on main today (langchain-ai/deepagents#5146). Delete that note in the same PR that removes the gate.

The flag is removed before hooks go live, so the note would ship stale.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
@johannes117
Johannes du Plessis (johannes117) marked this pull request as ready for review August 4, 2026 16:45
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for opening a docs PR, Johannes du Plessis (@johannes117)! When it's ready for review, please add the relevant reviewers:

  • @mdrxy (Deep Agents)

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Mintlify preview branch generated: preview-docsde-1785862016-990fd26

Site preview: https://langchain-5e9cc07a-preview-docsde-1785862016-990fd26.mintlify.site

Important

Preview links may take a few minutes to start working while the deployment finishes.

Changed documentation pages (preview deep links):

@johannes117
Johannes du Plessis (johannes117) merged commit b80e707 into main Aug 4, 2026
25 checks passed
@johannes117
Johannes du Plessis (johannes117) deleted the docs/deepagents-code-hooks-claude-compatible branch August 4, 2026 19:00

<ResponseField name="command" type="list[str]" required>
Command and arguments to run. No shell expansion: use `["bash", "-c", "..."]` if needed.
Quote these variables in a `command` handler, because installation paths can contain spaces: `"command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/format.sh\""`. An `argv` handler resolves them before launch, which avoids shell quoting entirely.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit odd, will update in a separate PR

<ResponseField name="thread_id" type="string" required>
The session thread identifier.
</ResponseField>
The following compatibility fields are recognized but not applied. Deep Agents Code emits a diagnostic and falls back to the behavior shown:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the behavior shown?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepagents For docs changes to Deep Agents internal oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants