Skip to content

docs(deepagents): add agentId parameter to useInterrupt and document state access - #5869

Closed
marthakelly wants to merge 4 commits into
mainfrom
docs-fac-66-interrupt-agent-name
Closed

marthakelly wants to merge 4 commits into
mainfrom
docs-fac-66-interrupt-agent-name

Conversation

@marthakelly

Copy link
Copy Markdown
Contributor

Summary

Fixes the Deep Agents TypeScript interrupt-based documentation to properly show how to connect the hook to a specific agent and how to access stored state in the agent.

Changes

Added parameter to all calls

  • The hook now includes to fix the runtime error:
  • Applied to all three examples: basic usage, conditional UI execution, and preprocessing

Added new "Make your agent aware of interruptions" section

  • Shows how to access custom state properties (like ) in the agent middleware
  • Demonstrates injecting state values into the system prompt
  • Includes both Python and TypeScript examples
  • Fixes the broken anchor link that was referenced but not defined

Files Changed

  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx
  • showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx

Testing

The documentation changes are consistent with:

  • The hook implementation which accepts an optional parameter
  • Other Deep Agents docs that consistently use "sample_agent" as the agent ID
  • Working showcase examples like showcase/integrations/langgraph-typescript/src/app/demos/gen-ui-interrupt/page.tsx

Resolves https://linear.app/copilotkit/issue/FAC-66

…state access

- Add agentId: "sample_agent" to all useInterrupt() calls to fix 'Agent default not found' error
- Add new section explaining how to access interrupt state in agent middleware
- Show how to inject state values into system prompt
- Applies to both TypeScript and Python examples
- Fixes broken anchor link to make-your-agent-aware-of-interruptions section

Resolves FAC-66
@linear

linear Bot commented Jul 8, 2026

Copy link
Copy Markdown

FAC-66

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies

@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 41 services digest-pinned.

Run 2026-07-20 19:35:53 PDT — 0 finding(s).

@MikeRyanDev MikeRyanDev left a comment

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.

The agentId: "sample_agent" additions look consistent with the hook API and the Deep Agents quickstart wiring, but the new "Make your agent aware of interruptions" examples need a correction before merge.

Blocking finding:

  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx:229 and showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx:229: the TypeScript snippet mutates runtime.systemPrompt from beforeModel. In LangChain JS, beforeModel receives the frozen runtime and returns state updates; prompt changes should be made with wrapModelCall/dynamicSystemPromptMiddleware (or by returning/constructing messages through a supported API). As written, the example can throw when assigning to runtime.systemPrompt, and even if it did not throw it would not reliably affect the model request. Please replace this with a supported TypeScript prompt-injection pattern that reads state.agentName after the interrupt resolves.

… docs

Remove the 'Make your agent aware of interruptions' section that contained
invalid code examples using non-existent APIs:
- Python: CopilotKitState, AgentMiddleware, runtime.system_prompt mutation
- TypeScript: createMiddleware from 'langchain', runtime.systemPrompt mutation

The primary fix (adding agentId parameter to useInterrupt) remains intact
and correctly addresses the runtime error.

Addresses PR feedback: #5869 (review)
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 410874aa-741c-4470-ba32-b80e177dfd5a

📥 Commits

Reviewing files that changed from the base of the PR and between 8d052b7 and aca983a.

📒 Files selected for processing (2)
  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx
  • showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx
🚧 Files skipped from review as they are similar to previous changes (2)
  • showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx
  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx

Walkthrough

Updated Deep Agents interrupt documentation with middleware-aware Python agent construction and clarified interrupt state exposure. Updated React useInterrupt examples to specify agentId: "sample_agent" across single-interrupt, conditional, and handler-based flows.

Suggested labels: preview

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding agentId to useInterrupt and documenting state access.
Description check ✅ Passed The description is clearly related to the documentation updates and matches the interrupt state and agentId changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (2)
showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx (2)

340-342: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Include the closing brace in the highlight.

The highlight annotation [!code highlight:29] covers 29 lines, leaving the closing }); of the useInterrupt hook unhighlighted. Using 30 will visually cover the entire hook block.

  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx#L340-L342: Change [!code highlight:29] to [!code highlight:30].
  • showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx#L340-L342: Change [!code highlight:29] to [!code highlight:30].
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx`
around lines 340 - 342, Update the [!code highlight:29] annotation to [!code
highlight:30] in interrupt-based.mdx at lines 340-342 and interrupt-flow.mdx at
lines 340-342 so the full useInterrupt hook, including its closing brace, is
highlighted.

115-125: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Include the closing parenthesis in the highlight.

The inline highlight annotation [!code highlight:5] covers 5 lines, which leaves the closing parenthesis of create_deep_agent unhighlighted. Using 6 will visually cover the entire block.

  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx#L115-L125: Change [!code highlight:5] to [!code highlight:6].
  • showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx#L115-L125: Change [!code highlight:5] to [!code highlight:6].
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx`
around lines 115 - 125, Update the create_deep_agent highlight annotation from 5
to 6 lines in both
showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx
(lines 115-125) and
showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx
(lines 115-125), so the highlight includes the closing parenthesis.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx`:
- Around line 340-342: Update the [!code highlight:29] annotation to [!code
highlight:30] in interrupt-based.mdx at lines 340-342 and interrupt-flow.mdx at
lines 340-342 so the full useInterrupt hook, including its closing brace, is
highlighted.
- Around line 115-125: Update the create_deep_agent highlight annotation from 5
to 6 lines in both
showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx
(lines 115-125) and
showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx
(lines 115-125), so the highlight includes the closing parenthesis.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8bd2788f-4d81-4ad5-a616-44fd2252a242

📥 Commits

Reviewing files that changed from the base of the PR and between b24c3e4 and 8d052b7.

📒 Files selected for processing (2)
  • showcase/shell-docs/src/content/docs/integrations/deepagents/generative-ui/your-components/interrupt-based.mdx
  • showcase/shell-docs/src/content/docs/integrations/deepagents/human-in-the-loop/interrupt-flow.mdx

…tion

Fixes broken anchor links to non-existent #make-your-agent-aware-of-interruptions section.
Updates callout text to reference the expose_state pattern shown in the Python example.
@copilotkit-qa-bot

Copy link
Copy Markdown
Contributor

Closing as part of the QA Factory board reset. The linked Linear ticket will return to Research and get a fresh QA-bot-authored PR on its next factory run.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants