Compile an action
const url = 'http://localhost:11044/api/v1/actions/compile';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"description":"example","inputTypeNames":["example"],"llmModel":"example","llmTemperature":1,"name":"example","outputTypeName":"example","referenceNames":["example"],"toolNames":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/actions/compile \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "description": "example", "inputTypeNames": [ "example" ], "llmModel": "example", "llmTemperature": 1, "name": "example", "outputTypeName": "example", "referenceNames": [ "example" ], "toolNames": [ "example" ] }'Compiles a natural language description into a PromptedActionSpec. Uses the AI to generate a Jinja2 prompt template and saves to the world’s config/actions directory. The output type defaults to BackgroundMessage when not specified.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”What to compile into a world action. name names the action and its file, config/actions/<name>.yml, which is overwritten if it exists; description is the natural-language brief an LLM turns into the Jinja2 prompt. inputTypeNames, toolNames and referenceNames default to empty, outputTypeName to com.embabel.agent.spec.model.BackgroundMessage; llmModel (default: the platform default) and llmTemperature (default 0.0) are saved on the action and also drive the compiling call, which uses 0.1 when the temperature is not positive
The body of POST /actions/compile: a description an LLM turns into a prompted action, saved to the world’s config/actions directory.
object
What the action should do, in natural language; the LLM writes the prompt template from it, and it is kept as the action’s description
Types the action takes as input, by name from GET /actions/available-types; each becomes a template variable named after the type’s simple name in lower camel case. Omitted means none
Model the action runs on, which also writes its template; omitted uses the platform’s default model
Sampling temperature the action runs at; 0.0 when omitted. Writing the template uses 0.1 when this is 0 or less
Name of the action and of its file, config/actions/<name>.yml; a world action already saved under that name is overwritten
Type the action produces, by name; omitted or blank means com.embabel.agent.spec.model.BackgroundMessage
Skills, reference documents or memory the action may draw on, by name from GET /actions/available-references; omitted means none
Tools the action may call, by name from GET /actions/available-tools; omitted means none
Example generated
{ "description": "example", "inputTypeNames": [ "example" ], "llmModel": "example", "llmTemperature": 1, "name": "example", "outputTypeName": "example", "referenceNames": [ "example" ], "toolNames": [ "example" ]}Responses
Section titled “Responses”Compilation result
object
Compilation failed
A refused action operation: not found, not editable, not deletable, or a compilation that failed
object
Why, written to be shown, naming the action
Always error

