agent-native icon indicating copy to clipboard operation
agent-native copied to clipboard

Resource listing cannot paginate beyond the returned results

Open patt1s0n opened this issue 1 month ago • 2 comments

Summary

We use Agent Native in a system built around context and skills. The resource listing action cannot paginate through a directory's contents.

When a directory contains more entries than the action returns, the agent receives only part of the listing. There is no way to request the next page through the action.

For example, listing a large skills directory leaves some skills undiscoverable through resource listing.

Environment

  • System: Agent Native.
  • Affected surface: The resource listing action, including listings of directories containing skills.

Steps and observed behavior

  1. Use a resource directory containing more entries than a single listing returns.
  2. Ask the agent to list the resources in that directory.
  3. Ask it to retrieve the remaining entries.

The initial result contains only part of the directory. The action offers no pagination mechanism, so the agent cannot continue through the remaining entries.

Expected behavior

The resource listing action supports pagination. The agent can request subsequent pages until it has listed all entries in the directory.

Each response indicates whether more results remain and provides the information needed to retrieve the next page.

Impact

Agents cannot reliably discover all available resources in large directories. In a skills directory, this prevents them from finding relevant skills beyond the returned results.

patt1s0n avatar Nov 02 '26 15:11 patt1s0n

I reproduced this with 300 skills: the agent loses skills 158 to 300

I wrote one test that follows the steps in the issue:

  1. Add 300 skills for one user: skills/skill-001/SKILL.md to skills/skill-300/SKILL.md.
  2. List them with the agent's resources tool: action: "list", prefix: "skills/".
  3. List them again with limit: "50", offset: "50" and cursor: "2".
  4. Rebuild the chat history with that list in it, the way the app does when it resumes one stopped reply.

What happened:

Step Skills the agent gets Notes
2 300 of 300 All in one 22,889-character result. Nothing says there's more.
3 300 of 300 The page settings change nothing. Same result as step 2.
4 157 of 300 History keeps the first 12,000 characters. The list stops partway through skill-157.

Test run

Why:

  • The list action has no page option. packages/core/src/scripts/resources/list.ts accepts --prefix, --scope, --format and --include-agent-scratch, and returns the whole folder each time.
  • Chat history keeps 12,000 characters of each old tool result (packages/core/src/agent/thread-data-builder.ts:1291). The cut-off note tells the agent to list again. Listing again returns the same long result, so the agent can't get to the missing skills.

Where it happens

Not checked yet:

  • Normal follow-up replies. I confirmed the cut when the app resumes one stopped reply (resumeThreadHistoryForRequest). I haven't traced the normal path.
  • The first list call. The agent gets all 300 there. I found no limit on that path.

SmitMachhi avatar Nov 02 '26 19:11 SmitMachhi

Thanks for the report. resource-list now takes limit and offset, sorts by path, and every response includes the total, whether more results remain, and the next offset, so the agent can page through a whole directory. It's in review now: https://github.com/BuilderIO/agent-native/pull/8581

builderio-bot avatar Nov 02 '26 19:11 builderio-bot