Agent SDK
@rozenite/agent-sdk is the programmatic version of rozenite agent for Node.js and TypeScript scripts. Use it when you want to write a script, automation, or agent runtime that talks to a running app through Rozenite directly from code.
For most debugging workflows, start with the rozenite agent CLI and the rozenite-agent skill. Reach for the SDK when you want code instead of shell commands, and install rozenite-agent-sdk if you want your coding agent to follow that SDK-first workflow directly.
Rozenite for Agents is experimental and may change. If you run into a bug, please open an issue.
Before you start
Make sure:
- Node.js 20 or newer
- your app is running in development mode
- Metro is running and reachable
- at least one React Native target is connected
Install
Install the SDK as a dependency:
The happy path
Most scripts use the same flow:
- Create a client with
createAgentClient(). - Open a short-lived session with
client.withSession(...). - Inspect the available domains and tools.
- Call the tool you need.
Your first script
Start with a script that opens a session and lists the domains currently available on the device:
withSession(...) opens the session and closes it automatically when your callback finishes.
The next step is to inspect one domain more closely and then call one of its tools.
Inspecting domains and tools
Inside a session, you can use these helpers:
session.domains.list()to see which domains are available on the connected appsession.tools.list({ domain })to see the tools inside one domainsession.tools.getSchema({ domain, tool })to inspect a tool's input schema before calling it
For example, you can inspect the network domain like this:
Once you know what you want to call, use session.tools.call(...).
Calling tools
There are two common ways to call a tool.
Call by name
Use this form when you already know the domain and tool name, or when you just looked them up with session.tools.list(...).
If you want a typed result, pass type arguments to session.tools.call(...).
If you do not pass type arguments, the result is unknown.
Typed calls with plugin SDKs
Official agent-enabled plugins publish ready-made typed tool descriptors under ./sdk. Use those when you want the plugin package to provide the tool name, argument type, and result type for you.
Today that includes:
@rozenite/controls-plugin/sdk@rozenite/file-system-plugin/sdk@rozenite/mmkv-plugin/sdk@rozenite/network-activity-plugin/sdk@rozenite/react-navigation-plugin/sdk@rozenite/redux-devtools-plugin/sdk@rozenite/storage-plugin/sdk@rozenite/tanstack-query-plugin/sdk
Prefer the built-in network domain when it is available. Reach for @rozenite/network-activity-plugin/sdk when you need the typed fallback plugin surface on apps where the built-in network domain is missing or unavailable.
If a plugin only mounts after you navigate to one of its screens, do that first and then refresh the session view with session.domains.list() or session.tools.list(...) before calling its tools.
Pagination
Some tools return paged results. When you want the SDK to keep following cursors for you and merge the pages into one result, pass autoPaginate to session.tools.call(...).
Use pagesLimit to control how many pages the SDK should follow. If you also want to cap the merged result size, add maxItems.
Choosing a target
If only one target is connected, withSession(...) is usually enough.
If more than one target is connected, list them first and pass deviceId when opening the session:
Managing sessions
- Use
withSession(...)for short scripts and one-off tasks. It handles setup and cleanup for you. - Use
openSession()when the session needs to stay open across multiple independent steps or function boundaries. - Use
attachSession(sessionId)when you need to reconnect to an already-existing session instead of creating a new one.
When you do need manual control, remember to stop the session yourself:
If you already have a sessionId, you can reconnect like this:
Next steps
- Rozenite for Agents – how agents use domains and tools
- Adding tools to your application – expose app-owned tools under the
appdomain - Plugin Development – general plugin structure and React Native integration
