Skip to content

Add Claude Agent SDK samples - #403

Merged
patbeqo merged 12 commits into
mainfrom
claude-agent-sdk-samples
Nov 2, 2026
Merged

patbeqo merged 12 commits into
mainfrom
claude-agent-sdk-samples

Conversation

@patbeqo

@patbeqo patbeqo commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Adds claude_agent_sdk_plugin/, samples for the Claude Agent SDK integration. Each Workflow is plain Claude Agent SDK code with a TemporalTransport, and every sample runs offline against a scripted API, so no key is needed. They use temporalio-claude-agent-sdk from PyPI.

Sample What it shows
agent_chat Multi-turn chat driven by Updates, with Continue-As-New that resumes Claude Code's session.
tools One @tool computed in the Workflow and one that runs an Activity.
streaming Token-by-token output through a Workflow Stream.
human_in_the_loop can_use_tool waits durably on an Update: approve, deny or cancel.
structured_output A JSON-schema result validated as a Pydantic model.
fork_session One conversation forked into parallel branches.
multi_agent Claude Code's native subagents: a coordinator, a researcher and a writer.
plugin_with_custom_transport A Claude Code plugin run in a Docker Sandbox by a custom Connector.
open_telemetry One trace across the Workflow, its Activities and Claude Code.

Testing

ruff, mypy and the 24 offline tests pass. Every sample ran against the real model. Every sample's Worker was also stopped mid-turn and restarted, and each resumed with the correct result.

Comment thread claude_agent_sdk_plugin/mcp/workflow.py Resolved
Comment thread README.md Resolved
@patbeqo
patbeqo force-pushed the claude-agent-sdk-samples branch from 2cce724 to b0c0239 Compare October 27, 2026 21:13
@patbeqo
patbeqo force-pushed the claude-agent-sdk-samples branch from b0c0239 to b5492bf Compare October 29, 2026 00:24
@patbeqo
patbeqo force-pushed the claude-agent-sdk-samples branch from b5492bf to 7a09333 Compare October 29, 2026 00:55
Each sample now finishes its turn after its Worker stops mid-turn: it resumes
the session at the turn's prompt with resume_session_at and sends Claude Code's
own continue message, so a pending tool approval is asked again.

- Capture the prompt's UUID with replay-user-messages, as the Claude Agent SDK
  docs do, instead of CLAUDE_CODE_RESUME_INTERRUPTED_TURN.
- Drop the custom transport sample's guard, process wrapper and
  find_saved_turn Activity.
- Run each Worker with worker.run(), like the other AI integration samples.
- Describe Worker restarts once, in the samples README.
- Pin the plugin to the commit that supports this.
@patbeqo
patbeqo marked this pull request as ready for review October 30, 2026 21:42
@patbeqo
patbeqo requested review from a team as code owners October 30, 2026 21:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T21:47:43.747024Z 83e9e5d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83e9e5dbe4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@patbeqo
patbeqo enabled auto-merge (squash) October 30, 2026 22:14

@atol atol 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.

LGTM for Nexus changes.

@patbeqo
patbeqo disabled auto-merge October 31, 2026 21:28
@patbeqo
patbeqo enabled auto-merge (squash) November 2, 2026 18:52
@patbeqo
patbeqo merged commit ba07905 into main Nov 2, 2026
21 of 36 checks passed
@patbeqo
patbeqo deleted the claude-agent-sdk-samples branch November 2, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants