Dialogflow v3 API - Class AgentsClient (2.20.0)

public abstract class AgentsClient

Reference documentation and code samples for the Dialogflow v3 API class AgentsClient.

Agents client wrapper, for convenient use.

Inheritance

object > AgentsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.Cx.V3

Assembly

Google.Cloud.Dialogflow.Cx.V3.dll

Remarks

Service for managing [Agents][google.cloud.dialogflow.cx.v3.Agent].

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Agents service, which is a host of "dialogflow.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Agents scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

ExportAgentOperationsClient

public virtual OperationsClient ExportAgentOperationsClient { get; }

The long-running operations client for ExportAgent.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual Agents.AgentsClient GrpcClient { get; }

The underlying gRPC Agents client

Property Value
Type Description
AgentsAgentsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

RestoreAgentOperationsClient

public virtual OperationsClient RestoreAgentOperationsClient { get; }

The long-running operations client for RestoreAgent.

Property Value
Type Description
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static AgentsClient Create()

Synchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.

Returns
Type Description
AgentsClient

The created AgentsClient.

CreateAgent(LocationName, Agent, CallSettings)

public virtual Agent CreateAgent(LocationName parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
parent LocationName

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agent Agent

Required. The agent to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Agent agent = new Agent();
// Make the request
Agent response = agentsClient.CreateAgent(parent, agent);

CreateAgent(CreateAgentRequest, CallSettings)

public virtual Agent CreateAgent(CreateAgentRequest request, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request CreateAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
CreateAgentRequest request = new CreateAgentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Agent = new Agent(),
};
// Make the request
Agent response = agentsClient.CreateAgent(request);

CreateAgent(string, Agent, CallSettings)

public virtual Agent CreateAgent(string parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
parent string

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agent Agent

Required. The agent to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Agent agent = new Agent();
// Make the request
Agent response = agentsClient.CreateAgent(parent, agent);

CreateAgentAsync(LocationName, Agent, CallSettings)

public virtual Task<Agent> CreateAgentAsync(LocationName parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
parent LocationName

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agent Agent

Required. The agent to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAgentAsync(LocationName, Agent, CancellationToken)

public virtual Task<Agent> CreateAgentAsync(LocationName parent, Agent agent, CancellationToken cancellationToken)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
parent LocationName

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agent Agent

Required. The agent to create.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAgentAsync(CreateAgentRequest, CallSettings)

public virtual Task<Agent> CreateAgentAsync(CreateAgentRequest request, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request CreateAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
CreateAgentRequest request = new CreateAgentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Agent = new Agent(),
};
// Make the request
Agent response = await agentsClient.CreateAgentAsync(request);

CreateAgentAsync(CreateAgentRequest, CancellationToken)

public virtual Task<Agent> CreateAgentAsync(CreateAgentRequest request, CancellationToken cancellationToken)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request CreateAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
CreateAgentRequest request = new CreateAgentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Agent = new Agent(),
};
// Make the request
Agent response = await agentsClient.CreateAgentAsync(request);

CreateAgentAsync(string, Agent, CallSettings)

public virtual Task<Agent> CreateAgentAsync(string parent, Agent agent, CallSettings callSettings = null)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
parent string

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agent Agent

Required. The agent to create.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAgentAsync(string, Agent, CancellationToken)

public virtual Task<Agent> CreateAgentAsync(string parent, Agent agent, CancellationToken cancellationToken)

Creates an agent in the specified location.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
parent string

Required. The location to create a agent for. Format: projects/<Project ID>/locations/<Location ID>.

agent Agent

Required. The agent to create.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.CreateAgentAsync(parent, agent);

CreateAsync(CancellationToken)

public static Task<AgentsClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskAgentsClient

The task representing the created AgentsClient.

DeleteAgent(AgentName, CallSettings)

public virtual void DeleteAgent(AgentName name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
Name Description
name AgentName

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
agentsClient.DeleteAgent(name);

DeleteAgent(DeleteAgentRequest, CallSettings)

public virtual void DeleteAgent(DeleteAgentRequest request, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
Name Description
request DeleteAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
agentsClient.DeleteAgent(request);

DeleteAgent(string, CallSettings)

public virtual void DeleteAgent(string name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
Name Description
name string

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
agentsClient.DeleteAgent(name);

DeleteAgentAsync(AgentName, CallSettings)

public virtual Task DeleteAgentAsync(AgentName name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
Name Description
name AgentName

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
await agentsClient.DeleteAgentAsync(name);

DeleteAgentAsync(AgentName, CancellationToken)

public virtual Task DeleteAgentAsync(AgentName name, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
Name Description
name AgentName

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
await agentsClient.DeleteAgentAsync(name);

DeleteAgentAsync(DeleteAgentRequest, CallSettings)

public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
Name Description
request DeleteAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
await agentsClient.DeleteAgentAsync(request);

DeleteAgentAsync(DeleteAgentRequest, CancellationToken)

public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
Name Description
request DeleteAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
await agentsClient.DeleteAgentAsync(request);

DeleteAgentAsync(string, CallSettings)

public virtual Task DeleteAgentAsync(string name, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
Name Description
name string

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
await agentsClient.DeleteAgentAsync(name);

DeleteAgentAsync(string, CancellationToken)

public virtual Task DeleteAgentAsync(string name, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
Name Description
name string

Required. The name of the agent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
await agentsClient.DeleteAgentAsync(name);

ExportAgent(ExportAgentRequest, CallSettings)

public virtual Operation<ExportAgentResponse, Struct> ExportAgent(ExportAgentRequest request, CallSettings callSettings = null)

Exports the specified agent to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: An empty Struct message
  • response: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Parameters
Name Description
request ExportAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportAgentResponseStruct

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    DataFormat = ExportAgentRequest.Types.DataFormat.Unspecified,
    EnvironmentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
    GitDestination = new ExportAgentRequest.Types.GitDestination(),
    IncludeBigqueryExportSettings = false,
};
// Make the request
Operation<ExportAgentResponse, Struct> response = agentsClient.ExportAgent(request);

// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportAgentResponse retrievedResult = retrievedResponse.Result;
}

ExportAgentAsync(ExportAgentRequest, CallSettings)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CallSettings callSettings = null)

Exports the specified agent to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: An empty Struct message
  • response: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Parameters
Name Description
request ExportAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    DataFormat = ExportAgentRequest.Types.DataFormat.Unspecified,
    EnvironmentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
    GitDestination = new ExportAgentRequest.Types.GitDestination(),
    IncludeBigqueryExportSettings = false,
};
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportAgentResponse retrievedResult = retrievedResponse.Result;
}

ExportAgentAsync(ExportAgentRequest, CancellationToken)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CancellationToken cancellationToken)

Exports the specified agent to a binary file.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: An empty Struct message
  • response: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
Parameters
Name Description
request ExportAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    DataFormat = ExportAgentRequest.Types.DataFormat.Unspecified,
    EnvironmentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"),
    GitDestination = new ExportAgentRequest.Types.GitDestination(),
    IncludeBigqueryExportSettings = false,
};
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportAgentResponse retrievedResult = retrievedResponse.Result;
}

GetAgent(AgentName, CallSettings)

public virtual Agent GetAgent(AgentName name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
Name Description
name AgentName

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
Agent response = agentsClient.GetAgent(name);

GetAgent(GetAgentRequest, CallSettings)

public virtual Agent GetAgent(GetAgentRequest request, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
Name Description
request GetAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
Agent response = agentsClient.GetAgent(request);

GetAgent(string, CallSettings)

public virtual Agent GetAgent(string name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
Name Description
name string

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
Agent response = agentsClient.GetAgent(name);

GetAgentAsync(AgentName, CallSettings)

public virtual Task<Agent> GetAgentAsync(AgentName name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
Name Description
name AgentName

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentAsync(AgentName, CancellationToken)

public virtual Task<Agent> GetAgentAsync(AgentName name, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
Name Description
name AgentName

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentName name = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentAsync(GetAgentRequest, CallSettings)

public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
Name Description
request GetAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
Agent response = await agentsClient.GetAgentAsync(request);

GetAgentAsync(GetAgentRequest, CancellationToken)

public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
Name Description
request GetAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
};
// Make the request
Agent response = await agentsClient.GetAgentAsync(request);

GetAgentAsync(string, CallSettings)

public virtual Task<Agent> GetAgentAsync(string name, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
Name Description
name string

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentAsync(string, CancellationToken)

public virtual Task<Agent> GetAgentAsync(string name, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
Name Description
name string

Required. The name of the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
// Make the request
Agent response = await agentsClient.GetAgentAsync(name);

GetAgentValidationResult(AgentValidationResultName, CallSettings)

public virtual AgentValidationResult GetAgentValidationResult(AgentValidationResultName name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
name AgentValidationResultName

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
AgentValidationResult response = agentsClient.GetAgentValidationResult(name);

GetAgentValidationResult(GetAgentValidationResultRequest, CallSettings)

public virtual AgentValidationResult GetAgentValidationResult(GetAgentValidationResultRequest request, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
request GetAgentValidationResultRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetAgentValidationResultRequest request = new GetAgentValidationResultRequest
{
    AgentValidationResultName = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = agentsClient.GetAgentValidationResult(request);

GetAgentValidationResult(string, CallSettings)

public virtual AgentValidationResult GetAgentValidationResult(string name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
name string

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
// Make the request
AgentValidationResult response = agentsClient.GetAgentValidationResult(name);

GetAgentValidationResultAsync(AgentValidationResultName, CallSettings)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(AgentValidationResultName name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
name AgentValidationResultName

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetAgentValidationResultAsync(AgentValidationResultName, CancellationToken)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(AgentValidationResultName name, CancellationToken cancellationToken)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
name AgentValidationResultName

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetAgentValidationResultAsync(GetAgentValidationResultRequest, CallSettings)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(GetAgentValidationResultRequest request, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
request GetAgentValidationResultRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentValidationResultRequest request = new GetAgentValidationResultRequest
{
    AgentValidationResultName = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(request);

GetAgentValidationResultAsync(GetAgentValidationResultRequest, CancellationToken)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(GetAgentValidationResultRequest request, CancellationToken cancellationToken)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
request GetAgentValidationResultRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentValidationResultRequest request = new GetAgentValidationResultRequest
{
    AgentValidationResultName = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(request);

GetAgentValidationResultAsync(string, CallSettings)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(string name, CallSettings callSettings = null)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
name string

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetAgentValidationResultAsync(string, CancellationToken)

public virtual Task<AgentValidationResult> GetAgentValidationResultAsync(string name, CancellationToken cancellationToken)

Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called.

Parameters
Name Description
name string

Required. The agent name. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/validationResult.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
// Make the request
AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

GetGenerativeSettings(AgentGenerativeSettingsName, string, CallSettings)

public virtual GenerativeSettings GetGenerativeSettings(AgentGenerativeSettingsName name, string languageCode, CallSettings callSettings = null)

Gets the generative settings for the agent.

Parameters
Name Description
name AgentGenerativeSettingsName

Required. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/generativeSettings.

languageCode string

Required. Language code of the generative settings.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerativeSettings

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
AgentGenerativeSettingsName name = AgentGenerativeSettingsName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
string languageCode = "";
// Make the request
GenerativeSettings response = agentsClient.GetGenerativeSettings(name, languageCode);

GetGenerativeSettings(GetGenerativeSettingsRequest, CallSettings)

public virtual GenerativeSettings GetGenerativeSettings(GetGenerativeSettingsRequest request, CallSettings callSettings = null)

Gets the generative settings for the agent.

Parameters
Name Description
request GetGenerativeSettingsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerativeSettings

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetGenerativeSettingsRequest request = new GetGenerativeSettingsRequest
{
    AgentGenerativeSettingsName = AgentGenerativeSettingsName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
GenerativeSettings response = agentsClient.GetGenerativeSettings(request);

GetGenerativeSettings(string, string, CallSettings)

public virtual GenerativeSettings GetGenerativeSettings(string name, string languageCode, CallSettings callSettings = null)

Gets the generative settings for the agent.

Parameters
Name Description
name string

Required. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/generativeSettings.

languageCode string

Required. Language code of the generative settings.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerativeSettings

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/generativeSettings";
string languageCode = "";
// Make the request
GenerativeSettings response = agentsClient.GetGenerativeSettings(name, languageCode);

GetGenerativeSettingsAsync(AgentGenerativeSettingsName, string, CallSettings)

public virtual Task<GenerativeSettings> GetGenerativeSettingsAsync(AgentGenerativeSettingsName name, string languageCode, CallSettings callSettings = null)

Gets the generative settings for the agent.

Parameters
Name Description
name AgentGenerativeSettingsName

Required. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/generativeSettings.

languageCode string

Required. Language code of the generative settings.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentGenerativeSettingsName name = AgentGenerativeSettingsName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
string languageCode = "";
// Make the request
GenerativeSettings response = await agentsClient.GetGenerativeSettingsAsync(name, languageCode);

GetGenerativeSettingsAsync(AgentGenerativeSettingsName, string, CancellationToken)

public virtual Task<GenerativeSettings> GetGenerativeSettingsAsync(AgentGenerativeSettingsName name, string languageCode, CancellationToken cancellationToken)

Gets the generative settings for the agent.

Parameters
Name Description
name AgentGenerativeSettingsName

Required. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/generativeSettings.

languageCode string

Required. Language code of the generative settings.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
AgentGenerativeSettingsName name = AgentGenerativeSettingsName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
string languageCode = "";
// Make the request
GenerativeSettings response = await agentsClient.GetGenerativeSettingsAsync(name, languageCode);

GetGenerativeSettingsAsync(GetGenerativeSettingsRequest, CallSettings)

public virtual Task<GenerativeSettings> GetGenerativeSettingsAsync(GetGenerativeSettingsRequest request, CallSettings callSettings = null)

Gets the generative settings for the agent.

Parameters
Name Description
request GetGenerativeSettingsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetGenerativeSettingsRequest request = new GetGenerativeSettingsRequest
{
    AgentGenerativeSettingsName = AgentGenerativeSettingsName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
GenerativeSettings response = await agentsClient.GetGenerativeSettingsAsync(request);

GetGenerativeSettingsAsync(GetGenerativeSettingsRequest, CancellationToken)

public virtual Task<GenerativeSettings> GetGenerativeSettingsAsync(GetGenerativeSettingsRequest request, CancellationToken cancellationToken)

Gets the generative settings for the agent.

Parameters
Name Description
request GetGenerativeSettingsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetGenerativeSettingsRequest request = new GetGenerativeSettingsRequest
{
    AgentGenerativeSettingsName = AgentGenerativeSettingsName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
GenerativeSettings response = await agentsClient.GetGenerativeSettingsAsync(request);

GetGenerativeSettingsAsync(string, string, CallSettings)

public virtual Task<GenerativeSettings> GetGenerativeSettingsAsync(string name, string languageCode, CallSettings callSettings = null)

Gets the generative settings for the agent.

Parameters
Name Description
name string

Required. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/generativeSettings.

languageCode string

Required. Language code of the generative settings.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/generativeSettings";
string languageCode = "";
// Make the request
GenerativeSettings response = await agentsClient.GetGenerativeSettingsAsync(name, languageCode);

GetGenerativeSettingsAsync(string, string, CancellationToken)

public virtual Task<GenerativeSettings> GetGenerativeSettingsAsync(string name, string languageCode, CancellationToken cancellationToken)

Gets the generative settings for the agent.

Parameters
Name Description
name string

Required. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/generativeSettings.

languageCode string

Required. Language code of the generative settings.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/generativeSettings";
string languageCode = "";
// Make the request
GenerativeSettings response = await agentsClient.GetGenerativeSettingsAsync(name, languageCode);

ListAgents(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAgentsResponse, Agent> ListAgents(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
Name Description
parent LocationName

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgents(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Agent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListAgentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgents(ListAgentsRequest, CallSettings)

public virtual PagedEnumerable<ListAgentsResponse, Agent> ListAgents(ListAgentsRequest request, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
Name Description
request ListAgentsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ListAgentsRequest request = new ListAgentsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgents(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Agent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListAgentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgents(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListAgentsResponse, Agent> ListAgents(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
Name Description
parent string

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgents(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Agent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListAgentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgentsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAgentsResponse, Agent> ListAgentsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
Name Description
parent LocationName

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListAgentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgentsAsync(ListAgentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListAgentsResponse, Agent> ListAgentsAsync(ListAgentsRequest request, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
Name Description
request ListAgentsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ListAgentsRequest request = new ListAgentsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedAsyncEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgentsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListAgentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListAgentsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAgentsResponse, Agent> ListAgentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all agents in the specified location.

Parameters
Name Description
parent string

Required. The location to list all agents for. Format: projects/<Project ID>/locations/<Location ID>.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListAgentsResponse, Agent> response = agentsClient.ListAgentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListAgentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Agent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Agent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Agent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

PollOnceExportAgent(string, CallSettings)

public virtual Operation<ExportAgentResponse, Struct> PollOnceExportAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportAgent.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportAgentResponseStruct

The result of polling the operation.

PollOnceExportAgentAsync(string, CallSettings)

public virtual Task<Operation<ExportAgentResponse, Struct>> PollOnceExportAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportAgent.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportAgentResponseStruct

A task representing the result of polling the operation.

PollOnceRestoreAgent(string, CallSettings)

public virtual Operation<Empty, Struct> PollOnceRestoreAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of RestoreAgent.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyStruct

The result of polling the operation.

PollOnceRestoreAgentAsync(string, CallSettings)

public virtual Task<Operation<Empty, Struct>> PollOnceRestoreAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of RestoreAgent.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyStruct

A task representing the result of polling the operation.

RestoreAgent(RestoreAgentRequest, CallSettings)

public virtual Operation<Empty, Struct> RestoreAgent(RestoreAgentRequest request, CallSettings callSettings = null)

Restores the specified agent from a binary file.

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. intents, entity types, flows) will be removed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request RestoreAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEmptyStruct

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    RestoreOption = RestoreAgentRequest.Types.RestoreOption.Unspecified,
};
// Make the request
Operation<Empty, Struct> response = agentsClient.RestoreAgent(request);

// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceRestoreAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

RestoreAgentAsync(RestoreAgentRequest, CallSettings)

public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CallSettings callSettings = null)

Restores the specified agent from a binary file.

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. intents, entity types, flows) will be removed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request RestoreAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    RestoreOption = RestoreAgentRequest.Types.RestoreOption.Unspecified,
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.RestoreAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceRestoreAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

RestoreAgentAsync(RestoreAgentRequest, CancellationToken)

public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CancellationToken cancellationToken)

Restores the specified agent from a binary file.

Replaces the current agent with a new one. Note that all existing resources in agent (e.g. intents, entity types, flows) will be removed.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request RestoreAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    AgentUri = "",
    RestoreOption = RestoreAgentRequest.Types.RestoreOption.Unspecified,
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.RestoreAgentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceRestoreAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateAgent(Agent, FieldMask, CallSettings)

public virtual Agent UpdateAgent(Agent agent, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
agent Agent

Required. The agent to update.

updateMask FieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
Agent agent = new Agent();
FieldMask updateMask = new FieldMask();
// Make the request
Agent response = agentsClient.UpdateAgent(agent, updateMask);

UpdateAgent(UpdateAgentRequest, CallSettings)

public virtual Agent UpdateAgent(UpdateAgentRequest request, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request UpdateAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Agent

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
UpdateAgentRequest request = new UpdateAgentRequest
{
    Agent = new Agent(),
    UpdateMask = new FieldMask(),
};
// Make the request
Agent response = agentsClient.UpdateAgent(request);

UpdateAgentAsync(Agent, FieldMask, CallSettings)

public virtual Task<Agent> UpdateAgentAsync(Agent agent, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
agent Agent

Required. The agent to update.

updateMask FieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
Agent agent = new Agent();
FieldMask updateMask = new FieldMask();
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(agent, updateMask);

UpdateAgentAsync(Agent, FieldMask, CancellationToken)

public virtual Task<Agent> UpdateAgentAsync(Agent agent, FieldMask updateMask, CancellationToken cancellationToken)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
agent Agent

Required. The agent to update.

updateMask FieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
Agent agent = new Agent();
FieldMask updateMask = new FieldMask();
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(agent, updateMask);

UpdateAgentAsync(UpdateAgentRequest, CallSettings)

public virtual Task<Agent> UpdateAgentAsync(UpdateAgentRequest request, CallSettings callSettings = null)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request UpdateAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
UpdateAgentRequest request = new UpdateAgentRequest
{
    Agent = new Agent(),
    UpdateMask = new FieldMask(),
};
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(request);

UpdateAgentAsync(UpdateAgentRequest, CancellationToken)

public virtual Task<Agent> UpdateAgentAsync(UpdateAgentRequest request, CancellationToken cancellationToken)

Updates the specified agent.

Note: You should always train flows prior to sending them queries. See the training documentation.

Parameters
Name Description
request UpdateAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgent

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
UpdateAgentRequest request = new UpdateAgentRequest
{
    Agent = new Agent(),
    UpdateMask = new FieldMask(),
};
// Make the request
Agent response = await agentsClient.UpdateAgentAsync(request);

UpdateGenerativeSettings(GenerativeSettings, FieldMask, CallSettings)

public virtual GenerativeSettings UpdateGenerativeSettings(GenerativeSettings generativeSettings, FieldMask updateMask, CallSettings callSettings = null)

Updates the generative settings for the agent.

Parameters
Name Description
generativeSettings GenerativeSettings

Required. Generative settings to update.

updateMask FieldMask

Optional. The mask to control which fields get updated. If the mask is not present, all fields will be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerativeSettings

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GenerativeSettings generativeSettings = new GenerativeSettings();
FieldMask updateMask = new FieldMask();
// Make the request
GenerativeSettings response = agentsClient.UpdateGenerativeSettings(generativeSettings, updateMask);

UpdateGenerativeSettings(UpdateGenerativeSettingsRequest, CallSettings)

public virtual GenerativeSettings UpdateGenerativeSettings(UpdateGenerativeSettingsRequest request, CallSettings callSettings = null)

Updates the generative settings for the agent.

Parameters
Name Description
request UpdateGenerativeSettingsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerativeSettings

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
UpdateGenerativeSettingsRequest request = new UpdateGenerativeSettingsRequest
{
    GenerativeSettings = new GenerativeSettings(),
    UpdateMask = new FieldMask(),
};
// Make the request
GenerativeSettings response = agentsClient.UpdateGenerativeSettings(request);

UpdateGenerativeSettingsAsync(GenerativeSettings, FieldMask, CallSettings)

public virtual Task<GenerativeSettings> UpdateGenerativeSettingsAsync(GenerativeSettings generativeSettings, FieldMask updateMask, CallSettings callSettings = null)

Updates the generative settings for the agent.

Parameters
Name Description
generativeSettings GenerativeSettings

Required. Generative settings to update.

updateMask FieldMask

Optional. The mask to control which fields get updated. If the mask is not present, all fields will be updated.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GenerativeSettings generativeSettings = new GenerativeSettings();
FieldMask updateMask = new FieldMask();
// Make the request
GenerativeSettings response = await agentsClient.UpdateGenerativeSettingsAsync(generativeSettings, updateMask);

UpdateGenerativeSettingsAsync(GenerativeSettings, FieldMask, CancellationToken)

public virtual Task<GenerativeSettings> UpdateGenerativeSettingsAsync(GenerativeSettings generativeSettings, FieldMask updateMask, CancellationToken cancellationToken)

Updates the generative settings for the agent.

Parameters
Name Description
generativeSettings GenerativeSettings

Required. Generative settings to update.

updateMask FieldMask

Optional. The mask to control which fields get updated. If the mask is not present, all fields will be updated.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GenerativeSettings generativeSettings = new GenerativeSettings();
FieldMask updateMask = new FieldMask();
// Make the request
GenerativeSettings response = await agentsClient.UpdateGenerativeSettingsAsync(generativeSettings, updateMask);

UpdateGenerativeSettingsAsync(UpdateGenerativeSettingsRequest, CallSettings)

public virtual Task<GenerativeSettings> UpdateGenerativeSettingsAsync(UpdateGenerativeSettingsRequest request, CallSettings callSettings = null)

Updates the generative settings for the agent.

Parameters
Name Description
request UpdateGenerativeSettingsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
UpdateGenerativeSettingsRequest request = new UpdateGenerativeSettingsRequest
{
    GenerativeSettings = new GenerativeSettings(),
    UpdateMask = new FieldMask(),
};
// Make the request
GenerativeSettings response = await agentsClient.UpdateGenerativeSettingsAsync(request);

UpdateGenerativeSettingsAsync(UpdateGenerativeSettingsRequest, CancellationToken)

public virtual Task<GenerativeSettings> UpdateGenerativeSettingsAsync(UpdateGenerativeSettingsRequest request, CancellationToken cancellationToken)

Updates the generative settings for the agent.

Parameters
Name Description
request UpdateGenerativeSettingsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerativeSettings

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
UpdateGenerativeSettingsRequest request = new UpdateGenerativeSettingsRequest
{
    GenerativeSettings = new GenerativeSettings(),
    UpdateMask = new FieldMask(),
};
// Make the request
GenerativeSettings response = await agentsClient.UpdateGenerativeSettingsAsync(request);

ValidateAgent(ValidateAgentRequest, CallSettings)

public virtual AgentValidationResult ValidateAgent(ValidateAgentRequest request, CallSettings callSettings = null)

Validates the specified agent and creates or updates validation results. The agent in draft version is validated. Please call this API after the training is completed to get the complete validation results.

Parameters
Name Description
request ValidateAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AgentValidationResult

The RPC response.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ValidateAgentRequest request = new ValidateAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = agentsClient.ValidateAgent(request);

ValidateAgentAsync(ValidateAgentRequest, CallSettings)

public virtual Task<AgentValidationResult> ValidateAgentAsync(ValidateAgentRequest request, CallSettings callSettings = null)

Validates the specified agent and creates or updates validation results. The agent in draft version is validated. Please call this API after the training is completed to get the complete validation results.

Parameters
Name Description
request ValidateAgentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ValidateAgentRequest request = new ValidateAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.ValidateAgentAsync(request);

ValidateAgentAsync(ValidateAgentRequest, CancellationToken)

public virtual Task<AgentValidationResult> ValidateAgentAsync(ValidateAgentRequest request, CancellationToken cancellationToken)

Validates the specified agent and creates or updates validation results. The agent in draft version is validated. Please call this API after the training is completed to get the complete validation results.

Parameters
Name Description
request ValidateAgentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAgentValidationResult

A Task containing the RPC response.

Example
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ValidateAgentRequest request = new ValidateAgentRequest
{
    AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
    LanguageCode = "",
};
// Make the request
AgentValidationResult response = await agentsClient.ValidateAgentAsync(request);