Skip to main content

agents

Creates, updates, deletes, gets or lists an agents resource.

Overview

Nameagents
TypeResource
Iddigitalocean.genai.agents

Fields

The following fields are returned by SELECT queries:

A successful response.

NameDatatypeDescription
namestringAgent name (example: example name)
project_idstring (example: 123e4567-e89b-12d3-a456-426614174000)
user_idstring (uint64)Id of user that created the agent (example: 12345)
route_namestringRoute name (example: example name)
anthropic_api_keyobjectAnthropic API Key Info
api_key_infosarrayApi key infos
api_keysarrayApi keys
chatbotobjectA Chatbot
chatbot_identifiersarrayChatbot identifiers
child_agentsarrayChild agents
conversation_logs_enabledbooleanWhether conversation logs are enabled for the agent
created_atstring (date-time)Creation date / time (example: 2023-01-01T00:00:00Z)
deploymentobjectDescription of deployment
descriptionstringDescription of agent (example: example string)
functionsarray
guardrailsarrayThe guardrails the agent is attached to
if_casestring (example: example string)
instructionstringAgent instruction. Instructions help your agent to perform its job effectively. See Write Effective Agent Instructions for best practices. (example: example string)
kinteger (int64)
knowledge_basesarrayKnowledge bases
logging_configobject
max_tokensinteger (int64)
modelobjectDescription of a Model
openai_api_keyobjectOpenAI API Key Info
parent_agentsarrayParent agents
provide_citationsbooleanWhether the agent should provide in-response citations
regionstringRegion code (example: example string)
retrieval_methodstring- RETRIEVAL_METHOD_UNKNOWN: The retrieval method is unknown - RETRIEVAL_METHOD_REWRITE: The retrieval method is rewrite - RETRIEVAL_METHOD_STEP_BACK: The retrieval method is step back - RETRIEVAL_METHOD_SUB_QUERIES: The retrieval method is sub queries - RETRIEVAL_METHOD_NONE: The retrieval method is none (default: RETRIEVAL_METHOD_UNKNOWN, example: RETRIEVAL_METHOD_UNKNOWN)
route_created_atstring (date-time)Creation of route date / time (example: 2023-01-01T00:00:00Z)
route_created_bystring (uint64) (example: 12345)
route_uuidstring (example: 123e4567-e89b-12d3-a456-426614174000)
tagsarrayAgent tag to organize related resources
temperaturenumber (float)
templateobjectRepresents an AgentTemplate entity
top_pnumber (float)
updated_atstring (date-time)Last modified (example: 2023-01-01T00:00:00Z)
urlstringAccess your agent under this url (example: example string)
uuidstringUnique agent id (example: 123e4567-e89b-12d3-a456-426614174000)
version_hashstringThe latest version of the agent (example: example string)
workspaceobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
genai_get_agentselectuuidTo retrieve details of an agent, GET request to /v2/gen-ai/agents/{uuid}. The response body is a JSON object containing the agent.
genai_list_agents_by_workspaceselectworkspace_uuidonly_deployed, page, per_pageTo list all agents by a Workspace, send a GET request to /v2/gen-ai/workspaces/{workspace_uuid}/agents.
genai_list_agentsselectonly_deployed, page, per_pageTo list all agents, send a GET request to /v2/gen-ai/agents.
genai_create_agentinsertTo create a new agent, send a POST request to /v2/gen-ai/agents. The response body contains a JSON object with the newly created agent object.
genai_update_agentreplaceuuidTo update an agent, send a PUT request to /v2/gen-ai/agents/{uuid}. The response body is a JSON object containing the agent.
genai_update_agents_workspacereplaceworkspace_uuidTo move all listed agents a given workspace, send a PUT request to /v2/gen-ai/workspaces/{workspace_uuid}/agents.
genai_delete_agentdeleteuuidTo delete an agent, send a DELETE request to /v2/gen-ai/agents/{uuid}.
genai_attach_agent_functionexecagent_uuidTo create a function route for an agent, send a POST request to /v2/gen-ai/agents/{agent_uuid}/functions.
genai_update_agent_functionexecagent_uuid, function_uuidTo update the function route, send a PUT request to /v2/gen-ai/agents/{agent_uuid}/functions/{function_uuid}.
genai_detach_agent_functionexecagent_uuid, function_uuidTo delete a function route from an agent, send a DELETE request to /v2/gen-ai/agents/{agent_uuid}/functions/{function_uuid}.
genai_attach_agentexecparent_agent_uuid, child_agent_uuidTo add an agent route to an agent, send a POST request to /v2/gen-ai/agents/{parent_agent_uuid}/child_agents/{child_agent_uuid}.
genai_update_attached_agentexecparent_agent_uuid, child_agent_uuidTo update an agent route for an agent, send a PUT request to /v2/gen-ai/agents/{parent_agent_uuid}/child_agents/{child_agent_uuid}.
genai_detach_agentexecparent_agent_uuid, child_agent_uuidTo delete an agent route from a parent agent, send a DELETE request to /v2/gen-ai/agents/{parent_agent_uuid}/child_agents/{child_agent_uuid}.
genai_update_agent_deployment_visibilityexecuuidCheck whether an agent is public or private. To update the agent status, send a PUT request to /v2/gen-ai/agents/{uuid}/deployment_visibility.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
agent_uuidstringThe id of the agent the function route belongs to. (example: "123e4567-e89b-12d3-a456-426614174000")
child_agent_uuidstringRouted agent id (example: "123e4567-e89b-12d3-a456-426614174000")
function_uuidstringThe function route to be destroyed. This does not destroy the function itself. (example: "123e4567-e89b-12d3-a456-426614174000")
parent_agent_uuidstringPagent agent id (example: "123e4567-e89b-12d3-a456-426614174000")
uuidstringUnique id (example: "123e4567-e89b-12d3-a456-426614174000")
workspace_uuidstringWorkspace uuid to move agents to (example: "123e4567-e89b-12d3-a456-426614174000")
only_deployedbooleanOnly list agents that are deployed. (example: true)
pageintegerPage number. (example: 1)
per_pageintegerItems per page. (example: 1)

SELECT examples

To retrieve details of an agent, GET request to /v2/gen-ai/agents/{uuid}. The response body is a JSON object containing the agent.

SELECT
name,
project_id,
user_id,
route_name,
anthropic_api_key,
api_key_infos,
api_keys,
chatbot,
chatbot_identifiers,
child_agents,
conversation_logs_enabled,
created_at,
deployment,
description,
functions,
guardrails,
if_case,
instruction,
k,
knowledge_bases,
logging_config,
max_tokens,
model,
openai_api_key,
parent_agents,
provide_citations,
region,
retrieval_method,
route_created_at,
route_created_by,
route_uuid,
tags,
temperature,
template,
top_p,
updated_at,
url,
uuid,
version_hash,
workspace
FROM digitalocean.genai.agents
WHERE uuid = '{{ uuid }}' -- required;

INSERT examples

To create a new agent, send a POST request to /v2/gen-ai/agents. The response body contains a JSON object with the newly created agent object.

INSERT INTO digitalocean.genai.agents (
data__anthropic_key_uuid,
data__description,
data__instruction,
data__knowledge_base_uuid,
data__model_uuid,
data__name,
data__open_ai_key_uuid,
data__project_id,
data__region,
data__tags
)
SELECT
'{{ anthropic_key_uuid }}',
'{{ description }}',
'{{ instruction }}',
'{{ knowledge_base_uuid }}',
'{{ model_uuid }}',
'{{ name }}',
'{{ open_ai_key_uuid }}',
'{{ project_id }}',
'{{ region }}',
'{{ tags }}'
RETURNING
agent
;

REPLACE examples

To update an agent, send a PUT request to /v2/gen-ai/agents/{uuid}. The response body is a JSON object containing the agent.

REPLACE digitalocean.genai.agents
SET
data__agent_log_insights_enabled = {{ agent_log_insights_enabled }},
data__anthropic_key_uuid = '{{ anthropic_key_uuid }}',
data__conversation_logs_enabled = {{ conversation_logs_enabled }},
data__description = '{{ description }}',
data__instruction = '{{ instruction }}',
data__k = {{ k }},
data__max_tokens = {{ max_tokens }},
data__model_uuid = '{{ model_uuid }}',
data__name = '{{ name }}',
data__open_ai_key_uuid = '{{ open_ai_key_uuid }}',
data__project_id = '{{ project_id }}',
data__provide_citations = {{ provide_citations }},
data__retrieval_method = '{{ retrieval_method }}',
data__tags = '{{ tags }}',
data__temperature = {{ temperature }},
data__top_p = {{ top_p }},
data__uuid = '{{ uuid }}'
WHERE
uuid = '{{ uuid }}' --required
RETURNING
agent;

DELETE examples

To delete an agent, send a DELETE request to /v2/gen-ai/agents/{uuid}.

DELETE FROM digitalocean.genai.agents
WHERE uuid = '{{ uuid }}' --required;

Lifecycle Methods

To create a function route for an agent, send a POST request to /v2/gen-ai/agents/{agent_uuid}/functions.

EXEC digitalocean.genai.agents.genai_attach_agent_function 
@agent_uuid='{{ agent_uuid }}' --required
@@json=
'{
"agent_uuid": "{{ agent_uuid }}",
"description": "{{ description }}",
"faas_name": "{{ faas_name }}",
"faas_namespace": "{{ faas_namespace }}",
"function_name": "{{ function_name }}",
"input_schema": "{{ input_schema }}",
"output_schema": "{{ output_schema }}"
}';