Documentation Index
Fetch the complete documentation index at: https://docs.runtools.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Agents combine a model, instructions, tools, execution mode, and optional resources. You can create them in the dashboard, upsert them throughPOST /v1/agents, deploy them from agents/*.ts, and run them through the CLI, SDK, or REST API.
Define an Agent
agents/code-assistant.ts
Execution Modes
| Mode | Description |
|---|---|
in_sandbox | Default. The agent runs against one linked sandbox |
managed | The agent runs in the managed runtime and can attach workspaces or sandboxes as resources |
local-mac | The agent is bound to one registered RunMesh device |
in_sandbox, set sandbox to a sandbox slug from sandboxes/*.ts or an existing sandbox reference.
Filesystem Memory
When anin_sandbox agent needs durable storage, mount a workspace into the linked sandbox. The sandbox gives the agent an environment to run commands and use file tools; the workspace mount is the part of that environment that persists across agent runs and sandbox lifecycle changes.
sandboxes/dev-env.ts
agents/code-assistant.ts
/workspace during each run. Conversation threads preserve dialogue context; workspaces preserve repo files, artifacts, task notes, and other filesystem state.
For managed, use resources:
Run an Agent
Threads
Use threads for persisted conversations:rt.threads for listing cloud threads, reading event history, archiving, renaming, compacting, and subscribing to live frames.
Attachments
For file inputs, create an upload target and include the returned message part in the next run:Tools
Agents can use tool slugs from three sources:| Source | Example |
|---|---|
| Agent runtime tools | exec_command, write_stdin, apply_patch, view_image, web_search, get_dev_url |
| Marketplace tools | github, gmail, slack |
| Custom org tools | Any defineTool() deployed from your project |
Configuration
defineAgent() validates common model parameters:
| Field | Range |
|---|---|
maxIterations | 1-100 |
maxTokens | 1-128000 |
temperature | 0-2 |
topP | 0-1 |
presencePenalty / frequencyPenalty | -2 to 2 |
toolChoice | auto, none, required, or a specific tool |
providerOptions.
Best Practices
Keep agent definitions deployable
Keep agent definitions deployable
defineAgent() should contain serializable configuration. Put integration logic in tools.Prefer OAuth-connected tools
Prefer OAuth-connected tools
OAuth tokens are resolved by Runtools services, so agents do not need provider tokens in prompts or sandbox files.
Use threads for product chat
Use threads for product chat
Threads preserve context and expose live event streams for UI surfaces.