Docs / data / library-import-analyze

library-import-analyze

recipesince 0.2.8

Import a workspace library item (dataset, report, document, visualization) into the app's agent and analyze it

Plane: artifact · Requires: capability data_access

Steps: 1. casino_list_library — Discover importable items (report | visualization | document | dataset) in the owner's workspace library. 2. casino_import_from_library — Copy the item into the site agent's workspace so builds and agent runs can reference it. 3. casino_talk_to_agent — Pass the imported file in file_refs and instruct the agent to persist its analysis into a collection. 4. useCollection — The app reads the analysis collection reactively — the imported file itself never ships to the browser.

Examples

End-to-end example
// Build-time (MCP path — Claude driving the casino tools):
// 1. casino_list_library({ item_type: "dataset" })
// 2. casino_import_from_library({ site_id, item_id })
// 3. casino_talk_to_agent({
//      site_id,
//      agent_name: "analyst",
//      message: "Analyze the imported sales dataset; insert one doc per finding into " +
//               "findings: {title, detail, metric, created_at (ISO)}.",
//      file_refs: ["sales_2026.csv"],
//    })
//
// App-side read (tsx):
// const { documents } = useCollection('findings', {
//   sort: { created_at: -1 },
//   refreshOnAgentComplete: true,
// });
WarningImport copies the item into the SITE's agent workspace — the app cannot read library items directly.
WarningAlways persist analysis into a collection; file_refs content is visible to the agent run only.
WarningLibrary items are owner-scoped: end users see derived collection docs, never the raw file.

See also

reason-write-read · casino_list_library · casino_import_from_library · casino_talk_to_agent · useCollection

Source: sync-recipes.mjs ← https://sage-api.flowstack.fun/recipes.json · Also available in llms-full.txt and registry.json.