0.6.0 (latest) 0.5.0 0.4.4 0.3.0 0.2.0 0.1.1 Reference documentation and code samples for the Google Cloud Ces V1 Client class Agent.

An agent acts as the fundamental building block that provides instructions to
the Large Language Model (LLM) for executing specific tasks.

Generated from protobuf message `google.cloud.ces.v1.Agent`

## Namespace

Google \\ Cloud \\ Ces \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ llm_agent` | `Agent\LlmAgent` Optional. The default agent type. |
| `↳ remote_dialogflow_agent` | `Agent\RemoteDialogflowAgent` Optional. The remote [Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents) agent to be used for the agent execution. If this field is set, all other agent level properties will be ignored. Note: If the Dialogflow agent is in a different project from the app, you should grant `roles/dialogflow.client` to the CES service agent `service-<PROJECT-NUMBER>\@gcp-sa-ces.iam.gserviceaccount.com`. |
| `↳ name` | `string` Identifier. The unique identifier of the agent. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` |
| `↳ display_name` | `string` Required. Display name of the agent. |
| `↳ description` | `string` Optional. Human-readable description of the agent. |
| `↳ model_settings` | `ModelSettings` Optional. Configurations for the LLM model. |
| `↳ instruction` | `string` Optional. Instructions for the LLM model to guide the agent's behavior. |
| `↳ tools` | `string[]` Optional. List of available tools for the agent. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}` |
| `↳ child_agents` | `string[]` Optional. List of child agents in the agent tree. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` |
| `↳ before_agent_callbacks` | `array<Callback>` Optional. The callbacks to execute before the agent is called. The provided callbacks are executed sequentially in the exact order they are given in the list. If a callback returns an overridden response, execution stops and any remaining callbacks are skipped. |
| `↳ after_agent_callbacks` | `array<Callback>` Optional. The callbacks to execute after the agent is called. The provided callbacks are executed sequentially in the exact order they are given in the list. If a callback returns an overridden response, execution stops and any remaining callbacks are skipped. |
| `↳ before_model_callbacks` | `array<Callback>` Optional. The callbacks to execute before the model is called. If there are multiple calls to the model, the callback will be executed multiple times. The provided callbacks are executed sequentially in the exact order they are given in the list. If a callback returns an overridden response, execution stops and any remaining callbacks are skipped. |
| `↳ after_model_callbacks` | `array<Callback>` Optional. The callbacks to execute after the model is called. If there are multiple calls to the model, the callback will be executed multiple times. The provided callbacks are executed sequentially in the exact order they are given in the list. If a callback returns an overridden response, execution stops and any remaining callbacks are skipped. |
| `↳ before_tool_callbacks` | `array<Callback>` Optional. The callbacks to execute before the tool is invoked. If there are multiple tool invocations, the callback will be executed multiple times. The provided callbacks are executed sequentially in the exact order they are given in the list. If a callback returns an overridden response, execution stops and any remaining callbacks are skipped. |
| `↳ after_tool_callbacks` | `array<Callback>` Optional. The callbacks to execute after the tool is invoked. If there are multiple tool invocations, the callback will be executed multiple times. The provided callbacks are executed sequentially in the exact order they are given in the list. If a callback returns an overridden response, execution stops and any remaining callbacks are skipped. |
| `↳ create_time` | `Google\Protobuf\Timestamp` Output only. Timestamp when the agent was created. |
| `↳ update_time` | `Google\Protobuf\Timestamp` Output only. Timestamp when the agent was last updated. |
| `↳ guardrails` | `string[]` Optional. List of guardrails for the agent. Format: `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}` |
| `↳ etag` | `string` Etag used to ensure the object hasn't changed during a read-modify-write operation. If the etag is empty, the update will overwrite any concurrent changes. |
| `↳ toolsets` | `array<Agent\AgentToolset>` Optional. List of toolsets for the agent. |
| `↳ generated_summary` | `string` Output only. If the agent is generated by the LLM assistant, this field contains a descriptive summary of the generation. |
| `↳ transfer_rules` | `array<TransferRule>` Optional. Agent transfer rules. If multiple rules match, the first one in the list will be used. |
| `↳ validation_errors` | `string[]` Output only. Misconfigurations or errors in the agent that may affect agent quality. |

### getLlmAgent

Optional. The default agent type.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Agent\LlmAgent|null` |   |

### hasLlmAgent

### setLlmAgent

Optional. The default agent type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Agent\LlmAgent` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRemoteDialogflowAgent

Optional. The remote
[Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents)
agent to be used for the agent execution. If this field is set, all other
agent level properties will be ignored.

Note: If the Dialogflow agent is in a different project from the app, you
should grant `roles/dialogflow.client` to the CES service agent
`service-<PROJECT-NUMBER>\@gcp-sa-ces.iam.gserviceaccount.com`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Agent\RemoteDialogflowAgent|null` |   |

### hasRemoteDialogflowAgent

### setRemoteDialogflowAgent

Optional. The remote
[Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents)
agent to be used for the agent execution. If this field is set, all other
agent level properties will be ignored.

Note: If the Dialogflow agent is in a different project from the app, you
should grant `roles/dialogflow.client` to the CES service agent
`service-<PROJECT-NUMBER>\@gcp-sa-ces.iam.gserviceaccount.com`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Agent\RemoteDialogflowAgent` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getName

Identifier. The unique identifier of the agent.

Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Identifier. The unique identifier of the agent.

Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayName

Required. Display name of the agent.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDisplayName

Required. Display name of the agent.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDescription

Optional. Human-readable description of the agent.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDescription

Optional. Human-readable description of the agent.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getModelSettings

Optional. Configurations for the LLM model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ModelSettings|null` |   |

### hasModelSettings

### clearModelSettings

### setModelSettings

Optional. Configurations for the LLM model.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `ModelSettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getInstruction

Optional. Instructions for the LLM model to guide the agent's behavior.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setInstruction

Optional. Instructions for the LLM model to guide the agent's behavior.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTools

Optional. List of available tools for the agent.

Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<string>` |   |

### setTools

Optional. List of available tools for the agent.

Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getChildAgents

Optional. List of child agents in the agent tree.

Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<string>` |   |

### setChildAgents

Optional. List of child agents in the agent tree.

Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBeforeAgentCallbacks

Optional. The callbacks to execute before the agent is called.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Callback>` |   |

### setBeforeAgentCallbacks

Optional. The callbacks to execute before the agent is called.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Callback>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAfterAgentCallbacks

Optional. The callbacks to execute after the agent is called.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Callback>` |   |

### setAfterAgentCallbacks

Optional. The callbacks to execute after the agent is called.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Callback>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBeforeModelCallbacks

Optional. The callbacks to execute before the model is called. If there are
multiple calls to the model, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Callback>` |   |

### setBeforeModelCallbacks

Optional. The callbacks to execute before the model is called. If there are
multiple calls to the model, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Callback>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAfterModelCallbacks

Optional. The callbacks to execute after the model is called. If there are
multiple calls to the model, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Callback>` |   |

### setAfterModelCallbacks

Optional. The callbacks to execute after the model is called. If there are
multiple calls to the model, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Callback>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBeforeToolCallbacks

Optional. The callbacks to execute before the tool is invoked. If there are
multiple tool invocations, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Callback>` |   |

### setBeforeToolCallbacks

Optional. The callbacks to execute before the tool is invoked. If there are
multiple tool invocations, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Callback>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAfterToolCallbacks

Optional. The callbacks to execute after the tool is invoked. If there are
multiple tool invocations, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Callback>` |   |

### setAfterToolCallbacks

Optional. The callbacks to execute after the tool is invoked. If there are
multiple tool invocations, the callback will be executed multiple times.

The provided callbacks are executed sequentially in the exact order they
are given in the list. If a callback returns an overridden response,
execution stops and any remaining callbacks are skipped.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Callback>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. Timestamp when the agent was created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Timestamp when the agent was created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateTime

Output only. Timestamp when the agent was last updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. Timestamp when the agent was last updated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGuardrails

Optional. List of guardrails for the agent.

Format:
`projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<string>` |   |

### setGuardrails

Optional. List of guardrails for the agent.

Format:
`projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEtag

Etag used to ensure the object hasn't changed during a read-modify-write
operation. If the etag is empty, the update will overwrite any concurrent
changes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEtag

Etag used to ensure the object hasn't changed during a read-modify-write
operation. If the etag is empty, the update will overwrite any concurrent
changes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getToolsets

Optional. List of toolsets for the agent.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Agent\AgentToolset>` |   |

### setToolsets

Optional. List of toolsets for the agent.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Agent\AgentToolset>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGeneratedSummary

Output only. If the agent is generated by the LLM assistant, this field
contains a descriptive summary of the generation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setGeneratedSummary

Output only. If the agent is generated by the LLM assistant, this field
contains a descriptive summary of the generation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTransferRules

Optional. Agent transfer rules.

If multiple rules match, the first one in the list will be used.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<TransferRule>` |   |

### setTransferRules

Optional. Agent transfer rules.

If multiple rules match, the first one in the list will be used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<TransferRule>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getValidationErrors

Output only. Misconfigurations or errors in the agent that may affect agent
quality.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<string>` |   |

### setValidationErrors

Output only. Misconfigurations or errors in the agent that may affect agent
quality.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAgentType

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |