Delete Agent Instance#
Description#
This API is used to delete an agent instance in the openYuanrong cluster. It reaches the instance directly by instance_id. Both creation modes (inline / registered) delete the same way.
Constraints#
instanceIdmust be theinstance_id(UUID) returned when the agent instance was created. A request toDELETE /api/agent/(empty trailing segment) is handled by the routing layer as 404; the handler’s 400 branch for an emptyinstanceIdis defensive logic.A non-existent or already-deleted
instanceIdreturns 404 rather than 200/204 — this is intentional, to prevent retries from mistaking “already deleted” for success. Clients sensitive to idempotency should treat 404 as the terminal state (resource absent), not a failure.A malformed
instanceId(non-UUID) is determined by route matching and generally returns 404.Authentication goes through frontend’s global
GlobalJWTAuthMiddleware, consistent with other function service REST APIs. Whenenable_func_token_authis on, a valid JWT must be carried (see the auth section of Agent Instance Protocol Invocation Channels).
URI#
DELETE /api/agent/:instanceId
Request Parameters#
Request Path Parameters#
Parameter |
Required |
Type |
Description |
|---|---|---|---|
instanceId |
Yes |
string |
Instance ID (the UUID returned at creation). |
Response Parameters#
Name |
Type |
Description |
|---|---|---|
code |
int |
Status code; |
status |
String |
Status. |
message |
String |
Error message on failure. |
Examples#
curl -X DELETE http://{frontend}:8888/api/agent/0b6c6322-6533-4901-8000-00000000bb0b
# When auth is on, carry: -H "X-Auth: <jwt>"
The example shows an in-cluster plaintext call with auth off; for production use
https://and enableenable_func_token_auth, carrying a valid JWT.
Response:
{"code":200,"status":"deleted"}
Error Codes#
HTTP status |
Description |
|---|---|
200 |
OK. The instance has been deleted. |
401 |
Unauthorized. When |
403 |
Forbidden. The JWT is valid but the caller lacks permission. |
404 |
Not Found. |
500 |
Internal Server Error. |