Spaces:
Runtime error
Runtime error
File size: 20,152 Bytes
857a91b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | openapi: 3.0.3
info:
title: Matrix Runtime API
description: |
Execution plane for Matrix Cloud. Runs MCP sandboxes, inspects Hugging Face
models and (in future) agents/tools. Sandboxes are a thin alias over jobs of
type mcp.test.
version: 0.2.0
servers:
- url: http://localhost:8080
description: Local
security:
- bearerAuth: []
- {}
paths:
/v1/health:
get:
summary: Liveness and identity
security: []
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
status: { type: string, example: ok }
runtime_id: { type: string, example: rt_local }
mode: { type: string, example: local-dev }
version: { type: string, example: 0.1.0 }
/v1/capabilities:
get:
summary: Runtime capabilities and limits
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Capabilities"
/v1/ready:
get:
summary: Readiness probe (checks + warnings)
security: []
responses:
"200": { description: Ready }
"503": { description: Not ready (a core check failed) }
/v1/version:
get:
summary: Build and version metadata
security: []
responses:
"200": { description: OK }
/v1/system/storage:
get:
summary: Data-directory storage usage and free disk
responses:
"200": { description: OK }
/v1/policies:
get:
summary: Enforced guardrails (limits + command allow/deny lists)
responses:
"200": { description: OK }
/v1/runtimes:
get:
summary: Runtimes connected to this control surface
responses:
"200": { description: OK }
/v1/catalog:
get:
summary: Curated catalog of MCP servers and models
responses:
"200": { description: OK }
/v1/auth/forgot:
post:
summary: Request a password-reset email (always 200)
security: []
responses:
"200": { description: OK }
/v1/auth/reset:
post:
summary: Set a new password from a reset token
security: []
responses:
"200": { description: OK }
"400": { description: Invalid or expired token }
/v1/auth/verify:
post:
summary: Confirm an email-verification token
security: []
responses:
"200": { description: OK }
/v1/matrixshell/status:
get:
summary: MatrixShell install status (403 when disabled)
responses:
"200": { description: OK }
"403": { description: MatrixShell disabled }
/v1/matrixshell/install:
post:
summary: Install MatrixShell into the local sandbox (job)
responses:
"202": { description: Job accepted }
"403": { description: MatrixShell disabled }
/v1/matrixshell/exec:
post:
summary: Run a command in the MatrixShell sandbox (denylisted)
responses:
"200": { description: OK }
"403": { description: Disabled or blocked by denylist }
/v1/cloud/runtimes:
get:
summary: List the workspace's registered runtimes
responses:
"200": { description: OK }
/v1/cloud/runtimes/register:
post:
summary: Register a runtime using a workspace join token
security: []
responses:
"201": { description: Registered (returns a runtime token) }
"401": { description: Invalid join token }
/v1/cloud/runtimes/heartbeat:
post:
summary: Runtime liveness heartbeat (runtime-token auth)
security: []
responses:
"200": { description: OK }
"401": { description: Invalid runtime token }
/v1/cloud/join-tokens:
get:
summary: List active join tokens
responses:
"200": { description: OK }
post:
summary: Mint a single/limited-use join token
responses:
"201": { description: Created (secret shown once) }
/v1/cloud/providers:
get:
summary: List BYO provider credentials (hints only)
responses:
"200": { description: OK }
post:
summary: Store a BYO provider token (encrypted at rest)
responses:
"201": { description: Created }
/v1/cloud/usage:
get:
summary: 30-day usage metering by kind
responses:
"200": { description: OK }
/v1/cloud/audit:
get:
summary: Recent audit events for the workspace
responses:
"200": { description: OK }
/v1/auth/signup:
post:
summary: Create a workspace + owner account (multitenant)
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, email, password]
properties:
name: { type: string }
email: { type: string, format: email }
password: { type: string, minLength: 6 }
workspace: { type: string }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/AuthResult" }
"409": { $ref: "#/components/responses/Error" }
/v1/auth/login:
post:
summary: Authenticate and start a session
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email, password]
properties:
email: { type: string, format: email }
password: { type: string }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/AuthResult" }
"401": { $ref: "#/components/responses/Error" }
/v1/auth/me:
get:
summary: Current authenticated user
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
user: { $ref: "#/components/schemas/AuthUser" }
"401": { $ref: "#/components/responses/Error" }
/v1/auth/logout:
post:
summary: End the current session (?all=true ends every session)
responses:
"200": { description: OK }
/v1/model-sources/huggingface/search:
get:
summary: Search Hugging Face models (server-side proxy, sorted by downloads)
security: []
parameters:
- { name: q, in: query, schema: { type: string } }
- { name: task, in: query, schema: { type: string } }
- { name: limit, in: query, schema: { type: integer } }
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
live: { type: boolean }
items: { type: array, items: { type: object } }
/v1/model-sources/resolve:
post:
summary: Resolve a source into a model-profile preview (HF resolved live)
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
sourceType: { type: string, example: huggingface }
externalId: { type: string }
model: { type: string }
sourceUri: { type: string }
provider: { type: string }
path: { type: string }
branch: { type: string }
private: { type: boolean }
responses:
"200": { description: Profile preview }
"502": { $ref: "#/components/responses/Error" }
/v1/model-profiles:
get:
summary: List model profiles for the workspace
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
profiles: { type: array, items: { $ref: "#/components/schemas/ModelProfile" } }
"401": { $ref: "#/components/responses/Error" }
post:
summary: Import (create) a model profile
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ModelProfileImport" }
responses:
"201":
description: Created
content:
application/json:
schema:
type: object
properties:
profile: { $ref: "#/components/schemas/ModelProfile" }
"401": { $ref: "#/components/responses/Error" }
/v1/model-profiles/{id}/attach:
post:
summary: Attach/install a profile onto a runtime (creates a model.attach job)
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [runtimeId]
properties:
runtimeId: { type: string }
installMode: { type: string, enum: [pull_from_source, mount_volume, external_endpoint] }
servingEngine: { type: string, example: vLLM }
responses:
"202":
description: Accepted
content:
application/json:
schema:
type: object
properties:
installation_id: { type: string }
profile_id: { type: string }
job_id: { type: string }
events_url: { type: string }
"404": { $ref: "#/components/responses/Error" }
/v1/model-installations:
get:
summary: List runtime-cache installations for the workspace (with progress)
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
installations: { type: array, items: { $ref: "#/components/schemas/ModelInstallation" } }
"401": { $ref: "#/components/responses/Error" }
/v1/jobs:
get:
summary: List jobs (newest first)
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
jobs:
type: array
items: { $ref: "#/components/schemas/Job" }
post:
summary: Create a job
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateJobRequest"
responses:
"202":
description: Accepted
content:
application/json:
schema:
$ref: "#/components/schemas/CreateJobResponse"
"400": { $ref: "#/components/responses/Error" }
"422": { $ref: "#/components/responses/Error" }
/v1/jobs/{job_id}:
parameters:
- $ref: "#/components/parameters/JobID"
get:
summary: Read a job
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Job"
"404": { $ref: "#/components/responses/Error" }
delete:
summary: Cancel/delete a job
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
ok: { type: boolean }
status: { type: string }
"404": { $ref: "#/components/responses/Error" }
/v1/jobs/{job_id}/events:
parameters:
- $ref: "#/components/parameters/JobID"
get:
summary: Stream job events (SSE)
responses:
"200":
description: text/event-stream of Event objects
content:
text/event-stream:
schema:
$ref: "#/components/schemas/Event"
/v1/sandbox/sessions:
post:
summary: Create a sandbox session (alias over mcp.test)
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SandboxRequest"
responses:
"202":
description: Accepted
content:
application/json:
schema:
$ref: "#/components/schemas/SandboxResponse"
/v1/sandbox/sessions/{session_id}:
parameters:
- $ref: "#/components/parameters/SessionID"
get:
summary: Read a sandbox session
responses:
"200": { description: OK }
"404": { $ref: "#/components/responses/Error" }
delete:
summary: Delete a sandbox session
responses:
"200": { description: OK }
"404": { $ref: "#/components/responses/Error" }
/v1/sandbox/sessions/{session_id}/events:
parameters:
- $ref: "#/components/parameters/SessionID"
get:
summary: Stream sandbox events (SSE)
responses:
"200":
description: text/event-stream of Event objects
/v1/sandbox/sessions/{session_id}/tools:
parameters:
- $ref: "#/components/parameters/SessionID"
get:
summary: List tools advertised by the sandbox's MCP server
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
tools:
type: array
items: { $ref: "#/components/schemas/Tool" }
"409": { $ref: "#/components/responses/Error" }
/v1/sandbox/sessions/{session_id}/tools/call:
parameters:
- $ref: "#/components/parameters/SessionID"
post:
summary: Call a tool in the sandbox
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string }
arguments: { type: object, additionalProperties: true }
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
ok: { type: boolean }
result: { type: object, additionalProperties: true }
"409": { $ref: "#/components/responses/Error" }
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
parameters:
JobID:
name: job_id
in: path
required: true
schema: { type: string }
SessionID:
name: session_id
in: path
required: true
schema: { type: string }
responses:
Error:
description: Error
content:
application/json:
schema:
type: object
properties:
error: { type: string }
status: { type: integer }
schemas:
ModelProfile:
type: object
properties:
id: { type: string }
source_type: { type: string }
source_uri: { type: string }
provider: { type: string }
external_id: { type: string }
display_name: { type: string }
task: { type: string }
library: { type: string }
license: { type: string }
tags: { type: array, items: { type: string } }
status:
type: string
enum: [profile_only, queued, downloading, installed, attached, ready, failed, gated, incompatible]
ModelProfileImport:
type: object
properties:
source_type: { type: string }
source_uri: { type: string }
provider: { type: string }
external_id: { type: string }
display_name: { type: string }
task: { type: string }
library: { type: string }
license: { type: string }
tags: { type: array, items: { type: string } }
metadata: { type: object, additionalProperties: true }
ModelInstallation:
type: object
properties:
id: { type: string }
model_profile_id: { type: string }
runtime_id: { type: string }
install_mode: { type: string }
serving_engine: { type: string }
status:
type: string
enum: [queued, checking, downloading, verifying, attached, ready, failed]
progress: { type: integer }
local_path: { type: string }
model_name: { type: string }
provider: { type: string }
job_id: { type: string }
AuthUser:
type: object
properties:
id: { type: string }
name: { type: string }
email: { type: string }
role: { type: string, example: Owner }
workspace: { type: string }
workspace_slug: { type: string }
workspace_id: { type: string }
AuthResult:
type: object
properties:
token: { type: string, description: Session bearer token }
user: { $ref: "#/components/schemas/AuthUser" }
Capabilities:
type: object
properties:
capabilities:
type: array
items: { type: string }
example: [mcp.test, mcp.run, model.inspect, model.pull, agent.run, tool.run]
runtimes:
type: object
properties:
node: { type: boolean }
python: { type: boolean }
ollama: { type: boolean }
vllm: { type: boolean }
sglang: { type: boolean }
limits:
type: object
properties:
max_ttl_seconds: { type: integer }
max_concurrent_jobs: { type: integer }
CreateJobRequest:
type: object
required: [type]
properties:
type:
type: string
enum: [mcp.test, mcp.run, model.inspect, model.pull, model.preload, agent.run, tool.run]
ttl_seconds: { type: integer, example: 600 }
payload:
type: object
additionalProperties: true
CreateJobResponse:
type: object
properties:
job_id: { type: string }
status: { type: string }
events_url: { type: string }
Job:
type: object
properties:
job_id: { type: string }
type: { type: string }
status:
type: string
enum: [queued, running, complete, error, expired, cancelled]
created_at: { type: string, format: date-time }
expires_at: { type: string, format: date-time }
result: { nullable: true }
error: { type: string }
Event:
type: object
properties:
step: { type: string }
status:
type: string
enum: [queued, start, ok, error, running, expired, cancelled, complete]
message: { type: string }
data: { type: object, additionalProperties: true }
SandboxRequest:
type: object
required: [start_command]
properties:
entity_id: { type: string }
ttl_seconds: { type: integer }
runtime: { type: string, example: node }
transport: { type: string, example: stdio }
start_command: { type: string }
env:
type: object
additionalProperties: { type: string }
SandboxResponse:
type: object
properties:
session_id: { type: string }
job_id: { type: string }
status: { type: string }
expires_at: { type: string, format: date-time }
events_url: { type: string }
Tool:
type: object
properties:
name: { type: string }
description: { type: string }
input_schema: { type: object, additionalProperties: true }
|