Create Prompts
This guide shows you how to set up the Agenta SDK for managing prompts programmatically.
Creating a new application
Prompts are applications in Agenta. To create a new prompt, you need to specify the slug, and the type of the application.
The type of the application can be SERVICE:completion, SERVICE:chat, or CUSTOM:
SERVICE:completionis for single-turn prompts.SERVICE:chatis for multi-turn prompts.CUSTOMis for custom prompts.
- Python SDK
- JS/TS
- API
# Creates an empty application
app = ag.AppManager.create(
app_slug="my-app-slug",
template_key="SERVICE:completion", # we define here the app type
# template_key="SERVICE:chat" # chat prompts
# template_key="CUSTOM" # custom configuration (schema-less, however unless you provide a URI, you can only use the registry but not the playground)
)
const response = await fetch('https://cloud.agenta.ai/api/apps', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
app_name: 'my-app-slug',
template_key: 'SERVICE:completion'
})
});
const result = await response.json();
console.log(result);
curl -X POST "https://cloud.agenta.ai/api/apps" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"app_name": "my-app-slug",
"template_key": "SERVICE:completion"
}'
warning
The app created until now is empty. You cannot use it from the UI yet. You need to create a variant and commit changes to it to be able to use it (next section).
