Aller au contenu

Assistants

Ce contenu n’est pas encore disponible dans votre langue.

The factory routes under /api/v1/factory/assistants are the “type a prompt, get an assistant” surface. An assistant is a session in pages mode, created and owned by your integration key.

Every route on this page requires Authorization: Bearer <key> — see Overview and authentication.

POST, GET, and PATCH on a single assistant all return the same object:

{
"id": "sess-1756100000000-3f2a91bc",
"name": "Support Assistant",
"instructions": "Answer billing questions using the knowledge base. Escalate refunds.",
"model": "gpt-4o-mini"
}
FieldTypeNotes
idstringAssigned by the Designer. Use it verbatim; do not parse it.
namestringStored exactly as sent. The pack id is slugified from it at build time, so you do not have to.
instructionsstringThe worker’s system prompt.
modelstring | nullnull means “whatever the workspace is configured with” — the common case, and the one that needs no credential of its own.

POST /api/v1/factory/assistants

Terminal window
curl -sS -X POST "$GREENTIC_DESIGNER/api/v1/factory/assistants" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support Assistant",
"instructions": "Answer billing questions using the knowledge base. Escalate refunds.",
"model": "gpt-4o-mini"
}'

Body

FieldRequiredNotes
nameyesRejected when empty after trimming.
instructionsyesRejected when empty after trimming.
modelnoOmit to use the workspace’s configured model.

Responses

StatusBody
201The assistant object.
400 name_requiredname missing or blank.
400 instructions_requiredinstructions missing or blank.
500 assistant_create_failedThe row could not be written.

The new assistant is scoped by the key alone. There is no field in this body that could place it in another tenant or another team.

GET /api/v1/factory/assistants

Terminal window
curl -sS "$GREENTIC_DESIGNER/api/v1/factory/assistants" \
-H "Authorization: Bearer $GREENTIC_KEY"
{
"assistants": [
{ "id": "sess-1756100000000-3f2a91bc", "name": "Support Assistant", "updated_at": 1756100000000 }
]
}

List rows deliberately omit instructions, which can be long and is rarely wanted per row — fetch one assistant to get it.

updated_at is a Unix epoch in milliseconds. Rows come back most-recently-touched first, and the list is not paginated: it returns every assistant this key owns.

Only pages-mode rows appear here. A flow session created through /api/v1/sessions is not an assistant and is deliberately hidden from this list.

StatusBody
200{ "assistants": [...] }
500 assistant_list_failedThe query failed.

GET /api/v1/factory/assistants/{id}

Terminal window
curl -sS "$GREENTIC_DESIGNER/api/v1/factory/assistants/sess-1756100000000-3f2a91bc" \
-H "Authorization: Bearer $GREENTIC_KEY"
StatusBody
200The assistant object.
404 assistant_not_foundSee below.
500 assistant_read_failedThe read failed.

PATCH /api/v1/factory/assistants/{id}

Every field is optional. An absent field is left alone, not cleared.

Terminal window
curl -sS -X PATCH "$GREENTIC_DESIGNER/api/v1/factory/assistants/sess-1756100000000-3f2a91bc" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-H "Content-Type: application/json" \
-d '{ "instructions": "Answer billing questions. Never quote a refund amount." }'
StatusBody
200The updated assistant object.
400 name_requiredname was present but blank.
400 instructions_requiredinstructions was present but blank.
400 assistant_not_composedinstructions or model was sent for a row that has no composer configuration to write them onto.
404 assistant_not_foundNot yours, not a pages row, or gone.
500 assistant_update_failedThe write failed.

Renaming through this route also updates the display name the published manifest is built from, so the pack and the agent inside it cannot end up disagreeing.

DELETE /api/v1/factory/assistants/{id}

Terminal window
curl -sS -X DELETE "$GREENTIC_DESIGNER/api/v1/factory/assistants/sess-1756100000000-3f2a91bc" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-i
StatusBody
204Empty.
404 assistant_not_foundNot yours, not a pages row, or already gone.
500 assistant_delete_failedThe delete failed.

POST /api/v1/factory/assistants/{id}/publish

Builds the assistant’s .gtpack and publishes it, returning the agent_id and version a deployment needs. This runs the same build core as the Designer UI’s own publish, so both lanes produce identical packs.

Terminal window
curl -sS -X POST "$GREENTIC_DESIGNER/api/v1/factory/assistants/sess-1756100000000-3f2a91bc/publish" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-H "Content-Type: application/json" \
-d '{ "publish_to_store": true }'

Body

FieldDefaultNotes
publish_to_storetrueUpload to the Greentic Store as well as recording locally. A cloud deploy resolves the pack by reference, so a local-only publish produces an artifact nothing downstream can fetch.

Response — 200

{
"agent_id": "support-assistant",
"version": "0.1.0",
"pack_sha256": "9f2c...",
"local_saved": true,
"store_status": "published"
}
FieldNotes
agent_idThe published worker’s id, derived from name.
versionThe published version.
pack_sha256Content hash of the built pack.
local_savedWhether the pack was recorded on the Designer’s own disk.
store_statusOne of published, already_published, failed, skipped. skipped is what you get for publish_to_store: false.
store_errorPresent only when store_status is failed.
unreachableToolsAbsent entirely when there is nothing to report — the key is omitted, not sent as []. See below.

Errors

StatusBody
400 assistant_not_composedThe assistant has no configuration to publish.
404 assistant_not_foundNot yours, not a pages row, or gone.
409 worker_name_takenA different principal already published under this name in this workspace. JSON error shape.
422Conversion, pack-build, or pipeline failure. Plain-text body, not JSON.
500Output directory could not be created or resolved. Plain-text body, not JSON.

worker_name_taken is the one publish refusal a machine caller is expected to act on: a human published a worker under this name first, and this key must not silently overwrite it. Choose another name and retry.

When the published worker binds a tool that a deployed runtime cannot resolve, the response reports it and publishes anyway — a published worker is portable, and the operator installing it may run a runtime that can resolve the tool.

{
"agent_id": "support-assistant",
"version": "0.1.0",
"pack_sha256": "9f2c...",
"local_saved": true,
"store_status": "published",
"unreachableTools": [
{ "extensionId": "mcp:jira", "toolName": "create_issue", "reason": "missing_secrets_broker" }
]
}

reason is a machine token — missing_secrets_broker for mcp: tools, missing_sorx_url for sorla: tools. Branch on the entry being present rather than on the token itself. The worker will still run — those tools simply will not be offered to the model. See Agentic-worker MCP tools.

// The key is absent when nothing is unreachable, so default it before reading.
const unreachable = published.unreachableTools ?? [];
if (unreachable.length > 0) {
const detail = unreachable
.map((t) => `${t.extensionId}/${t.toolName} (${t.reason})`)
.join(', ');
throw new Error(`Published worker binds tools a deployment cannot resolve: ${detail}`);
}

The same rule applies to store_error, which is omitted unless store_status is failed.