Skip to content

Commit 49db048

Browse files
authored
add agent to guardrail doc (#1138)
1 parent 7db7f66 commit 49db048

File tree

6 files changed

+146
-0
lines changed

6 files changed

+146
-0
lines changed

specification/DigitalOcean-public.v2.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,13 @@ paths:
22342234
delete:
22352235
$ref: 'resources/gen-ai/genai_detach_agent_function.yml'
22362236

2237+
/v2/gen-ai/agents/{agent_uuid}/guardrails:
2238+
post:
2239+
$ref: 'resources/gen-ai/genai_attach_agent_guardrails.yml'
2240+
2241+
/v2/gen-ai/agents/{agent_uuid}/guardrails/{guardrail_uuid}:
2242+
delete:
2243+
$ref: 'resources/gen-ai/genai_detach_agent_guardrail.yml'
22372244

22382245
/v2/gen-ai/agents/{agent_uuid}/knowledge_bases:
22392246
post:

specification/resources/gen-ai/definitions.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,19 @@ apiLinkAgentGuardrailOutput:
33993399
agent:
34003400
$ref: '#/apiAgent'
34013401
type: object
3402+
apiLinkAgentGuardrailsInputPublic:
3403+
description: Information about linking an agent to a guardrail
3404+
properties:
3405+
agent_uuid:
3406+
description: The UUID of the agent.
3407+
example: '"12345678-1234-1234-1234-123456789012"'
3408+
type: string
3409+
guardrails:
3410+
description: The list of guardrails to attach.
3411+
items:
3412+
$ref: '#/apiAgentGuardrailInput'
3413+
type: array
3414+
type: object
34023415
apiLinkAgentInputPublic:
34033416
description: Information for linking an agent
34043417
properties:
@@ -4900,6 +4913,12 @@ apiUnlinkAgentFunctionOutput:
49004913
agent:
49014914
$ref: '#/apiAgent'
49024915
type: object
4916+
apiUnlinkAgentGuardrailInputPublic:
4917+
properties:
4918+
agent_uuid:
4919+
example: '"12345678-1234-1234-1234-123456789012"'
4920+
guardrail_uuid:
4921+
example: '"12345678-1234-1234-1234-123456789012"'
49034922
apiUnlinkAgentGuardrailOutput:
49044923
description: UnlinkAgentGuardrailOutput description
49054924
properties:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
lang: cURL
2+
source: |-
3+
curl -X POST \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/gen-ai/agents/1c8be326-00fe-11f1-b542-ca68c578b05c/guardrails" \
7+
-d '{
8+
"guardrails": [
9+
{
10+
"guardrail_uuid": "69bcc61c-2bb2-49fd-b6ed-7c1bd73d6442",
11+
"priority": 1
12+
},
13+
{
14+
"guardrail_uuid": "dc72b12b-bd45-46c9-bca1-00a6624aac3a",
15+
"priority": 2
16+
}
17+
]
18+
}'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
lang: cURL
2+
source: |-
3+
curl -X DELETE \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/gen-ai/agents/1c8be326-00fe-11f1-b542-ca68c578b04c/guardrails/69bcc61c-2bb2-49fd-b6ed-7c1bd73d6572"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
description: To attach guardrails to an agent, send a POST request to `/v2/gen-ai/agents/{agent_uuid}/guardrails`.
2+
operationId: genai_attach_agent_guardrails
3+
parameters:
4+
- description: The UUID of the agent.
5+
example: '"123e4567-e89b-12d3-a456-426614174000"'
6+
in: path
7+
name: agent_uuid
8+
required: true
9+
schema:
10+
type: string
11+
requestBody:
12+
content:
13+
application/json:
14+
schema:
15+
$ref: ./definitions.yml#/apiLinkAgentGuardrailsInputPublic
16+
responses:
17+
"200":
18+
content:
19+
application/json:
20+
schema:
21+
$ref: ./definitions.yml#/apiLinkAgentGuardrailOutput
22+
description: A successful response.
23+
headers:
24+
ratelimit-limit:
25+
$ref: ../../shared/headers.yml#/ratelimit-limit
26+
ratelimit-remaining:
27+
$ref: ../../shared/headers.yml#/ratelimit-remaining
28+
ratelimit-reset:
29+
$ref: ../../shared/headers.yml#/ratelimit-reset
30+
"401":
31+
$ref: ../../shared/responses/unauthorized.yml
32+
"404":
33+
$ref: ../../shared/responses/not_found.yml
34+
"429":
35+
$ref: ../../shared/responses/too_many_requests.yml
36+
"500":
37+
$ref: ../../shared/responses/server_error.yml
38+
default:
39+
$ref: ../../shared/responses/unexpected_error.yml
40+
security:
41+
- bearer_auth:
42+
- genai:create
43+
summary: Attach Guardrails to an Agent
44+
tags:
45+
- GradientAI Platform
46+
x-codeSamples:
47+
- $ref: examples/curl/genai_attach_agent_guardrails.yml
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
description: To detach a guardrail from an agent, send a DELETE request to `/v2/gen-ai/agents/{agent_uuid}/guardrails/{guardrail_uuid}`.
2+
operationId: genai_detach_agent_guardrail
3+
parameters:
4+
- description: The UUID of the agent.
5+
example: '"123e4567-e89b-12d3-a456-426614174000"'
6+
in: path
7+
name: agent_uuid
8+
required: true
9+
schema:
10+
type: string
11+
- description: The UUID of the guardrail to detach.
12+
example: '"123e4567-e89b-12d3-a456-426614174000"'
13+
in: path
14+
name: guardrail_uuid
15+
required: true
16+
schema:
17+
type: string
18+
responses:
19+
"200":
20+
content:
21+
application/json:
22+
schema:
23+
$ref: ./definitions.yml#/apiUnlinkAgentGuardrailOutput
24+
description: A successful response.
25+
headers:
26+
ratelimit-limit:
27+
$ref: ../../shared/headers.yml#/ratelimit-limit
28+
ratelimit-remaining:
29+
$ref: ../../shared/headers.yml#/ratelimit-remaining
30+
ratelimit-reset:
31+
$ref: ../../shared/headers.yml#/ratelimit-reset
32+
"401":
33+
$ref: ../../shared/responses/unauthorized.yml
34+
"404":
35+
$ref: ../../shared/responses/not_found.yml
36+
"429":
37+
$ref: ../../shared/responses/too_many_requests.yml
38+
"500":
39+
$ref: ../../shared/responses/server_error.yml
40+
default:
41+
$ref: ../../shared/responses/unexpected_error.yml
42+
security:
43+
- bearer_auth:
44+
- genai:delete
45+
summary: Detach a Guardrail from an Agent
46+
tags:
47+
- GradientAI Platform
48+
x-codeSamples:
49+
- $ref: examples/curl/genai_detach_agent_guardrail.yml

0 commit comments

Comments
 (0)