Class: Zavudev::Resources::Agents
- Inherits:
-
Object
- Object
- Zavudev::Resources::Agents
- Defined in:
- lib/zavudev/resources/agents.rb,
lib/zavudev/resources/agents/senders.rb,
sig/zavudev/resources/agents.rbs,
sig/zavudev/resources/agents/senders.rbs
Defined Under Namespace
Classes: Senders
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(model:, name:, provider:, system_prompt:, context_window_messages: nil, include_contact_metadata: nil, max_tokens: nil, temperature: nil, trigger_on_channels: nil, trigger_on_message_types: nil, voice: nil, request_options: {}) ⇒ Zavudev::Models::AgentCreateResponse
Some parameter documentations has been truncated, see Models::AgentCreateParams for more details.
-
#delete(agent_id, request_options: {}) ⇒ nil
Delete an agent.
-
#initialize(client:) ⇒ Agents
constructor
private
A new instance of Agents.
-
#list(cursor: nil, limit: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Senders::SendersAgent>
Every agent in the project, newest first — including agents that are not connected to any sender yet, which the sender-scoped routes cannot reach.
-
#list_voices(language: nil, request_options: {}) ⇒ Zavudev::Models::AgentListVoicesResponse
The voices an agent can speak with, for
voice.ttsVoiceId. -
#retrieve(agent_id, request_options: {}) ⇒ Zavudev::Models::AgentRetrieveResponse
Get an agent.
-
#test_(agent_id, message:, execute_tools: nil, history: nil, use_knowledge_base: nil, request_options: {}) ⇒ Zavudev::Models::AgentTestResponse
Some parameter documentations has been truncated, see Models::AgentTestParams for more details.
-
#update(agent_id, api_key: nil, context_window_messages: nil, enabled: nil, include_contact_metadata: nil, max_tokens: nil, model: nil, name: nil, provider: nil, system_prompt: nil, temperature: nil, trigger_on_channels: nil, trigger_on_message_types: nil, voice: nil, request_options: {}) ⇒ Zavudev::Models::AgentUpdateResponse
Some parameter documentations has been truncated, see Models::AgentUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Agents
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Agents.
247 248 249 250 |
# File 'lib/zavudev/resources/agents.rb', line 247 def initialize(client:) @client = client @senders = Zavudev::Resources::Agents::Senders.new(client: client) end |
Instance Attribute Details
#senders ⇒ Zavudev::Resources::Agents::Senders (readonly)
7 8 9 |
# File 'lib/zavudev/resources/agents.rb', line 7 def senders @senders end |
Instance Method Details
#create(model:, name:, provider:, system_prompt:, context_window_messages: nil, include_contact_metadata: nil, max_tokens: nil, temperature: nil, trigger_on_channels: nil, trigger_on_message_types: nil, voice: nil, request_options: {}) ⇒ Zavudev::Models::AgentCreateResponse
Some parameter documentations has been truncated, see Models::AgentCreateParams for more details.
Create an agent without a sender. It is created disabled; connect a sender and enable it when you are ready for it to answer.
Sub-resources. An agent's tools, flows and knowledge bases are reachable at
/v1/agents/{agentId}/tools, /v1/agents/{agentId}/flows and
/v1/agents/{agentId}/knowledge-bases, mirroring the sender-scoped routes
documented under /v1/senders/{senderId}/agent/... exactly. Use the
agent-scoped form while the agent has no sender: the sender-scoped one cannot
address it.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/zavudev/resources/agents.rb', line 51 def create(params) parsed, = Zavudev::AgentCreateParams.dump_request(params) @client.request( method: :post, path: "v1/agents", body: parsed, model: Zavudev::Models::AgentCreateResponse, options: ) end |
#delete(agent_id, request_options: {}) ⇒ nil
Delete an agent
170 171 172 173 174 175 176 177 |
# File 'lib/zavudev/resources/agents.rb', line 170 def delete(agent_id, params = {}) @client.request( method: :delete, path: ["v1/agents/%1$s", agent_id], model: NilClass, options: params[:request_options] ) end |
#list(cursor: nil, limit: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Senders::SendersAgent>
Every agent in the project, newest first — including agents that are not
connected to any sender yet, which the sender-scoped routes cannot reach. Each
item carries senderIds, the senders the agent answers on.
146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/zavudev/resources/agents.rb', line 146 def list(params = {}) parsed, = Zavudev::AgentListParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/agents", query: query, page: Zavudev::Internal::Cursor, model: Zavudev::Senders::SendersAgent, options: ) end |
#list_voices(language: nil, request_options: {}) ⇒ Zavudev::Models::AgentListVoicesResponse
The voices an agent can speak with, for voice.ttsVoiceId. Filter by language
to get the ones that speak it; a voice can still be used with language: auto,
where the agent follows the caller and keeps the chosen voice.
192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/zavudev/resources/agents.rb', line 192 def list_voices(params = {}) parsed, = Zavudev::AgentListVoicesParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/agents/voices", query: query, model: Zavudev::Models::AgentListVoicesResponse, options: ) end |
#retrieve(agent_id, request_options: {}) ⇒ Zavudev::Models::AgentRetrieveResponse
Get an agent
73 74 75 76 77 78 79 80 |
# File 'lib/zavudev/resources/agents.rb', line 73 def retrieve(agent_id, params = {}) @client.request( method: :get, path: ["v1/agents/%1$s", agent_id], model: Zavudev::Models::AgentRetrieveResponse, options: params[:request_options] ) end |
#test_(agent_id, message:, execute_tools: nil, history: nil, use_knowledge_base: nil, request_options: {}) ⇒ Zavudev::Models::AgentTestResponse
Some parameter documentations has been truncated, see Models::AgentTestParams for more details.
Run the agent's prompt, model and knowledge base against a message and return the reply instead of delivering it. Writes nothing and charges nothing, so it is safe to call repeatedly while iterating on a prompt.
Note that a dry run never executes tools — running them would cause real
side effects. Live conversations on every channel do call them. When the agent
has enabled tools, that gap is reported in warnings rather than silently
producing an answer that looks like a tool call happened.
233 234 235 236 237 238 239 240 241 242 |
# File 'lib/zavudev/resources/agents.rb', line 233 def test_(agent_id, params) parsed, = Zavudev::AgentTestParams.dump_request(params) @client.request( method: :post, path: ["v1/agents/%1$s/test", agent_id], body: parsed, model: Zavudev::Models::AgentTestResponse, options: ) end |
#update(agent_id, api_key: nil, context_window_messages: nil, enabled: nil, include_contact_metadata: nil, max_tokens: nil, model: nil, name: nil, provider: nil, system_prompt: nil, temperature: nil, trigger_on_channels: nil, trigger_on_message_types: nil, voice: nil, request_options: {}) ⇒ Zavudev::Models::AgentUpdateResponse
Some parameter documentations has been truncated, see Models::AgentUpdateParams for more details.
Update an agent
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/zavudev/resources/agents.rb', line 122 def update(agent_id, params = {}) parsed, = Zavudev::AgentUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/agents/%1$s", agent_id], body: parsed, model: Zavudev::Models::AgentUpdateResponse, options: ) end |