Skip to content

Commit 503edcf

Browse files
authored
Merge branch 'main' into copilot/rebase-onto-latest-main
2 parents e7a44aa + 486e8cc commit 503edcf

File tree

85 files changed

+15031
-3416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+15031
-3416
lines changed

.github/workflows/loongsuite_lint_0.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ jobs:
7070
- name: Run tests
7171
run: tox -c tox-loongsuite.ini -e lint-loongsuite-instrumentation-dashscope
7272

73+
lint-loongsuite-instrumentation-claude-agent-sdk:
74+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk
75+
runs-on: ubuntu-latest
76+
timeout-minutes: 30
77+
steps:
78+
- name: Checkout repo @ SHA - ${{ github.sha }}
79+
uses: actions/checkout@v4
80+
81+
- name: Set up Python 3.13
82+
uses: actions/setup-python@v5
83+
with:
84+
python-version: "3.13"
85+
86+
- name: Install tox
87+
run: pip install tox-uv
88+
89+
- name: Run tests
90+
run: tox -c tox-loongsuite.ini -e lint-loongsuite-instrumentation-claude-agent-sdk
91+
7392
lint-loongsuite-instrumentation-mem0:
7493
name: LoongSuite loongsuite-instrumentation-mem0
7594
runs-on: ubuntu-latest

.github/workflows/loongsuite_test_0.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,158 @@ jobs:
374374
- name: Run tests
375375
run: tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-dashscope-latest -- -ra
376376

377+
py310-test-loongsuite-instrumentation-claude-agent-sdk-oldest_ubuntu-latest:
378+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-oldest 3.10 Ubuntu
379+
runs-on: ubuntu-latest
380+
timeout-minutes: 30
381+
steps:
382+
- name: Checkout repo @ SHA - ${{ github.sha }}
383+
uses: actions/checkout@v4
384+
385+
- name: Set up Python 3.10
386+
uses: actions/setup-python@v5
387+
with:
388+
python-version: "3.10"
389+
390+
- name: Install tox
391+
run: pip install tox-uv
392+
393+
- name: Run tests
394+
run: tox -c tox-loongsuite.ini -e py310-test-loongsuite-instrumentation-claude-agent-sdk-oldest -- -ra
395+
396+
py310-test-loongsuite-instrumentation-claude-agent-sdk-latest_ubuntu-latest:
397+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-latest 3.10 Ubuntu
398+
runs-on: ubuntu-latest
399+
timeout-minutes: 30
400+
steps:
401+
- name: Checkout repo @ SHA - ${{ github.sha }}
402+
uses: actions/checkout@v4
403+
404+
- name: Set up Python 3.10
405+
uses: actions/setup-python@v5
406+
with:
407+
python-version: "3.10"
408+
409+
- name: Install tox
410+
run: pip install tox-uv
411+
412+
- name: Run tests
413+
run: tox -c tox-loongsuite.ini -e py310-test-loongsuite-instrumentation-claude-agent-sdk-latest -- -ra
414+
415+
py311-test-loongsuite-instrumentation-claude-agent-sdk-oldest_ubuntu-latest:
416+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-oldest 3.11 Ubuntu
417+
runs-on: ubuntu-latest
418+
timeout-minutes: 30
419+
steps:
420+
- name: Checkout repo @ SHA - ${{ github.sha }}
421+
uses: actions/checkout@v4
422+
423+
- name: Set up Python 3.11
424+
uses: actions/setup-python@v5
425+
with:
426+
python-version: "3.11"
427+
428+
- name: Install tox
429+
run: pip install tox-uv
430+
431+
- name: Run tests
432+
run: tox -c tox-loongsuite.ini -e py311-test-loongsuite-instrumentation-claude-agent-sdk-oldest -- -ra
433+
434+
py311-test-loongsuite-instrumentation-claude-agent-sdk-latest_ubuntu-latest:
435+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-latest 3.11 Ubuntu
436+
runs-on: ubuntu-latest
437+
timeout-minutes: 30
438+
steps:
439+
- name: Checkout repo @ SHA - ${{ github.sha }}
440+
uses: actions/checkout@v4
441+
442+
- name: Set up Python 3.11
443+
uses: actions/setup-python@v5
444+
with:
445+
python-version: "3.11"
446+
447+
- name: Install tox
448+
run: pip install tox-uv
449+
450+
- name: Run tests
451+
run: tox -c tox-loongsuite.ini -e py311-test-loongsuite-instrumentation-claude-agent-sdk-latest -- -ra
452+
453+
py312-test-loongsuite-instrumentation-claude-agent-sdk-oldest_ubuntu-latest:
454+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-oldest 3.12 Ubuntu
455+
runs-on: ubuntu-latest
456+
timeout-minutes: 30
457+
steps:
458+
- name: Checkout repo @ SHA - ${{ github.sha }}
459+
uses: actions/checkout@v4
460+
461+
- name: Set up Python 3.12
462+
uses: actions/setup-python@v5
463+
with:
464+
python-version: "3.12"
465+
466+
- name: Install tox
467+
run: pip install tox-uv
468+
469+
- name: Run tests
470+
run: tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-claude-agent-sdk-oldest -- -ra
471+
472+
py312-test-loongsuite-instrumentation-claude-agent-sdk-latest_ubuntu-latest:
473+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-latest 3.12 Ubuntu
474+
runs-on: ubuntu-latest
475+
timeout-minutes: 30
476+
steps:
477+
- name: Checkout repo @ SHA - ${{ github.sha }}
478+
uses: actions/checkout@v4
479+
480+
- name: Set up Python 3.12
481+
uses: actions/setup-python@v5
482+
with:
483+
python-version: "3.12"
484+
485+
- name: Install tox
486+
run: pip install tox-uv
487+
488+
- name: Run tests
489+
run: tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-claude-agent-sdk-latest -- -ra
490+
491+
py313-test-loongsuite-instrumentation-claude-agent-sdk-oldest_ubuntu-latest:
492+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-oldest 3.13 Ubuntu
493+
runs-on: ubuntu-latest
494+
timeout-minutes: 30
495+
steps:
496+
- name: Checkout repo @ SHA - ${{ github.sha }}
497+
uses: actions/checkout@v4
498+
499+
- name: Set up Python 3.13
500+
uses: actions/setup-python@v5
501+
with:
502+
python-version: "3.13"
503+
504+
- name: Install tox
505+
run: pip install tox-uv
506+
507+
- name: Run tests
508+
run: tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-claude-agent-sdk-oldest -- -ra
509+
510+
py313-test-loongsuite-instrumentation-claude-agent-sdk-latest_ubuntu-latest:
511+
name: LoongSuite loongsuite-instrumentation-claude-agent-sdk-latest 3.13 Ubuntu
512+
runs-on: ubuntu-latest
513+
timeout-minutes: 30
514+
steps:
515+
- name: Checkout repo @ SHA - ${{ github.sha }}
516+
uses: actions/checkout@v4
517+
518+
- name: Set up Python 3.13
519+
uses: actions/setup-python@v5
520+
with:
521+
python-version: "3.13"
522+
523+
- name: Install tox
524+
run: pip install tox-uv
525+
526+
- name: Run tests
527+
run: tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-claude-agent-sdk-latest -- -ra
528+
377529
py310-test-loongsuite-instrumentation-mem0-oldest_ubuntu-latest:
378530
name: LoongSuite loongsuite-instrumentation-mem0-oldest 3.10 Ubuntu
379531
runs-on: ubuntu-latest

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ _build/
5959
.mypy_cache/
6060
target
6161

62+
# pyright local config
63+
pyrightconfig.json
64+
6265
# Benchmark result files
6366
*-benchmark.json
6467

6568
# LoongSuite Extension
66-
.cursor/
69+
.cursor/
70+
upload/
71+
upload_*_test/

CHANGELOG-loongsuite.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fixed
1515

16-
- `loongsuite-instrumentation-google-adk`: Add initial support for Google Agent Development Kit (ADK) ([#71](https://github.com/alibaba/loongsuite-python-agent/pull/71))
17-
16+
- `loongsuite-instrumentation-agno`: fix aresponse missing await and double wrapped() calls in stream methods
17+
([#107](https://github.com/alibaba/loongsuite-python-agent/pull/107))
18+
- `loongsuite-instrumentation-mem0`: fix unittest
19+
([#98](https://github.com/alibaba/loongsuite-python-agent/pull/98))
1820
- `loongsuite-instrumentation-mem0`: use memory handler
1921
([#89](https://github.com/alibaba/loongsuite-python-agent/pull/89))
20-
2122
- Add `from __future__ import annotations` to fix Python 3.9 compatibility for union type syntax (`X | Y`)
2223
([#80](https://github.com/alibaba/loongsuite-python-agent/pull/80))
2324

2425
# Added
2526

27+
- `loongsuite-instrumentation-google-adk`: Add initial support for Google Agent Development Kit (ADK)
28+
([#71](https://github.com/alibaba/loongsuite-python-agent/pull/71))
29+
- `loongsuite-instrumentation-mem0`: add hook extension
30+
([#95](https://github.com/alibaba/loongsuite-python-agent/pull/95))
2631
- `loongsuite-instrumentation-mem0`: add support for mem0
2732
([#67](https://github.com/alibaba/loongsuite-python-agent/pull/67))

README.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Loongsuite Python Agent is also a customized distribution of upstream [OTel Pyth
1515
The implementation follows the latest GenAI [semantic conventions](https://github.com/open-telemetry/semantic-conventions).
1616

1717
## Supported AI Frameworks and components
18-
* [AgentScope](https://github.com/agentscope-ai/agentscope): [Guide](instrumentation-genai/opentelemetry-instrumentation-agentscope/README.md)
19-
* [Dify](https://github.com/langgenius/dify): [Guide](instrumentation-genai/opentelemetry-instrumentation-dify/README.md)
18+
* [AgentScope](https://github.com/agentscope-ai/agentscope): [Guide](instrumentation-loongsuite/loongsuite-instrumentation-agentscope/README.md)
19+
* [Dify](https://github.com/langgenius/dify): [Guide](instrumentation-loongsuite/loongsuite-instrumentation-dify/README.md)
2020
* [LangChain](https://github.com/langchain-ai/langchain): [Guide](instrumentation-genai/opentelemetry-instrumentation-langchain/README.md)
2121
* [MCP Client](https://github.com/modelcontextprotocol/python-sdk)
22-
* [Agno](https://github.com/agno-agi/agno): [Guide](instrumentation-genai/opentelemetry-instrumentation-agno/README.md)
22+
* [Agno](https://github.com/agno-agi/agno): [Guide](instrumentation-loongsuite/loongsuite-instrumentation-agno/README.md)
2323
* [OpenAI](https://github.com/openai/openai-python): [Guide](instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst)
2424

2525
## Quick start
@@ -41,7 +41,7 @@ pip install agentscope
4141
#AgentScopeInstrumentor
4242
git clone https://github.com/alibaba/loongsuite-python-agent.git
4343
cd loongsuite-python-agent
44-
pip install ./instrumentation-genai/opentelemetry-instrumentation-agentscope
44+
pip install ./instrumentation-loongsuite/loongsuite-instrumentation-agentscope
4545
```
4646

4747
### RUN
@@ -144,7 +144,7 @@ If everything is working correctly, you should see logs similar to th
144144
}
145145
```
146146

147-
### Forwarding OTLP Data to Jaeger via LoongCollector
147+
### (Optional) Forwarding OTLP Data to Jaeger via LoongCollector
148148

149149
#### Launch Jaeger
150150

@@ -221,6 +221,60 @@ Access the Jaeger UI to view the collected trace data. You should no
221221

222222
![image.png](docs/_assets/img/quickstart-results.png)
223223

224+
### Using AgentScope Studio to View Tracing Data
225+
226+
[AgentScope Studio](https://github.com/agentscope-ai/agentscope-studio) provides a web-based interface for visualizing and analyzing tracing data from AgentScope applications.
227+
228+
#### Installation
229+
230+
Install AgentScope Studio:
231+
232+
```shell
233+
pip install agentscope-studio
234+
```
235+
236+
#### Launch AgentScope Studio
237+
238+
Start the AgentScope Studio server:
239+
240+
```shell
241+
as_studio
242+
```
243+
244+
AgentScope Studio will start and display the OTLP endpoint URL (typically `http://127.0.0.1:31415`).
245+
246+
#### Export AgentScope Data to AgentScope Studio
247+
248+
Configure your AgentScope application to export telemetry data to AgentScope Studio using OTLP. Use the endpoint URL displayed by AgentScope Studio when it starts:
249+
250+
```shell
251+
loongsuite-instrument \
252+
--traces_exporter otlp \
253+
--metrics_exporter otlp \
254+
--exporter_otlp_protocol http/protobuf \
255+
--exporter_otlp_endpoint http://127.0.0.1:31415 \
256+
--service_name demo \
257+
python demo.py
258+
```
259+
260+
Alternatively, you can use environment variables:
261+
262+
```shell
263+
export OTEL_SERVICE_NAME=demo
264+
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
265+
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:31415
266+
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://127.0.0.1:31415
267+
268+
loongsuite-instrument \
269+
--traces_exporter otlp \
270+
--metrics_exporter otlp \
271+
python demo.py
272+
```
273+
274+
The web interface will display the collected traces and metrics, allowing you to view and analyze the tracing data from your AgentScope applications.
275+
276+
For more details, please refer to the [AgentScope Studio documentation](https://github.com/agentscope-ai/agentscope-studio).
277+
224278
## Community
225279

226280
We are looking forward to your feedback and suggestions. You can join

instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/requirements.oldest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ opentelemetry-api==1.37
6969
opentelemetry-sdk==1.37
7070
opentelemetry-semantic-conventions==0.58b0
7171
opentelemetry-instrumentation==0.58b0
72-
opentelemetry-util-genai[upload]==0.2b0
72+
-e util/opentelemetry-util-genai[upload] # LoongSuite Extension: use local version with ensure_ascii=False
7373
fsspec==2025.9.0
7474

7575
-e instrumentation-genai/opentelemetry-instrumentation-vertexai[instruments]

instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/test_function_calling_experimental.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def test_tool_events(
135135
spans = span_exporter.get_finished_spans()
136136
assert len(spans) == 1
137137
assert spans[0].name == "chat gemini-2.5-pro"
138+
# fmt: off # LoongSuite Extension: preserve non-ASCII characters in test expectation
138139
assert dict(spans[0].attributes) == {
139140
"gen_ai.operation.name": "chat",
140141
"gen_ai.request.model": "gemini-2.5-pro",
@@ -145,8 +146,9 @@ def test_tool_events(
145146
"server.address": "us-central1-aiplatform.googleapis.com",
146147
"server.port": 443,
147148
"gen_ai.input.messages": '[{"role":"user","parts":[{"content":"Get weather details in New Delhi and San Francisco?","type":"text"}]},{"role":"model","parts":[{"arguments":{"location":"New Delhi"},"name":"get_current_weather","id":"get_current_weather_0","type":"tool_call"},{"arguments":{"location":"San Francisco"},"name":"get_current_weather","id":"get_current_weather_1","type":"tool_call"}]},{"role":"user","parts":[{"response":{"content":"{\\"temperature\\": 35, \\"unit\\": \\"C\\"}"},"id":"get_current_weather_0","type":"tool_call_response"},{"response":{"content":"{\\"temperature\\": 25, \\"unit\\": \\"C\\"}"},"id":"get_current_weather_1","type":"tool_call_response"}]}]',
148-
"gen_ai.output.messages": '[{"role":"model","parts":[{"content":"The current temperature in New Delhi is 35\\u00b0C, and in San Francisco, it is 25\\u00b0C.","type":"text"}],"finish_reason":"stop"}]',
149+
"gen_ai.output.messages": '[{"role":"model","parts":[{"content":"The current temperature in New Delhi is 35°C, and in San Francisco, it is 25°C.","type":"text"}],"finish_reason":"stop"}]',
149150
}
151+
# fmt: on
150152
logs = log_exporter.get_finished_logs()
151153
assert len(logs) == 1
152154
log = logs[0].log_record

instrumentation-loongsuite/loongsuite-instrumentation-agentscope/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Fixed
11+
- Fix LLM message content capture in spans ([#91](https://github.com/alibaba/loongsuite-python-agent/pull/91))
12+
1013
### Breaking Changes
1114
- **Minimum AgentScope version requirement**: Only supports AgentScope 1.0.0 and above. Previous 0.x versions are not supported.
1215

instrumentation-loongsuite/loongsuite-instrumentation-agentscope/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ pip install agentscope
2020

2121
# Install this instrumentation
2222
pip install ./instrumentation-loongsuite/loongsuite-instrumentation-agentscope
23+
24+
# Note: This instrumentation uses ExtendedTelemetryHandler from opentelemetry-util-genai
25+
pip install ./util/opentelemetry-util-genai
2326
```
2427

2528
## Usage
@@ -67,6 +70,9 @@ opentelemetry-instrument python your_app.py
6770
Control message content capture using environment variables:
6871

6972
```bash
73+
# Enable experimental GenAI semantic conventions
74+
export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
75+
7076
# Capture content in spans only
7177
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY
7278

@@ -90,13 +96,13 @@ export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=NO_CONTENT
9096
## Visualization
9197

9298
Export telemetry data to:
93-
- [Aliyun XTrace](https://www.aliyun.com/product/xtrace)
99+
- [Alibaba Cloud Managed Service for OpenTelemetry](https://www.aliyun.com/product/xtrace)
94100
- [AgentScope Studio](https://github.com/agentscope-ai/agentscope-studio)
95101
- Any OpenTelemetry-compatible backend (Jaeger, Zipkin, etc.)
96102

97103
## Examples
98104

99-
See the [examples directory](../../examples/) for complete usage examples.
105+
See the [main README](https://github.com/alibaba/loongsuite-python-agent/blob/main/README.md) for complete usage examples.
100106

101107
## License
102108

0 commit comments

Comments
 (0)