Skip to content

feat(claude-code): add a claude code agent integration - #5907

Open
octopols wants to merge 7 commits into
rivet-dev:mainfrom
octopols:octopols/claude-code
Open

octopols wants to merge 7 commits into
rivet-dev:mainfrom
octopols:octopols/claude-code

Conversation

@octopols

Copy link
Copy Markdown
  • Adds @rivet-dev/claude-code, which runs Claude Code agents as Rivet Actors under the user's own Claude Code login, so no API key is needed
  • claudeCodeAgent keeps one persistent Claude Code session per actor, stores every turn in actor state and broadcasts it as a turn event
  • runClaudeCode runs Claude Code once and validates structured output against a Zod schema
  • Adds a claude-code-research example: a coordinator plans sub-questions, researcher agents investigate them in parallel, and the coordinator writes a sourced report
  • Tests run against a fake claude executable, so they need no Claude account

Comment thread integrations/claude-code/src/run.ts Outdated
const executable = request.executable ?? defaultExecutable();

return new Promise((resolve, reject) => {
const child = spawn(executable.command, [...executable.args, ...args], {

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.

I think at this point, would be just easier to use Claude's SDK which is preffered way to work with Claude as part of the subscription. btw Claude now adds api credits to any paid account

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

agreed on the sdk, will switch to it. that should be fine policy-wise, since each user signs in to claude code with their own subscription and uses it for themselves, and we never handle their login or tokens:
https://code.claude.com/docs/en/legal-and-compliance#authentication-and-credential-use

not sure about the credits though, from what I can find only max gets api credits, pro doesn't. pro users are who I built this for, so it'll keep using their own claude code login.

@octopols
octopols requested a review from jog1t October 20, 2026 21:05
@octopols

Copy link
Copy Markdown
Author

@jog1t switched it to the agent sdk.

  • runs through @anthropic-ai/claude-agent-sdk instead of spawning the cli, same public api
  • agents only get the tools they list, everything else is denied, and they don't load the user's settings or CLAUDE.md
  • executable is now claudeCodePath, defaults to the claude code the sdk bundles
  • tests run the real sdk against a fake claude code process, no claude account needed
  • cleaned up the example and replaced type casts with typed state

still runs on the user's own claude code login, checked it on a pro plan with no api key.

This branch has not been deployed

No deployments
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.

2 participants