Skip to main content
POST
Generate an agent draft from a task, streaming progress

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

A natural-language task to expand into a full agent draft.

task_description
string
required
Required string length: 1 - 4000
reference_material
string | null

Text from files the user attached to the builder, concatenated. Folded into prompt generation so the draft reflects their own rubric or guide.

Maximum string length: 24000

Response

A stream of Server-Sent Events; the final result frame's data is the generated draft.

The AI-built agent draft the editor seeds itself from.

icon
string
required
inputs
AgentInputSchema · object[]
required

The inputs the generated prompt declares — the editor seeds its Inputs section from this, never by parsing the prompt.

name
string
required
output_schema
EnrichmentOutputFields · object
required

The fields-mode output shape: repeatable named typed fields.

The default is Clay's: one text field named response.

prompt
AgentPromptTemplate · object
required

A saved agent's prompt: literal text with references between the runs.

The same convention every other stored prompt in the product uses (EnrichmentPromptTemplate for columns, template segments for sequences): identity-keyed segments, so renaming what a reference points at never rewrites the prompt. Structurally parallel to the enrichment template rather than importing it — an agent prompt references INPUTS, an enrichment prompt references COLUMNS, and the import hierarchy keeps the two domains apart.

test_cases
Test Cases · object[]
required