curl --request POST \
--url https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agents_md": "---\nname: \"_test_import_export_agent\"\ndescription: \"A test agent for import/export round-trip\"\nmodel: \"gpt-4o-mini\"\ntemperature: 0.7\nmax_tokens: 2048\n---\n\nYou are a test assistant created via AGENTS.md import.\n"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agents_md: '---\nname: "_test_import_export_agent"\ndescription: "A test agent for import/export round-trip"\nmodel: "gpt-4o-mini"\ntemperature: 0.7\nmax_tokens: 2048\n---\n\nYou are a test assistant created via AGENTS.md import.\n'
})
};
fetch('https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/import"
payload = { "agents_md": "---
name: \"_test_import_export_agent\"
description: \"A test agent for import/export round-trip\"
model: \"gpt-4o-mini\"
temperature: 0.7
max_tokens: 2048
---
You are a test assistant created via AGENTS.md import.
" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"name": "<string>",
"status": "draft",
"serviceAccountId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"imported": true,
"action": "created",
"warnings": [
{
"code": "KNOWLEDGE_BASE_UNLINKED",
"tool": "<string>",
"knowledge_base_id": "<string>",
"reason": "not_readable"
}
]
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Import an agent from AGENTS.md
Parse an AGENTS.md document (YAML front matter + markdown
instructions) and either create a new agent from it or patch an
existing one.
Create vs update is decided solely by target_agent_id:
- omitted: CREATE (new agent, fresh id, SA provisioned)
- present: PATCH the matching agent (404 if not found in the caller’s org, 403 if the caller is neither the owner nor an agent-factory admin)
Any id: carried by the file’s frontmatter is ignored - round-trip
re-imports always create a new agent unless the caller explicitly
opts into a patch.
A knowledge base referenced by a tool is kept only when the caller
can read it and it belongs to the agent’s organization; otherwise the
reference is emptied and reported in warnings.
curl --request POST \
--url https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agents_md": "---\nname: \"_test_import_export_agent\"\ndescription: \"A test agent for import/export round-trip\"\nmodel: \"gpt-4o-mini\"\ntemperature: 0.7\nmax_tokens: 2048\n---\n\nYou are a test assistant created via AGENTS.md import.\n"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agents_md: '---\nname: "_test_import_export_agent"\ndescription: "A test agent for import/export round-trip"\nmodel: "gpt-4o-mini"\ntemperature: 0.7\nmax_tokens: 2048\n---\n\nYou are a test assistant created via AGENTS.md import.\n'
})
};
fetch('https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:agent-factory/webhooks/v1/agents/import"
payload = { "agents_md": "---
name: \"_test_import_export_agent\"
description: \"A test agent for import/export round-trip\"
model: \"gpt-4o-mini\"
temperature: 0.7
max_tokens: 2048
---
You are a test assistant created via AGENTS.md import.
" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"name": "<string>",
"status": "draft",
"serviceAccountId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"imported": true,
"action": "created",
"warnings": [
{
"code": "KNOWLEDGE_BASE_UNLINKED",
"tool": "<string>",
"knowledge_base_id": "<string>",
"reason": "not_readable"
}
]
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Authorizations
User-bound credential carrying an identity: either a session JWT
or a user access token (at:*) generated from the user settings UI.
Send as Authorization: Bearer <token>.
Org API keys (iak_*) are not accepted here - they carry
no user identity. Use the x-prismeai-api-key header instead
(see OrgApiKeyAuth).
Body
Response
Agent imported.
Slim record returned on agent create / import.
Knowledge bases unlinked during the import because the caller
cannot read them or they belong to another organization (an id
from another environment included). The tool is kept with its
vector_store_id (or Knowledge Explorer server) emptied.
Was this page helpful?