All docs

Script execution and member grants

Workspace admins can enable script execution for members: in chat the agent runs Python scripts in a skill to generate or edit downloadable Excel / Word / PPT. Permissions are plat

Source help/en/admin-ops/script-execution.md

Workspace admins can enable script execution for members: in chat the agent runs Python scripts in a skill to generate or edit downloadable Excel / Word / PPT. Permissions are platform, workspace, and member — similar to network requests.

What you can do

  • The agent runs scripts under the skill scripts/ directory (e.g. main.py)
  • Typical results: export .xlsx, generate .docx, make .pptx
  • To edit an existing Office attachment, also enable Office document read, and pass the source file in the script

Script logic is written in Skills Center; this page is who may run, not how to write Python.


Who can configure

RoleWhat they can do
Platform opsTurn on the platform master switch in mindlink.json (see Server configuration)
Workspace owner / adminEnable in Workspace collaborationAssistant capability packsScript execution, and grant each member separately
Ordinary memberSee whether they are granted; if not enabled they can submit a capability request

How to see whether it is allowed

Script execution needs platform, workspace, and member all satisfied before chat can run skill scripts. Check by role below.

Platform ops

In backend/mindlink.json (do not commit to Git):

"agent_script_tool": {
  "enabled": true,
  // ...
}
  • enabled is true and the backend was restarted after the change → platform layer allows
  • Env AGENT_SCRIPT_TOOL_ENABLED=1 also works (overrides JSON)
  • If the platform is off, no agent site-wide can run scripts, regardless of whether the workspace card says “enabled”

Details: Server configuration §3.11.

Workspace admin

  1. Open Workspace collaborationAssistant capability packs
  2. See Script execution card status: Not enabled / Expired / Enabled
  3. Click the card to open settings (same layout as Network requests):

- Top Enable switch → whether the workspace allows - Left Workspace settings → validity, prerequisite notes - Left Member script grants → each member follows the workspace, is forbidden, or has a per-member grant

If a member “workspace is on but still cannot use it”, open that member under Member script grants and see whether they are Forbidden, or whether the matching skill is ticked under Per-member grant.

Ordinary member

  1. Same Assistant capability packsScript execution card
  2. Click the card for details. Common prompts:

- Workspace not enabled or expired → you can submit a capability request - “This workspace has script execution enabled, but you are not yet authorized” → workspace on, person not granted - “You have a separate script-execution policy” → an admin configured you separately, possibly different from workspace default

  1. If the assistant in chat says it cannot run scripts, contact an admin per the table above, or see Common questions

Three-layer check (troubleshooting)

LayerWho configuresHow to check
PlatformOpsmindlink.jsonagent_script_tool.enabled
WorkspaceAdminAssistant capability packs → Script executionEnable + validity; Basic document tools must already be on
MemberAdminScript execution dialog → Member script grants → that member’s grant mode

Enable steps (admin)

1. Platform master switch

Ops in backend/mindlink.json (do not commit to Git):

"agent_script_tool": {
  "enabled": true,
  "timeout_sec": 60,
  "max_output_bytes": 10485760,
},

Then restart the backend. Env AGENT_SCRIPT_TOOL_ENABLED=1 also works (overrides JSON).

If the platform is off, no agent site-wide can run scripts, regardless of the workspace.

2. Workspace capability pack

  1. Open Workspace collaboration
  2. Open Assistant capability packs → card Script execution
  3. Turn Enable on, set validity as needed

Prerequisites:

  • Basic document tools must already be on (script products need to register as downloadable attachments)
  • To read or edit existing Word/Excel/PPT attachments, also enable Office document read

3. Member script grants

In the Script execution settings dialog, left Member script grants (same layout as Network requests member pairing: member list left, detail right):

  • Pick a member on the left, set grant mode on the right
Grant modeMeaning
Follow workspaceUsable once the workspace is enabled (default)
ForbiddenThis member cannot run scripts even if the workspace is on
Per-member grantTick skills they may run (the skill must declare scripts and contain scripts/*.py); tick all means no skill limit; you can also control whether ad-hoc scripts are allowed

Suggestions:

  • Most members: Follow workspace
  • HR, finance, and similar export-report roles: Per-member grant, tick only related skills (e.g. export Excel)
  • Allow ad-hoc scripts is off by default; turn on only in high-trust scenes

Relation to skills

The agent does not run arbitrary code; all of these must be true:

  1. The member is granted script execution
  2. Chat hit a workspace skill that has scripts
  3. The skill body has ## Script execution, or the skill notes declare executable scripts

When creating a skill in Skills Center, tap Describe to create and pick script-first; after generate, edit scripts/ in the left file tree.

Writing requirements: How to write workspace skills §8.4.


What members see

  • Granted: in chat they can ask the agent “export Excel per such-and-such skill”; on success they get a downloadable attachment
  • Workspace on but not granted: the capability-pack dialog or the assistant in chat says contact an admin to configure Script execution → Member script grants
  • Workspace not enabled: they can submit a request on the capability-pack page, or ask an admin to enable

Safety notes

  • Scripts run in a restricted environment on the server (timeout, output-size cap, no network-class statements, etc.)
  • Do not put secrets in scripts; talking to external systems still uses Network requests + Connection credentials
  • Allow ad-hoc scripts is higher risk; off by default

Backend Python and dependencies (ops)

Scripts run on the machine hosting the Cadau backend process (not the user’s browser).

  1. Install Python 3.10+ and make sure python or py -3 works on the command line.
  2. Optional: set MINDLINK_PYTHON to the interpreter absolute path (e.g. C:\Python312\python.exe).
  3. A skill may declare dependencies in scripts/requirements.txt; Cadau auto pip-installs allow-listed packages such as reportlab, pypdf, matplotlib, pillow into each run’s temp directory (.packages) — not the user’s local Python. .xlsx/.docx/.pptx/.pdf must not be produced by scripts; use office-document tools (office_document; PDF via build_pdf).
  4. Change scripts in chat: the agent can use skill_script_read / skill_script_write to update scripts/*.py (skill_update only changes the Markdown body); after change, run_script to verify; non-empty output_files counts as success.
  5. One-tap seed default skills (workspace admin): POST /api/v1/workspaces/{workspace-id}/seed-office-script-skills idempotently creates presentation (ppt-deck-builder, via OfficeCLI) and simple PDF script skills; locally also go run ./cmd/seed-office-skills -workspace <id>.
  6. Mainland networks: if auto-install reports ConnectionResetError / No matching distribution found, set a pip mirror in mindlink.json, e.g.:

``json "agent_script_tool": { "pip_index_url": "https://pypi.tuna.tsinghua.edu.cn/simple" } ` or env MINDLINK_PIP_INDEX_URL (system PIP_INDEX_URL` also works). Then restart the backend.

  1. Installing system software, changing PATH/registry still needs ops by hand; if the agent sees error_code=python_not_found it should tell the user, not pretend a file was generated.

Common questions

What you seeCheck first
Assistant says it cannot run scripts / has no related capabilityPlatform agent_script_tool.enabled; workspace Script execution enabled
Workspace on, one member still cannotIs that member Forbidden; or is the skill ticked under Per-member grant
Assistant says the skill did not declare scriptsDoes the skill have scripts/*.py and body ## Script execution
Script error module not found (exit 9009 / ModuleNotFoundError)Backend Python 3.10+ installed (Windows: python/py on PATH, or MINDLINK_PYTHON); Cadau auto pip installs allow-listed libs
pip install failed / ConnectionResetError / cannot reach PyPI from the mainlandSet agent_script_tool.pip_index_url or MINDLINK_PIP_INDEX_URL to a mainland mirror, restart backend
Cannot read a Word/Excel to editHas the workspace enabled Office document read
Can only export CSV, not xlsx/docx/pptx/pdfHas the workspace enabled Office document tools; is the assistant using office_document (PDF via build_pdf, not run_script)
Cannot export PDFOffice document tools on; server has a Chinese .ttf (or MINDLINK_CHAT_EXPORT_FONT)

Related docs