Skip to content

Feat/agents sdk#222

Open
manapard wants to merge 4 commits intocallstackincubator:mainfrom
manapard:feat/agents-sdk
Open

Feat/agents sdk#222
manapard wants to merge 4 commits intocallstackincubator:mainfrom
manapard:feat/agents-sdk

Conversation

@manapard
Copy link
Copy Markdown

@manapard manapard commented Apr 9, 2026

Description

Introduces @rozenite/agent-sdk, a new SDK for programmatic use of Rozenite agent sessions and tools.

The existing rozenite agent CLI is refactored to use the SDK internally and extracted reusable agent logic from the CLI into the SDK:

  • HTTP transport
  • static/runtime domain discovery
  • domain and tool resolution
  • optional tool auto-pagination

Also added website docs for the new Agent SDK.

Related Issue

Context

Testing

@manapard manapard marked this pull request as ready for review April 9, 2026 12:13
domain: string;
tool: string;
}) => Promise<AgentToolSchema>;
callTool: (input: {
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.

We can make it generic <TArgs, TResult>, so it's easier to provide types later on.

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 wonder if there's a way to safely expose tools from plugins without bringing in any JavaScript or third-party packages. We'd probably need a separate entry point, like @rozenite/storage-plugin/sdk

"type": "git",
"url": "https://github.com/callstackincubator/rozenite.git"
},
"author": "Szymon Chmal <szymon.chmal@callstack.com>",
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'm not an author 😛 Feel free to put yourself here!

@V3RON
Copy link
Copy Markdown
Contributor

V3RON commented Apr 10, 2026

1. High: packages/agent-sdk/src/pagination.ts:88-100,128-129
   maxItems is not enforced on the first page.
   The helper seeds merged.items with all of initial.items before any truncation logic runs, and only trims subsequent pages. If the first response already exceeds maxItems, the SDK returns too many items.
   Validation:
   packages/middleware/src/agent/runtime/pagination/paginate.ts:81-89 and packages/network-activity-plugin/src/react-native/agent/state.ts:199-205 show paged tools may legitimately return up to the requested page limit on page 1, so the SDK must enforce its own client-side cap consistently.
   Test gap:
   packages/agent-sdk/src/__tests__/pagination.test.ts:50-77 only covers truncation after fetching page 2, not an oversized first page.
   
2. Medium: packages/agent-sdk/src/pagination.ts:117-124
   hasMore can become incorrect when maxItems truncates the merged result.
   After truncating, the code unconditionally sets merged.page.hasMore = true. If the last fetched page actually had hasMore: false and no nextCursor, the SDK returns pagination metadata that implies another page exists when it does not.
   Validation:
   The shared pagination contract in packages/middleware/src/agent/runtime/pagination/types.ts:9-20 and implementation in packages/middleware/src/agent/runtime/pagination/paginate.ts:69-89 show hasMore and nextCursor are coupled server facts. Fabricating hasMore: true client-side can produce an impossible state.
   Test gap:
   No test covers truncation on a terminal page.

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