Skip to content

Commit dccfd08

Browse files
committed
Small readme tweaks
1 parent e1499b0 commit dccfd08

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

samples/langgraph-sql-agent/README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,23 @@ initially empty. It is built with the the LangGraph prebuilt [ReAct
1010
Agent](https://langchain-ai.github.io/langgraph/agents/agents/#basic-configuration#code) and the
1111
[SQLDatabaseToolkit](https://python.langchain.com/docs/integrations/tools/sql_database/).
1212

13-
## Permissions
13+
## APIs and Permissions
14+
15+
Enable the relevant Cloud Observability APIs if they aren't already enabled.
16+
```sh
17+
gcloud services enable telemetry.googleapis.com logging.googleapis.com monitoring.googleapis.com cloudtrace.googleapis.com
18+
```
1419

1520
This sample writes to Cloud Logging, Cloud Monitoring, and Cloud Trace. Grant yourself the
1621
following roles to run the example:
1722
- `roles/logging.logWriter` – see https://cloud.google.com/logging/docs/access-control#permissions_and_roles
1823
- `roles/monitoring.metricWriter` – see https://cloud.google.com/monitoring/access-control#predefined_roles
19-
- `roles/cloudtrace.agent` – see https://cloud.google.com/trace/docs/iam#trace-roles
24+
- `roles/telemetry.writer` – see https://cloud.google.com/trace/docs/iam#telemetry-roles
2025

2126
## Running the example
2227

2328
The sample can easily be run in Cloud Shell. You can also use
24-
[Application Default Credentials][ADC] locally.
25-
29+
[Application Default Credentials][ADC] locally. Clone and set environment variables:
2630
```sh
2731
git clone https://github.com/GoogleCloudPlatform/opentelemetry-operations-python.git
2832
cd opentelemetry-operations-python/samples/langgraph-sql-agent
@@ -31,13 +35,26 @@ cd opentelemetry-operations-python/samples/langgraph-sql-agent
3135
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
3236
# Capture application logs automatically
3337
export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
38+
```
39+
40+
Create a virtual environment and run the sample:
41+
```sh
42+
python -m venv venv/
43+
source venv/bin/activate
44+
pip install -r requirements.txt
45+
python main.py
46+
```
47+
48+
Alternatively if you have [`uv`](https://docs.astral.sh/uv/) installed:
49+
50+
```sh
3451
uv run main.py
3552
```
3653

3754
## Viewing the results
3855

3956
To view the generated traces with [Generative AI
4057
events](https://cloud.google.com/trace/docs/finding-traces#view_generative_ai_events) in the
41-
GCP console, use the [Trace Explorer](https://cloud.google.com/trace/docs/finding-traces).
58+
GCP console, use the [Trace Explorer](https://cloud.google.com/trace/docs/finding-traces). Filter for spans named `invoke agent`.
4259

4360
[ADC]: https://cloud.google.com/docs/authentication/application-default-credentials

0 commit comments

Comments
 (0)