Class: HighLevel::Resources::AgentStudio

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/agent_studio.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#create_agent(body:, source: nil, **_opts) ⇒ Object

Create Agent

Creates a new agent with staging version. The agent will be created with an initial staging version that can later be promoted to production.



24
25
26
27
28
29
30
31
32
# File 'lib/high_level/resources/agent_studio.rb', line 24

def create_agent(body:, source: nil, **_opts)
  request(
    method: :post,
    path: "/agent-studio/agent",
    security: ["Location-Access"],
    params: { "source" => source }.compact,
    body: body
  )
end

#delete_agent(agent_id:, location_id: nil, source: nil, **_opts) ⇒ Object

Delete Agent

Deletes an agent and all its versions.



75
76
77
78
79
80
81
82
# File 'lib/high_level/resources/agent_studio.rb', line 75

def delete_agent(agent_id:, location_id: nil, source: nil, **_opts)
  request(
    method: :delete,
    path: "/agent-studio/agent/#{agent_id}",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "source" => source }.compact
  )
end

#execute_agent(agent_id:, body:, source: nil, **_opts) ⇒ Object

Execute Agent

Executes the specified agent and returns a non-streaming JSON response with the complete agent output. The agent must be in active status and belong to the specified location. locationId is required in the request body.

**Session Management:**

  • For the first message in a new session, do not include the ‘executionId` in the request payload.

  • The API will return an ‘executionId` along with the agent response, which uniquely identifies this conversation session.

  • To continue the conversation within the same session, include the ‘executionId` from the previous response in subsequent requests. This allows the agent to maintain conversation context and history across multiple interactions.



105
106
107
108
109
110
111
112
113
# File 'lib/high_level/resources/agent_studio.rb', line 105

def execute_agent(agent_id:, body:, source: nil, **_opts)
  request(
    method: :post,
    path: "/agent-studio/agent/#{agent_id}/execute",
    security: ["Location-Access"],
    params: { "source" => source }.compact,
    body: body
  )
end

#execute_agent_deprecated(agent_id:, body:, source: nil, **_opts) ⇒ Object

Execute Agent (Deprecated)

**Deprecated endpoint - use POST /agent/:agentId/execute instead.**

Executes the specified agent and returns a non-streaming JSON response with the complete agent output. The agent must be in active status and belong to the specified location. locationId is required in the request body.

**Session Management:**

  • For the first message in a new session, do not include the ‘executionId` in the request payload.

  • The API will return an ‘executionId` along with the agent response, which uniquely identifies this conversation session.

  • To continue the conversation within the same session, include the ‘executionId` from the previous response in subsequent requests.



153
154
155
156
157
158
159
160
161
# File 'lib/high_level/resources/agent_studio.rb', line 153

def execute_agent_deprecated(agent_id:, body:, source: nil, **_opts)
  request(
    method: :post,
    path: "/agent-studio/public-api/agents/#{agent_id}/execute",
    security: ["Location-Access"],
    params: { "source" => source }.compact,
    body: body
  )
end

#get_agent_by_id(agent_id:, location_id: nil, source: nil, **_opts) ⇒ Object

Get Agent

Gets a specific agent by its ID for the specified location with all its versions. Returns complete agent metadata and all non-deleted versions (draft, staging, production). locationId is required parameter. The agent must have active status.



50
51
52
53
54
55
56
57
# File 'lib/high_level/resources/agent_studio.rb', line 50

def get_agent_by_id(agent_id:, location_id: nil, source: nil, **_opts)
  request(
    method: :get,
    path: "/agent-studio/agent/#{agent_id}",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "source" => source }.compact
  )
end

#get_agent_by_id_deprecated(agent_id:, location_id: nil, source: nil, **_opts) ⇒ Object

Get Agent (Deprecated)

**Deprecated endpoint - use GET /agent/:agentId instead.**

Gets a specific agent by its ID for the specified location with all its versions. locationId is required parameter. The agent must have active status.



134
135
136
137
138
139
140
141
# File 'lib/high_level/resources/agent_studio.rb', line 134

def get_agent_by_id_deprecated(agent_id:, location_id: nil, source: nil, **_opts)
  request(
    method: :get,
    path: "/agent-studio/public-api/agents/#{agent_id}",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "source" => source }.compact
  )
end

#get_agents(location_id: nil, is_published: nil, limit: nil, offset: nil, source: nil, **_opts) ⇒ Object

List Agents

Lists all active agents for the specified location. locationId is required parameter to ensure optimal performance. Supports pagination using limit and offset. Optionally filter by isPublished=true to return only agents with a published production version.



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/agent_studio.rb', line 12

def get_agents(location_id: nil, is_published: nil, limit: nil, offset: nil, source: nil, **_opts)
  request(
    method: :get,
    path: "/agent-studio/agent",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "isPublished" => is_published, "limit" => limit, "offset" => offset, "source" => source }.compact
  )
end

#get_agents_deprecated(location_id: nil, limit: nil, offset: nil, source: nil, **_opts) ⇒ Object

List Agents (Deprecated)

**Deprecated endpoint - use GET /agent instead.**

Lists all active agents that have a published production version for the specified location. locationId is required parameter. Supports pagination using limit and offset.



120
121
122
123
124
125
126
127
# File 'lib/high_level/resources/agent_studio.rb', line 120

def get_agents_deprecated(location_id: nil, limit: nil, offset: nil, source: nil, **_opts)
  request(
    method: :get,
    path: "/agent-studio/public-api/agents",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "limit" => limit, "offset" => offset, "source" => source }.compact
  )
end

#promote_and_publish(version_id:, body:, source: nil, **_opts) ⇒ Object

Promote to Production

Promotes a draft version to production.



87
88
89
90
91
92
93
94
95
# File 'lib/high_level/resources/agent_studio.rb', line 87

def promote_and_publish(version_id:, body:, source: nil, **_opts)
  request(
    method: :post,
    path: "/agent-studio/agent/versions/#{version_id}/publish",
    security: ["Location-Access"],
    params: { "source" => source }.compact,
    body: body
  )
end

#update_agent_metadata(agent_id:, body:, source: nil, **_opts) ⇒ Object

Update Agent Metadata

Updates agent metadata such as name, description, and status.



62
63
64
65
66
67
68
69
70
# File 'lib/high_level/resources/agent_studio.rb', line 62

def (agent_id:, body:, source: nil, **_opts)
  request(
    method: :patch,
    path: "/agent-studio/agent/#{agent_id}",
    security: ["Location-Access"],
    params: { "source" => source }.compact,
    body: body
  )
end

#update_agent_version(version_id:, body:, source: nil, **_opts) ⇒ Object

Update Agent

Updates a specific agent version by versionId. Supports updating nodes, edges, variables, and configuration.



37
38
39
40
41
42
43
44
45
# File 'lib/high_level/resources/agent_studio.rb', line 37

def update_agent_version(version_id:, body:, source: nil, **_opts)
  request(
    method: :patch,
    path: "/agent-studio/agent/versions/#{version_id}",
    security: ["Location-Access"],
    params: { "source" => source }.compact,
    body: body
  )
end