### Install and Run Space Agent Server Source: https://github.com/agent0ai/space-agent/blob/main/README.md Clone the repository, install dependencies, create an admin user, and start the server. ```bash git clone https://github.com/agent0ai/space-agent.git cd space-agent npm install # create yourself an admin node space user create admin --password "change-me-now" --full-name "Admin" --groups _admin # start the server node space serve ``` -------------------------------- ### Self-Hosted Server Quick Start Source: https://github.com/agent0ai/space-agent/blob/main/server/pages/llms-full.txt Installs and starts a self-hosted Space Agent server. Requires Node.js and npm. Creates an initial admin user. ```bash git clone https://github.com/agent0ai/space-agent.git cd space-agent npm install node space user create admin --password "change-me-now" --full-name "Admin" --groups _admin node space serve ``` -------------------------------- ### File Writing API Example Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/004_direct_recovery.md Demonstrates writing content to a file using `space.api.fileWrite`. This example includes error handling and shows how to create directories if they don't exist. ```javascript try { const content = await space.api.fileWrite("L2/alice/data/new_file.txt", "hello world") return content } catch (e) { return e } ``` -------------------------------- ### Example Panel Manifest Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/skillset/ext/skills/development/modules-routing/SKILL.md An example YAML configuration file for a dashboard panel, specifying its name, path, description, icon, and color. ```yaml name: My Tool path: my_tool description: A custom routed tool page. icon: build color: "#94bcff" ``` -------------------------------- ### Example Staging Sequence with JavaScript Execution Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/onscreen_agent/prompts/system-prompt.backup-before-012-open_goal_momentum-2026-04-06.md Demonstrates the correct format for a staging sequence that includes JavaScript execution. The sequence must start with a description of the action, followed by the JavaScript code block marked with '_____javascript'. ```text Checking the time now... _____javascript return new Date().toString() ``` -------------------------------- ### Get Current Attachments Example Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/004_direct_recovery.md Demonstrates how to get attachments associated with the current context using `space.chat.attachments.current()`. ```javascript try { const attachments = await space.chat.attachments.current() return attachments } catch (e) { return e } ``` -------------------------------- ### Initialize Navigation Links and Intro Animation Source: https://github.com/agent0ai/space-agent/blob/main/server/pages/enter.html Sets up navigation links for the main app and admin targets, and starts the intro float animation. ```javascript const nextTarget = normalizeLocalTarget(new URLSearchParams(window.location.search).get("next")); bindLauncherLink(introEnterSpaceLink, buildAppTarget(nextTarget)); bindLauncherLink(introAdminLink, buildAdminTarget(nextTarget)); if (introAstronaut && !introAstronaut.complete) { introAstronaut.addEventListener("load", startIntroFloat, { once: true }); } else { startIntroFloat(); } })(); ``` -------------------------------- ### Example Module Paths Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/documentation/docs/app/modules-and-extensions.md Provides concrete examples of module paths used within the application. These paths correspond to specific files like HTML views or JavaScript initializers. ```txt /mod/_core/agent/view.html ``` ```txt /mod/_core/framework/js/initFw.js ``` ```txt /mod/_core/router/view.html ``` ```txt /mod/_core/documentation/documentation.js ``` ```txt /mod/_core/file_explorer/view.html ``` ```txt /mod/_core/huggingface/view.html ``` ```txt /mod/_core/webllm/view.html ``` -------------------------------- ### Utility Example: Getting a Specific Attachment Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/027C_reset_fire_finish_ask.md Use the utility function to get details of a specific attachment by its ID. This allows direct access to a particular file or media. ```javascript const attachment = space.chat.attachments.get(attachmentId) ``` -------------------------------- ### Utility Example: Getting Current Chat Attachments Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/027C_reset_fire_finish_ask.md Use the utility function to get attachments associated with the current chat context. This can provide access to files or other media. ```javascript const attachments = space.chat.attachments.current() ``` -------------------------------- ### File Listing API Example Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/004_direct_recovery.md Demonstrates how to use the `space.api.fileList` function to list files. It shows basic usage and how to handle potential errors with a try-catch block. ```javascript try { const files = await space.api.fileList("L2/alice/data/") return files } catch (e) { return e } ``` -------------------------------- ### Fire Turn Example: Listing Files Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/027C_reset_fire_finish_ask.md Use the 'fire' turn type to list files within a directory. This example recursively lists files starting from the application root. Specify the path and whether to recurse. ```javascript line 1 short staging sentence _____javascript return await space.api.fileList("/app/L2/alice/", true) ``` -------------------------------- ### Trace: Ready Live Answer Example Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/onscreen_agent/prompts/system-prompt.backup-before-086A-082A-no-half-thrust-onboarding-2026-04-13.md Describes the scenario where the framework already contains the requested live fact, allowing the assistant to answer directly. ```text ready live answer - _____framework already contains the requested live fact in usable form - assistant answers with that fact and stops ``` -------------------------------- ### Get Specific Attachment by ID Example Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/004_direct_recovery.md Demonstrates how to fetch a specific attachment using its unique ID with `space.chat.attachments.get(attachmentId)`. ```javascript try { const attachment = await space.chat.attachments.get("attachment_id_456") return attachment } catch (e) { return e } ``` -------------------------------- ### Get Attachments for a Specific Message Example Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/004_direct_recovery.md Shows how to retrieve attachments linked to a particular message ID using `space.chat.attachments.forMessage(messageId)`. ```javascript try { const attachments = await space.chat.attachments.forMessage("message_id_123") return attachments } catch (e) { return e } ``` -------------------------------- ### Trace: Exact Run Example Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/onscreen_agent/prompts/system-prompt.backup-before-086A-082A-no-half-thrust-onboarding-2026-04-13.md Illustrates the interaction flow for executing code exactly as requested by the user. ```text exact run - _____user asks to run code exactly - assistant runs it - _____framework execution success with no result or with text like continue or run again - assistant Done. ``` -------------------------------- ### space.onscreenAgent.submitExamplePrompt Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/onscreen_agent/AGENTS.md A guarded variant for spaces and launchers that submits an example prompt. It opens the overlay, avoids queuing into a busy send loop, displays specific messages for LLM configuration warnings or ongoing work, and preserves the display mode unless a specific mode is requested. ```APIDOC ## space.onscreenAgent.submitExamplePrompt ### Description A guarded variant for spaces and launchers that submits an example prompt. It opens the overlay, avoids queuing into a busy send loop, displays specific messages for LLM configuration warnings or ongoing work, and preserves the display mode unless a specific mode is requested. ### Method `submitExamplePrompt(promptText, options?)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **promptText** (string) - Required - The text of the example prompt to be submitted. * **options** (object) - Optional - Configuration options for submitting the example prompt. Can include `mode` to explicitly request 'compact' or 'full' display. ### Request Example ```json { "example": "space.onscreenAgent.submitExamplePrompt('Explain quantum physics.')" } ``` ### Response #### Success Response (200) This method does not return a value, but triggers the display of the onscreen agent overlay and submission of the example prompt under specific conditions. #### Response Example None ``` -------------------------------- ### Get Transient Message by Key Example Source: https://github.com/agent0ai/space-agent/blob/main/tests/agent_llm_performance/prompts/004_direct_recovery.md Shows how to retrieve a specific transient message by its key using `space.chat.transient.get(key)`. This allows access to individual temporary messages. ```javascript try { const message = await space.chat.transient.get("some_key") return message } catch (e) { return e } ``` -------------------------------- ### Panel Helper Script Usage Example Source: https://github.com/agent0ai/space-agent/blob/main/app/L0/_all/mod/_core/skillset/ext/skills/development/modules-routing/SKILL.md Demonstrates how to use panel helper functions to list all panels, find a specific panel, and navigate to it. ```javascript const panelTools = await import("/mod/_core/skillset/ext/skills/development/modules-routing/panel-tools.js"); const panels = await panelTools.listPanels(); const userPanel = await panelTools.findPanel("/mod/_core/user/view.html"); await panelTools.goToPanel(userPanel ?? "user"); ```