Execution Methods
The Skills Protocol provides two methods for executing code: execute_skill to run a skill's entrypoint, and run_code for LLM-written custom code.
execute_skill
Run a skill's entrypoint in an ephemeral sandbox.
Execute a skill's configured entrypoint function with provided arguments. The skill runs in an isolated sandbox with resource limits.
Request parameters
- Name
name- Type
- string
- Required
- required
- Description
Skill name (e.g.,
'salesforce.leads.sync')
- Name
args- Type
- object
- Description
JSON-serializable arguments to pass to the skill's entrypoint function
- Name
version- Type
- string
- Description
Specific skill version. If omitted, executes the latest version.
- Name
input_blobs- Type
- array
- Description
Array of blob IDs to mount in the sandbox
- Name
timeout_ms- Type
- integer
- Description
Maximum execution time in milliseconds. If omitted, uses runtime default.
Request
{
"jsonrpc": "2.0",
"id": "4",
"method": "execute_skill",
"params": {
"name": "salesforce.leads.sync",
"version": "0.1.0",
"args": {
"sheet_blob": "blob:sheet-123",
"env": "prod"
},
"input_blobs": ["blob:sheet-123"],
"timeout_ms": 300000
}
}
Response (Success)
{
"jsonrpc": "2.0",
"id": "4",
"result": {
"status": "completed",
"run_id": "run_9f2a",
"summary": "Synced 742 leads (5 failed).",
"output": {
"updated_count": 742,
"failed_count": 5
},
"output_blobs": [
"blob:sync-log-42",
"blob:failed-rows-1"
],
"logs_preview": "Connected to Salesforce...\nSynced 742 leads...\n"
}
}
Response (Failed)
{
"jsonrpc": "2.0",
"id": "4",
"result": {
"status": "failed",
"run_id": "run_9f2a",
"summary": "Invalid credentials.",
"error": {
"type": "AuthenticationError",
"message": "Invalid Salesforce API key"
},
"logs_preview": "Connecting to Salesforce...\nAuth failed...\n"
}
}
Execution flow
- Runtime loads the skill's entrypoint module
- Creates an isolated sandbox with resource limits
- Mounts specified blobs and skills
- Calls the
exportfunction with the providedargs - Captures return value, stdout, stderr, and any created blobs
- Tears down the sandbox
Output requirements
outputMUST be kept small (≤ 4KB serialized). Larger data MUST be written to blobs.logs_previewSHOULD be truncated to ≤ 2KB.
run_code
Execute LLM-written code in a sandbox with mounted skills and blobs.
Executes custom Python code in an isolated sandbox. Skills and blobs can be mounted and imported as modules.
Request parameters
- Name
language- Type
- string
- Required
- required
- Description
Programming language. MVP:
"python"only.
- Name
code- Type
- string
- Required
- required
- Description
Python source code to execute
- Name
entrypoint- Type
- string
- Description
Function name to call (default:
"main")
- Name
args- Type
- object
- Description
Arguments to pass to the entrypoint function
- Name
mount_skills- Type
- array
- Description
Skill names to mount in sandbox (importable as modules)
- Name
input_blobs- Type
- array
- Description
Blob IDs to mount in sandbox
- Name
limits- Type
- object
- Description
Execution limits (e.g.,
timeout_ms)
Request
{
"jsonrpc": "2.0",
"id": "5",
"method": "run_code",
"params": {
"language": "python",
"code": "from skills.salesforce.leads.sync import sync_leads\nfrom runtime import blobs\n\ndef main(args):\n data = blobs.read_text(args['sheet_blob'])\n result = sync_leads(data, env='prod')\n return result",
"entrypoint": "main",
"args": {
"sheet_blob": "blob:sheet-123"
},
"mount_skills": [
"salesforce.leads.sync"
],
"input_blobs": [
"blob:sheet-123"
],
"limits": {
"timeout_ms": 300000
}
}
}
Response
{
"jsonrpc": "2.0",
"id": "5",
"result": {
"status": "completed",
"run_id": "run_abcd",
"summary": "Processed and synced 142 leads.",
"output": {
"synced": 142,
"failed": 0
},
"output_blobs": [
"blob:sync-log-42"
],
"logs_preview": "Starting sync...\nProcessed 142 records...\n"
}
}
Execution flow
- Runtime creates a fresh sandbox
- Mounts requested skills and blobs
- Saves the code as a temporary module
- Imports the module and calls the entrypoint function with
args - Captures return value, logs, and created blobs
- Tears down the sandbox
Available imports
Code can import:
- Mounted skills:
from skills.<name> import <function> - Runtime helpers:
from runtime import blobs, log
Runtime helpers
blobs module
blobs.read_text(blob_id: str) -> str
blobs.write_text(content: str) -> str
blobs.write_json(obj: dict) -> str
log module
log.info(msg: str)
log.error(msg: str)
Response format
Both methods return the same response structure on success:
- Name
status- Type
- string
- Required
- required
- Description
Either
"completed"or"failed"
- Name
run_id- Type
- string
- Required
- required
- Description
Unique stable identifier for this execution
- Name
summary- Type
- string
- Required
- required
- Description
Human-readable description of the result
- Name
output- Type
- object
- Description
Small JSON output (max 4KB). For larger data, use
output_blobs.
- Name
output_blobs- Type
- array
- Description
Array of blob IDs created during execution
- Name
logs_preview- Type
- string
- Description
Preview of captured stdout/stderr (typically max 2KB)
- Name
error- Type
- object
- Description
Only present if
statusis "failed". Containstypeandmessagefields.
Error handling
There are two types of errors:
Protocol-level errors (RPC error)
{
"jsonrpc": "2.0",
"id": "5",
"error": {
"code": -32602,
"message": "Invalid params"
}
}
Examples:
- Invalid method name
- Missing required parameters
- Skill not found
- Authorization failure
Execution-level errors (in result)
{
"jsonrpc": "2.0",
"id": "5",
"result": {
"status": "failed",
"run_id": "run_9f2a",
"summary": "Skill execution failed.",
"error": {
"type": "RuntimeError",
"message": "Traceback...: Invalid API key"
}
}
}
Examples:
- Skill code raises an exception
- Timeout exceeded
- Validation error in skill arguments
Always check result.status before assuming success, even if the HTTP response is 200 OK.
Limitations
Output size
outputfield: max 4KB after serializationlogs_preview: typically max 2KB- Larger data MUST be written to blobs using
runtime.blobs.write_text()orcreate_blob
Execution time
- Default timeout: runtime-specific (typically 5-10 minutes)
- Can be overridden with
timeout_msparameter - Execution is terminated if timeout is exceeded
Resource constraints
Sandboxes enforce:
- CPU limits
- Memory limits
- Network restrictions (based on skill permissions)
- No filesystem access outside
/workspace/