Basic Operations
You can list ReasoningEngine
instances, get a ReasoningEngine
instance, or
delete a ReasoningEngine
instance.
List ReasoningEngine
instances
Vertex AI SDK for Python
The following command lists all ReasoningEngine
instances for a given project
and location:
reasoning_engines.ReasoningEngine.list()
The following code filters the list of ReasoningEngine
instances by display_name
:
reasoning_engines.ReasoningEngine.list(filter='display_name="DISPLAY_NAME"')
For example,
reasoning_engines.ReasoningEngine.list(filter='display_name="Demo Langchain Application"')
REST
Execute the following curl
command to list all ReasoningEngine
instances for a given project and location:
curl \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/reasoningEngines
Get a ReasoningEngine
instance
Each ReasoningEngine
instance has a unique RESOURCE_ID
identifier. To learn more, see
Deploy the application.
Vertex AI SDK for Python
The following code lets you get a specific ReasoningEngine
resource:
remote_app = reasoning_engines.ReasoningEngine("RESOURCE_ID")
Alternately, you can provide the entire resource name:
remote_app = reasoning_engines.ReasoningEngine(
"projects/PROJECT_ID/locations/LOCATION/reasoningEngines/RESOURCE_ID"
)
REST
Execute the following curl
command to get a specific ReasoningEngine
resource:
curl \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/RESOURCE_ID
Update a ReasoningEngine
instance
Vertex AI SDK for Python
The following code lets you update a ReasoningEngine
instance that
was set to the remote_app
variable:
remote_app.update(
reasoning_engine=UPDATED_AGENT_INSTANCE, # Optional.
requirements=REQUIREMENTS, # Optional.
display_name="DISPLAY_NAME", # Optional.
description="DESCRIPTION", # Optional.
extra_packages=EXTRA_PACKAGES, # Optional.
)
The arguments are the same as when you are deploying the application. You can find details in the API reference.
REST
Execute the following curl
command to update the display name and
description of a ReasoningEngine
resource:
curl \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/RESOURCE_ID?update_mask="display_name,description" \
-d '{ "displayName": "DISPLAY_NAME", "description": "DESCRIPTION" }'
Delete a ReasoningEngine
instance
Vertex AI SDK for Python
The following code lets you delete a ReasoningEngine
instance that
was set to the remote_app
variable:
remote_app.delete()
REST
Each ReasoningEngine
instance has a unique RESOURCE_ID
identifier. To learn more, see Deploy the application.
Execute the following curl
command to delete a specific ReasoningEngine
instance:
curl \
-X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/reasoningEngines/RESOURCE_ID
Tracing for a LangchainAgent
instance
To enable tracing for LangchainAgent
applications, specify
enable_tracing=True
when you
develop the application. For
example:
agent = reasoning_engines.LangchainAgent(
model=model, # Required.
tools=[get_exchange_rate], # Optional.
enable_tracing=True, # [New] Optional.
)
agent.query(input="What is the exchange rate from US dollars to Swedish currency?")
This will export traces to Cloud Trace under the project in Set up your Google Cloud project.
Viewing Traces
You can find the traces in Trace Explorer.
The following Gantt chart shows the trace result of the example application from Develop an application:
The first row in the Gantt chart is for the trace, and there exists one row for each span in the trace, describing how long each sub-operation took.
To learn more, see the documentation for Trace Explorer.
Enable Tracing for a Custom Application
To enable tracing for custom applications, you can use Open Telemetry Google Cloud Integration in combination with an instrumentation framework such as OpenInference or OpenLLMetry.
Quotas and limits
Some attribute values might get truncated when they reach quota limits. For details, visit Cloud Trace Quota.
Cost
Cloud Trace has a free tier. Beyond the free tier, visit Cloud Trace Pricing.