Skip to content

feat(platform): pivot Mosoo to an API-first managed Agent runtime #546

Description

@Yevanchen

Decision

This issue is the decision source for the Mosoo main pivot. Implementation must update the canonical product and architecture documents before changing the corresponding boundaries.

Mosoo becomes an API-first managed Agent runtime:

Select an Agent, provide Input and Resources, and receive a durable cloud Session with events, artifacts, and usage.

The first-use experience is OpenRouter-like: create one Workspace API key, select a callable Agent, and make a request. This describes the developer experience, not OpenAI wire compatibility.

This decision replaces the previous environment-first, Agentless Run proposal in this issue and supersedes the Harness Marketplace implementation direction explored in #561.

Product boundary

Mosoo does not define the customer's vertical workflow.

The calling application owns its domain logic, end-user identity, queue, validation, storage, and UI. Mosoo owns Agent execution, managed sandboxing, durable continuation, approvals, events, artifacts, usage measurement, and cleanup.

The console supports the API product:

  • Manage Workspace keys and private Agent revisions.
  • Inspect Sessions, events, artifacts, and usage.
  • Answer approvals and continue or cancel work.
  • It is not an App deployment or hosting surface.

Public model

Agent + Input + Resources → durable Session
Concept Meaning
Agent An executable Mosoo-managed Agent or a Workspace-private immutable Agent revision.
Input The instruction or message for the current turn.
Resources Typed application-supplied material such as repositories and files, authorized, resolved, and frozen before execution.
Session The durable continuation boundary: workspace, native Harness resume, events, artifacts, approvals, status, and usage.
Environment Mosoo-managed execution infrastructure resolved internally from the Agent and runtime requirements. It is not required first-request input or a public v1 catalog.

A managed Codex or Claude Code Agent is immediately callable. No Agent creation or publishing is required.

Applications with reusable instructions, Skills, tools, policies, or output contracts may create a Workspace-private immutable Agent revision and call it directly with their Workspace key. Creating a revision is optional; publishing is never an execution prerequisite.

Illustrative SDK shape:

const session = await mosoo.sessions.create({
  agent: "codex",
  input: "Analyze this repository and produce a report.",
  resources: [
    {
      type: "git_repository",
      url: "https://github.com/example/project",
      ref: "main",
    },
  ],
});

await mosoo.sessions.sendInput(session.id, {
  input: "Now turn the findings into an implementation plan.",
});

Endpoint, SDK method, and concrete slug names remain open. The first request must require only:

  1. A Workspace API key.
  2. A managed Agent or private revision.
  3. Input.
  4. Optional Resources.

session_id is the single primary public lifecycle handle. A Session permits one active turn at a time. Internal Runs, responses, and retry Attempts may exist for execution isolation and observability, but callers must not manage a second mandatory lifecycle ID.

Durable Session semantics

The selected direction is multi-turn:

  • Follow-up Input continues the same Session.
  • The Session retains its workspace and uses native Harness resume.
  • The Session pins its resolved Agent, Harness, and managed Environment revisions.
  • Each turn records the exact Input, Resources, events, artifacts, and usage that produced it.
  • Runtime retry Attempts preserve the frozen Input and Resource identities for that turn.
  • Approval, cancellation, terminal status, and cleanup are available through the Session lifecycle.

This is Session-scoped durability, not a Pet identity or permanent personal computer.

Environment and Resource boundary

Environment is managed execution infrastructure: image, packages, setup, sandbox policy, and network policy. Mosoo resolves it from the Agent revision and runtime requirements.

Resources are application-supplied inputs or attachments:

  • A repository ref resolves to an exact commit before execution.
  • Private Resources use credential references, never raw secrets in the request or durable plaintext snapshots.
  • Resource authorization and readiness are checked before Sandbox allocation.
  • Retries use the same frozen Resource identity.

An advanced Environment customization surface may be introduced only when a demonstrated use case requires it. It is not part of v1 onboarding.

Repository and product split

Mosoo Computer owns the Pet product: personal Agent identity, user-facing computer lifecycle, Channels, and other persistent-machine experiences.

Mosoo main owns the API-first managed Agent runtime. It has no product-level Pet | Cattle dual type:

  • Remove AgentKind and behavior that exists only to switch or coexist between Pet and Cattle.
  • Do not retain permanent compatibility branches or a field that always says cattle.
  • Durable Sessions, persistent workspace, and native resume remain valid Mosoo capabilities; they do not make the product a Pet.
  • mosoo-agent-driver remains the neutral execution substrate and may expose runtime primitives needed by both repositories.
  • Mosoo Computer may reuse the Driver, but Mosoo main must not depend on Pet product semantics.

v1 scope

  • API-first onboarding with one Workspace key.
  • Managed Agents for Codex and Claude Code.
  • Optional Workspace-private immutable Agent revisions.
  • Durable multi-turn Sessions with native resume.
  • Typed Resources, beginning with Git repositories and files.
  • Stable events, approvals, cancellation, artifacts, terminal status, and truthful usage.
  • Console views for keys, Sessions, approvals, artifacts, and usage.

Commercial direction

The default direction is unified Mosoo billing, with BYOK available to advanced users where supported.

Billing implementation, settlement, plans, and pricing are not part of this refactor. Usage must still be measured accurately so a future billing layer has trustworthy input.

Non-goals

  • App or website deployment and hosting.
  • Repo-first or Vercel-like Project semantics.
  • Requiring Agent Publish or Unpublish before execution.
  • A public Environment catalog as the primary API.
  • General Agent-framework adapters.
  • Automatic Agent routing or silent fallback.
  • A Harness or Agent marketplace, gallery, or public distribution system.
  • Pet identity, Channels, schedules, or personal-computer lifecycle in Mosoo main.
  • Billing implementation in this iteration.

Reference acceptance use case: ghfind

ghfind is the reference integration for the first API shape.

ghfind Workspace key
+ private ghfind evaluator Agent revision
+ evaluation Input
+ frozen Git repository Resource
→ one durable Mosoo Session
→ analysis JSON + evidence JSON + Markdown report Artifacts

The target integration must satisfy:

  • ghfind does not publish an Agent or create an App Deployment.
  • ghfind does not select an Environment.
  • ghfind keeps its own analysis ID, queue, rubric, validation, storage, and UI.
  • Mosoo owns execution, sandboxing, lifecycle, events, approvals, artifacts, and usage.
  • ghfind stores one Mosoo Session ID as its runtime handle.
  • The repository resolves to an exact commit and is reproducible across retries.
  • The three output artifacts are discoverable from the Session and schema-validatable by ghfind.

ghfind validates the backend-to-backend, idempotent, artifact-producing path. A separate acceptance test must validate multi-turn follow-up and native resume because ghfind currently performs one evaluation per Session.

Execution slices

Each child issue owns an end-to-end, independently verifiable slice with its own migration plan and rollback point:

The Builder slice removes Publish, Unpublish, Draft/Live visibility, deployment history, and marketplace-oriented state. A private revision becomes callable immediately by its owning Workspace.

The sequence is deliberate. A child may use an additive transition before destructive cutover where necessary to preserve a working migration path, but temporary compatibility code must be removed before that child closes.

Acceptance criteria

  • A new developer can create one Workspace key and start Codex or Claude Code without creating an App, Deployment, Environment, or published Agent.
  • The first request is expressible as Agent + Input + optional Resources.
  • A managed Agent and private immutable Agent revision use the same Session contract.
  • Follow-up Input continues the same workspace and native Harness conversation through one public Session ID.
  • Events, approvals, cancellation, artifacts, terminal status, and usage are available through the Session.
  • Every Session and turn records the exact execution and Resource revisions needed for reproducibility.
  • ghfind passes the reference acceptance flow.
  • Mosoo main exposes no Pet/Cattle type or compatibility path.
  • Channels, App Deployment, Agent Packages, and publishing requirements are absent from the target product.
  • Billing is not implemented as part of this refactor.

Migration guardrail

This issue defines the target; it does not authorize destructive production data removal.

Each destructive child issue must inventory production data and active runtime state, preserve promised user history, define backup and rollback procedures, and follow the append-only D1 migration policy. Historical storage may remain inert without keeping removed product semantics executable.

Related work

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions