Skip to content

Conversation

@ryanbonial
Copy link
Member

@ryanbonial ryanbonial commented Oct 27, 2025

Description

Added Agent Actions API to the Sanity SDK, exposing five key agent functions:

  • agentGenerate: Generates content for documents or specific fields
  • agentTransform: Transforms existing documents or fields
  • agentTranslate: Translates documents or fields between languages
  • agentPrompt: Prompts the LLM using instruction templates
  • agentPatch: Performs schema-aware document patching

These functions are exposed both in the core package and as React hooks in the React package, allowing developers to leverage AI capabilities within Sanity applications.

What to review

  • Implementation of agent action functions in packages/core/src/agent/agentActions.ts
  • Type definitions for all agent action parameters and results
  • React hooks implementation in packages/react/src/hooks/agent/agentActions.ts
  • Test coverage for the agent actions
  • API version handling for agent requests
  • Public (alpha) exports in both core and React packages

Testing

Added comprehensive unit tests for all agent actions in agentActions.test.ts, covering:

  • Observable return values from client methods
  • Proper parameter passing to client methods
  • Promise-to-Observable conversion for non-observable client methods

Fun gif

agents

@vercel
Copy link

vercel bot commented Oct 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sdk-docs Ready Ready Preview Comment Oct 28, 2025 10:06pm
sdk-kitchensink-react Ready Ready Preview Comment Oct 28, 2025 10:06pm

Copy link
Contributor

@laurenashpole laurenashpole left a comment

Choose a reason for hiding this comment

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

Not sure if you want a second pair of eyes from someone more familiar with our existing code and patterns but, if not, everything looks good to me!

I did one into an issue testing generating a document in Kitchen Sink but it could be one of the permissions errors I occasionally hit (the message was Not Found - Schema for schemaId '_.schemas.default' could not be not found.).

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