Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Code mode guide for AI agents

These instructions teach an AI agent to use read-only code mode well: when a script is worth it, how to find the right tools, and how to report results it couldn't finish. The instructions guide the agent; Stackyapper permissions still decide what it can read.

Give the instructions to your agent

  • Share this page's link with the agent, or paste the block below into its project or custom instructions.
  • In the portal, open Skills and choose Platform to find the built-in code-mode skill. Agents can discover and read it through Stackyapper's skill tools unless a workspace admin has turned it off. Reading the skill does not enable code mode execution.
  • If your workspace allows personal skills, customize the instructions by saving the block as SKILL.md. In the portal, open Skills, choose Import, pick the file, and save it under General. It becomes your personal skill; to offer it to everyone, choose Share with the workspace so an admin can review it.
  • If your workspace renamed its AI tools, your agent sees your prefix instead of stackyapper_. The instructions work the same way.

Instructions

--- name: code-mode-reads description: Decide when to use read-only code mode (the run-code tool, stackyapper_run_code unless renamed) and write scripts that discover tools first, page within the limits, return small summaries, and report failed or incomplete sources. Use for questions that need several reads, paging, or results from more than one app. --- # Read-only code mode Code mode runs a short JavaScript script that calls read tools and returns one result. Prefer it for multi-page API reads, repeated lookups, and aggregation. If the client defers loading tools, load the advertised run-code tool or search for `stackyapper_run_code` without an app filter, then obtain its schema. If it remains unavailable, use authorized direct reads and report the limitation. Ask the user to refresh or reconnect the AI client if they expect access. Code mode reduces agent round trips; it still makes the provider API calls. Do not choose a warehouse merely because an API query needs many pages. Use it when requested, when it holds required history, or when the API cannot supply the authorized scope, and state the source used. Platform names here are suffixes: find `_run_code`, `search_tools`, `get_tool_schemas`, and `list_connections` under the actual prefix in your tool list. ## Choose the right tool - One lookup, such as one ticket, user, or device: call the read tool directly. - Several reads, paging, counting, grouping, or comparing apps: use code mode. - Creating, changing, or deleting anything, or a read that asks for confirmation: use the normal tools. Scripts are read-only and cannot confirm. ## Discover before you call 1. Find tools by describing the whole task with the search tool. To save script calls, search and read schemas with the normal tools first, then write the script with the exact names. Inside a script, use `tools.search({ query })`. For a known action, search its exact name. If a search page has `next_continuation`, pass it as `continuation` with the same query and filters, even after an empty page. Counts describe the current page's search window. Use continuation for Forge; `offset` applies only to initial local search results. 2. Read exact arguments with the schema tool or `tools.schemas({ tool_names })`. Never guess a tool name or argument. 3. If an app has more than one connection, list them with `tools.connections({ service })` and pass `connection_id`. 4. Before multi-step work in an app, list and read that app's skills when the skill tools are available. If they are absent from the client's tool list, discover their schemas and use the read executor. If discovery does not offer them, continue with the authorized action schemas. Skills are guidance only and never grant access. Access is checked again on every call. A tool that worked earlier can be unavailable now, so handle `tool_unavailable` in every run. ## Write the script - Write the body of an async function. `await` every `tools` call and end with `return`. You can await independent calls with `Promise.all`; at most two calls run at once and share the run limits. Fetch dependent pages sequentially. - Every discovery/read call counts toward the 12-call limit when created, including queued calls. Creating a 13th call stops the run and withholds its result. Cap lists before mapping them to calls. - Every call returns `{ ok: true, data }` or `{ ok: false, error: { code, message, retryable } }`. Branch on `ok`. A failed source is unavailable, not empty and not zero. - Page with the continuation the schema names, such as `next_page_token`, `next_cursor`, or a page number. Decide a page cap before the loop. If you stop before the last page, return `complete: false`, the number of pages read, and the next safe continuation. Resume in another run within the requested scope and budget, keeping filters, connection, and aggregate state. Claim completeness only when the operation-specific completion condition is met. - Await `tools.budget()` before another page. Its data has `calls_remaining`, `read_bytes_remaining`, and `time_remaining_ms` (excluding the finish reserve). At most 32 checks are allowed per run. A check uses no discovery/read call slot, but its response uses read bytes. Await outstanding calls first. This is a snapshot, not a reservation; keep explicit page/task caps and leave room for the next response. - Return `resume` as a small object containing query scope, selected connection, provider cursor and cumulative summary. Pass the response's whole `continuation: {version:1,workspace_id,state}` envelope into the next run-code call's `continuation` argument. Its state is available as `input` (null for a fresh run). Compare saved scope with requested scope before reading; changed filters or connection require a fresh task. Resume the cumulative total; never add it to previous totals again. The envelope is caller-held, untrusted, workspace-scoped, at most 32 KiB, never saved, and grants no authority. Oversized checkpoints or truncated results produce no new continuation; preserve the last valid checkpoint and narrow the query. Never use a cursor extracted from incomplete JSON. Read the platform skill's task-recipes reference for paging, reconciliation and cross-app summaries. - For existing app recipes, copy resume state as JSON and restore it with `JSON.parse`; do not paste it as a JavaScript object literal. Preserve grouping keys and filters exactly. The built-in ConnectWise and NinjaOne recipes keep source completeness unverified even after traversal finishes. NinjaOne retains at most 5,000 device IDs for overlap checks. Both recipes stop before a 60,000-byte output; a hard state cap requires a fresh run with a narrower authorized scope. - Ask for only the fields and page sizes you need. - Return counts, groups, and a few record IDs, not raw records. - Match records across apps only on a shared identifier. Similar names do not prove two records are the same company, person, or device. - A `read_limit` error means Stackyapper withheld that result because the run would exceed its 1 MiB read limit. Return what you have and mark it incomplete. - A `tool_call_busy` error means earlier requests still occupy both slots, including timed-out requests that have not settled. Report the unavailable source and return what you have. ## Limits per run - 12 tool calls, including search, schema, and connection calls - At most two independent tool calls at once - 20 seconds per tool call and 30 seconds per run - 1 MiB of tool results read - 64 KiB returned; larger results are truncated - 16 KiB of script and 32 KiB of continuation - 500 runs per workspace per UTC day, and two runs at a time Scripts have no network access, files, packages, timers, storage, or credentials, and they cannot write to any app. ## Report what happened - Say which apps and connections you checked, which failed, and their error codes. - Return one `sources` entry per requested app with source, status, pages_read, records_examined and reason. Use complete only with established scope and provider completion; partial for known omissions, unavailable for failed reads and unknown when completeness cannot be established. These are script observations, not a guarantee made by Stackyapper. - Say whether each number is complete. Never describe a capped or partial result as the full total. - If the result was truncated, say so and run again with a smaller summary. Do not present the preview as complete. - If a run stops, read the reason before running again. Calls that finished before the stop already happened, and every run counts toward the daily limit. ## Dashboards and saved artifacts A successful run returns `artifact_handoff`, with suggested tool bindings and schema signatures for building a dashboard. It holds no app data, is not saved, and is not a live data source. To save a dashboard, follow the artifact authoring skill: declare the bindings, validate the artifact, then save it.

What the instructions don't do

Instructions shape how an agent works. They don't grant access or raise a limit. Not every connected app offers read tools to every person, so an agent may find that some apps have nothing it can read. To ask about code mode access, contact support.