Skip to content

API Reference parrot.handlers.studio.drafts

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.handlers.studio.drafts

View source

Studio draft pipeline — save/list/read/activate/delete (FEAT-467 TASK-2513).

Implements the draft -> validate -> activate safety gate (spec §3 Module 5): a generated Python agent is saved to AGENTS_DIR/_drafts/ and statically validated (validation.validate_draft) on save. It is imported and registered into the live AgentRegistry ONLY on an explicit POST .../activate call — the ONLY path from generated code to live code (spec §7 "Draft import side effects": the AST allowlist must run BEFORE any import).

Package layout (oversize-module split, owner decision D1): the two views live here with their verbs and PBAC gates; the request models, shared helpers, the legacy filesystem bodies and the database-mode bodies are in _models.py / _mixin.py / _legacy.py / _db.py.

Alias AGENTS_DIR

Re-exported from parrot.conf.AGENTS_DIR.

Alias ActivateDraftRequest

Re-exported from parrot.handlers.studio.drafts._models.ActivateDraftRequest.

Alias DRAFTS_SUBDIR

Re-exported from parrot.handlers.studio.drafts._models.DRAFTS_SUBDIR.

Alias SaveDraftRequest

Re-exported from parrot.handlers.studio.drafts._models.SaveDraftRequest.

Alias StudioDraft

Re-exported from parrot.handlers.models.studio_drafts.StudioDraft.

Class StudioDraftActivateHandler

POST /api/v1/astudio/drafts/{name}/activate.

The ONLY path from a generated draft to a live, registered agent. Refuses (409) unless the draft's LATEST on-disk content re-validates clean, and unless any registered-name collision is explicitly consented to (replace=true) by the owner (or an admin).

Method StudioDraftActivateHandler.post

Activate a declarative draft atomically (database mode) or import a Python draft (legacy).

post()

Class StudioDraftVisibilityHandler

PATCH /api/v1/astudio/drafts/{name}/visibility — change who can see a declarative draft.

Method StudioDraftVisibilityHandler.patch

Set visibility / allowed_groups of a declarative draft (404 invisible, 403 not manageable, 422).

patch()

Class StudioDraftsHandler

/api/v1/astudio/drafts and /api/v1/astudio/drafts/{name}.

GET (list/single incl. source + validation report), POST (save + validate), DELETE (owner-enforced).

Method StudioDraftsHandler.get

List/read drafts: the declarative store (database mode) plus legacy Python drafts on GLOBAL.

get()

Method StudioDraftsHandler.post

Save a draft: a declarative bundle (database mode) or legacy Python source.

post()

Method StudioDraftsHandler.delete

Delete a declarative draft (database mode) or a legacy Python draft.

delete()

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally