ioa-observe-sdk 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ioa_observe_sdk-1.0.2/ioa_observe_sdk.egg-info → ioa_observe_sdk-1.0.3}/PKG-INFO +9 -78
- ioa_observe_sdk-1.0.3/README.md +83 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/tracing/tracing.py +1 -1
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3/ioa_observe_sdk.egg-info}/PKG-INFO +9 -78
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe_sdk.egg-info/requires.txt +5 -5
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/pyproject.toml +6 -6
- ioa_observe_sdk-1.0.2/README.md +0 -152
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/LICENSE.md +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/client/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/client/client.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/client/http.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/config/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/connectors/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/connectors/slim.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/decorators/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/decorators/base.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/decorators/util.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/instrumentations/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/instrumentations/slim.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/instruments.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/logging/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/logging/logging.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agent.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/agent_connections.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/availability.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/heuristics.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/recovery_tracker.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/tool_call_tracker.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/tracker.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/metrics.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/telemetry.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/tracing/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/tracing/content_allow_list.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/tracing/context_manager.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/tracing/manual.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/utils/__init__.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/utils/const.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/utils/in_memory_span_exporter.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/utils/json_encoder.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/utils/package_check.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/version.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe_sdk.egg-info/SOURCES.txt +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe_sdk.egg-info/dependency_links.txt +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe_sdk.egg-info/top_level.txt +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/setup.cfg +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/tests/test_client.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/tests/test_instrumentor.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/tests/test_manual_instrumentation.py +0 -0
- {ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ioa-observe-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: IOA Observability SDK
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -41,16 +41,16 @@ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc==1.33.1
|
|
|
41
41
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http==1.33.1
|
|
42
42
|
Requires-Dist: opentelemetry-instrumentation
|
|
43
43
|
Requires-Dist: opentelemetry-instrumentation-logging==0.54b1
|
|
44
|
-
Requires-Dist: opentelemetry-instrumentation-openai==0.40.
|
|
45
|
-
Requires-Dist: opentelemetry-instrumentation-llamaindex==0.40.
|
|
46
|
-
Requires-Dist: opentelemetry-instrumentation-ollama==0.40.
|
|
47
|
-
Requires-Dist: opentelemetry-instrumentation-langchain==0.40.
|
|
44
|
+
Requires-Dist: opentelemetry-instrumentation-openai==0.40.8
|
|
45
|
+
Requires-Dist: opentelemetry-instrumentation-llamaindex==0.40.8
|
|
46
|
+
Requires-Dist: opentelemetry-instrumentation-ollama==0.40.8
|
|
47
|
+
Requires-Dist: opentelemetry-instrumentation-langchain==0.40.8
|
|
48
48
|
Requires-Dist: opentelemetry-instrumentation-threading==00.54b1
|
|
49
49
|
Requires-Dist: opentelemetry-instrumentation-urllib3==0.54b1
|
|
50
50
|
Requires-Dist: opentelemetry-proto==1.33.1
|
|
51
51
|
Requires-Dist: opentelemetry-sdk==1.33.1
|
|
52
52
|
Requires-Dist: opentelemetry-semantic-conventions==0.54b1
|
|
53
|
-
Requires-Dist: opentelemetry-semantic-conventions-ai==0.4.
|
|
53
|
+
Requires-Dist: opentelemetry-semantic-conventions-ai==0.4.9
|
|
54
54
|
Requires-Dist: opentelemetry-util-http==0.54b1
|
|
55
55
|
Requires-Dist: packaging==24.2
|
|
56
56
|
Requires-Dist: propcache==0.3.0
|
|
@@ -90,8 +90,9 @@ IOA observability SDK for your multi-agentic application.
|
|
|
90
90
|
## Table of Contents
|
|
91
91
|
|
|
92
92
|
- [Installation](#installation)
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
93
|
+
- [Dev](#dev)
|
|
94
|
+
- [Testing](#testing)
|
|
95
|
+
- [Getting Started](#getting-started)
|
|
95
96
|
- [Contributing](#contributing)
|
|
96
97
|
|
|
97
98
|
## Installation
|
|
@@ -156,76 +157,6 @@ OPENAI_API_KEY=<KEY> make test
|
|
|
156
157
|
For getting started with the SDK, please refer to the [Getting Started](https://github.com/agntcy/observe/blob/main/GETTING-STARTED.md)
|
|
157
158
|
file. It contains detailed instructions on how to set up and use the SDK effectively.
|
|
158
159
|
|
|
159
|
-
## SLIM-Based Multi-Agentic Systems
|
|
160
|
-
|
|
161
|
-
For distributed agent systems using SLIM protocol, additional instrumentation is available:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### Initializing the SLIM Connector with your agent
|
|
165
|
-
|
|
166
|
-
```python
|
|
167
|
-
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
|
|
168
|
-
from ioa_observe.sdk.instrumentations.slim import SLIMInstrumentor
|
|
169
|
-
|
|
170
|
-
# Initialize SLIM connector
|
|
171
|
-
slim_connector = SLIMConnector(
|
|
172
|
-
remote_org="cisco",
|
|
173
|
-
remote_namespace="default",
|
|
174
|
-
shared_space="chat",
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
# Register agents with the connector
|
|
178
|
-
slim_connector.register("remote_client_agent")
|
|
179
|
-
|
|
180
|
-
# Instrument SLIM communications
|
|
181
|
-
SLIMInstrumentor().instrument()
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Receiving Messages with a Callback
|
|
185
|
-
|
|
186
|
-
Add the decorator `process_slim_msg` to the callback function to process incoming messages. This function will be called whenever a message is received in the shared space.
|
|
187
|
-
|
|
188
|
-
```python
|
|
189
|
-
|
|
190
|
-
# Define a callback to process incoming messages
|
|
191
|
-
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
|
|
192
|
-
import json
|
|
193
|
-
from typing import Dict, Any
|
|
194
|
-
|
|
195
|
-
@process_slim_msg("remote_client_agent")
|
|
196
|
-
async def send_and_recv(msg) -> Dict[str, Any]:
|
|
197
|
-
"""Send message to remote endpoint and wait for reply."""
|
|
198
|
-
gateway = GatewayHolder.gateway
|
|
199
|
-
session_info = GatewayHolder.session_info
|
|
200
|
-
|
|
201
|
-
if gateway is not None:
|
|
202
|
-
await gateway.publish(session_info, msg.encode(), "cisco", "default", "server")
|
|
203
|
-
async with gateway:
|
|
204
|
-
_, recv = await gateway.receive(session=session_info.id)
|
|
205
|
-
else:
|
|
206
|
-
raise RuntimeError("Gateway is not initialized yet!")
|
|
207
|
-
|
|
208
|
-
response_data = json.loads(recv.decode("utf8"))
|
|
209
|
-
return {"messages": response_data.get("messages", [])}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Starting the Message Receiver
|
|
213
|
-
|
|
214
|
-
```python
|
|
215
|
-
# Start receiving messages from the SLIM shared space
|
|
216
|
-
await slim.receive(callback=on_message_received)
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### Publishing Messages
|
|
220
|
-
|
|
221
|
-
```python
|
|
222
|
-
# Publish a message to the SLIM shared space
|
|
223
|
-
message = {"type": "ChatMessage", "author": "moderator", "message": "Hello, world!"}
|
|
224
|
-
await slim.publish(msg=json.dumps(message).encode("utf-8"))
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
We will observe various events and metrics being sent to the Otel collector as we interact with other agents in the shared space via SLIM.
|
|
228
|
-
|
|
229
160
|
## Contributing
|
|
230
161
|
|
|
231
162
|
Contributions are welcome! Please follow these steps to contribute:
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Observe-SDK
|
|
2
|
+
|
|
3
|
+
IOA observability SDK for your multi-agentic application.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Dev](#dev)
|
|
9
|
+
- [Testing](#testing)
|
|
10
|
+
- [Getting Started](#getting-started)
|
|
11
|
+
- [Contributing](#contributing)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
To install the package via PyPI, simply run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install ioa_observe_sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Alternatively, to download the SDK from git, you could also use the following command. Ensure you have `uv` installed in your environment.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv add "git+https://github.com/agntcy/observe"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Dev
|
|
28
|
+
|
|
29
|
+
To get started with development, start a Clickhouse DB and an OTel collector container locally using docker-compose like so:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
cd deploy/
|
|
33
|
+
docker compose up -d
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Ensure the contents of `otel-collector.yaml` is correct.
|
|
37
|
+
|
|
38
|
+
Check the logs of the collector to ensure it is running correctly:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
docker logs -f otel-collector
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Create a `.env` file with the following content:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
OTLP_HTTP_ENDPOINT=http://localhost:4318
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Install the dependencies and activate the virtual environment:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
set -a
|
|
54
|
+
source .env
|
|
55
|
+
set +a
|
|
56
|
+
|
|
57
|
+
python3 -m venv .venv
|
|
58
|
+
source .venv/bin/activate
|
|
59
|
+
uv sync
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Testing
|
|
63
|
+
|
|
64
|
+
To run the unit tests, ensure you have the `OPENAI_API_KEY` set in your environment. You can run the tests using the following command:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
OPENAI_API_KEY=<KEY> make test
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Getting Started
|
|
71
|
+
|
|
72
|
+
For getting started with the SDK, please refer to the [Getting Started](https://github.com/agntcy/observe/blob/main/GETTING-STARTED.md)
|
|
73
|
+
file. It contains detailed instructions on how to set up and use the SDK effectively.
|
|
74
|
+
|
|
75
|
+
## Contributing
|
|
76
|
+
|
|
77
|
+
Contributions are welcome! Please follow these steps to contribute:
|
|
78
|
+
|
|
79
|
+
1. Fork the repository.
|
|
80
|
+
2. Create a new branch (`git checkout -b feature-branch`).
|
|
81
|
+
3. Commit your changes (`git commit -am 'Add new feature'`).
|
|
82
|
+
4. Push to the branch (`git push origin feature-branch`).
|
|
83
|
+
5. Create a new Pull Request.
|
|
@@ -751,7 +751,7 @@ def init_google_generativeai_instrumentor():
|
|
|
751
751
|
|
|
752
752
|
def init_langchain_instrumentor():
|
|
753
753
|
try:
|
|
754
|
-
if is_package_installed("langchain"):
|
|
754
|
+
if is_package_installed("langchain") or is_package_installed("langgraph"):
|
|
755
755
|
Telemetry().capture("instrumentation:langchain:init")
|
|
756
756
|
from opentelemetry.instrumentation.langchain import LangchainInstrumentor
|
|
757
757
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ioa-observe-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: IOA Observability SDK
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -41,16 +41,16 @@ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc==1.33.1
|
|
|
41
41
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http==1.33.1
|
|
42
42
|
Requires-Dist: opentelemetry-instrumentation
|
|
43
43
|
Requires-Dist: opentelemetry-instrumentation-logging==0.54b1
|
|
44
|
-
Requires-Dist: opentelemetry-instrumentation-openai==0.40.
|
|
45
|
-
Requires-Dist: opentelemetry-instrumentation-llamaindex==0.40.
|
|
46
|
-
Requires-Dist: opentelemetry-instrumentation-ollama==0.40.
|
|
47
|
-
Requires-Dist: opentelemetry-instrumentation-langchain==0.40.
|
|
44
|
+
Requires-Dist: opentelemetry-instrumentation-openai==0.40.8
|
|
45
|
+
Requires-Dist: opentelemetry-instrumentation-llamaindex==0.40.8
|
|
46
|
+
Requires-Dist: opentelemetry-instrumentation-ollama==0.40.8
|
|
47
|
+
Requires-Dist: opentelemetry-instrumentation-langchain==0.40.8
|
|
48
48
|
Requires-Dist: opentelemetry-instrumentation-threading==00.54b1
|
|
49
49
|
Requires-Dist: opentelemetry-instrumentation-urllib3==0.54b1
|
|
50
50
|
Requires-Dist: opentelemetry-proto==1.33.1
|
|
51
51
|
Requires-Dist: opentelemetry-sdk==1.33.1
|
|
52
52
|
Requires-Dist: opentelemetry-semantic-conventions==0.54b1
|
|
53
|
-
Requires-Dist: opentelemetry-semantic-conventions-ai==0.4.
|
|
53
|
+
Requires-Dist: opentelemetry-semantic-conventions-ai==0.4.9
|
|
54
54
|
Requires-Dist: opentelemetry-util-http==0.54b1
|
|
55
55
|
Requires-Dist: packaging==24.2
|
|
56
56
|
Requires-Dist: propcache==0.3.0
|
|
@@ -90,8 +90,9 @@ IOA observability SDK for your multi-agentic application.
|
|
|
90
90
|
## Table of Contents
|
|
91
91
|
|
|
92
92
|
- [Installation](#installation)
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
93
|
+
- [Dev](#dev)
|
|
94
|
+
- [Testing](#testing)
|
|
95
|
+
- [Getting Started](#getting-started)
|
|
95
96
|
- [Contributing](#contributing)
|
|
96
97
|
|
|
97
98
|
## Installation
|
|
@@ -156,76 +157,6 @@ OPENAI_API_KEY=<KEY> make test
|
|
|
156
157
|
For getting started with the SDK, please refer to the [Getting Started](https://github.com/agntcy/observe/blob/main/GETTING-STARTED.md)
|
|
157
158
|
file. It contains detailed instructions on how to set up and use the SDK effectively.
|
|
158
159
|
|
|
159
|
-
## SLIM-Based Multi-Agentic Systems
|
|
160
|
-
|
|
161
|
-
For distributed agent systems using SLIM protocol, additional instrumentation is available:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### Initializing the SLIM Connector with your agent
|
|
165
|
-
|
|
166
|
-
```python
|
|
167
|
-
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
|
|
168
|
-
from ioa_observe.sdk.instrumentations.slim import SLIMInstrumentor
|
|
169
|
-
|
|
170
|
-
# Initialize SLIM connector
|
|
171
|
-
slim_connector = SLIMConnector(
|
|
172
|
-
remote_org="cisco",
|
|
173
|
-
remote_namespace="default",
|
|
174
|
-
shared_space="chat",
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
# Register agents with the connector
|
|
178
|
-
slim_connector.register("remote_client_agent")
|
|
179
|
-
|
|
180
|
-
# Instrument SLIM communications
|
|
181
|
-
SLIMInstrumentor().instrument()
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Receiving Messages with a Callback
|
|
185
|
-
|
|
186
|
-
Add the decorator `process_slim_msg` to the callback function to process incoming messages. This function will be called whenever a message is received in the shared space.
|
|
187
|
-
|
|
188
|
-
```python
|
|
189
|
-
|
|
190
|
-
# Define a callback to process incoming messages
|
|
191
|
-
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
|
|
192
|
-
import json
|
|
193
|
-
from typing import Dict, Any
|
|
194
|
-
|
|
195
|
-
@process_slim_msg("remote_client_agent")
|
|
196
|
-
async def send_and_recv(msg) -> Dict[str, Any]:
|
|
197
|
-
"""Send message to remote endpoint and wait for reply."""
|
|
198
|
-
gateway = GatewayHolder.gateway
|
|
199
|
-
session_info = GatewayHolder.session_info
|
|
200
|
-
|
|
201
|
-
if gateway is not None:
|
|
202
|
-
await gateway.publish(session_info, msg.encode(), "cisco", "default", "server")
|
|
203
|
-
async with gateway:
|
|
204
|
-
_, recv = await gateway.receive(session=session_info.id)
|
|
205
|
-
else:
|
|
206
|
-
raise RuntimeError("Gateway is not initialized yet!")
|
|
207
|
-
|
|
208
|
-
response_data = json.loads(recv.decode("utf8"))
|
|
209
|
-
return {"messages": response_data.get("messages", [])}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Starting the Message Receiver
|
|
213
|
-
|
|
214
|
-
```python
|
|
215
|
-
# Start receiving messages from the SLIM shared space
|
|
216
|
-
await slim.receive(callback=on_message_received)
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### Publishing Messages
|
|
220
|
-
|
|
221
|
-
```python
|
|
222
|
-
# Publish a message to the SLIM shared space
|
|
223
|
-
message = {"type": "ChatMessage", "author": "moderator", "message": "Hello, world!"}
|
|
224
|
-
await slim.publish(msg=json.dumps(message).encode("utf-8"))
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
We will observe various events and metrics being sent to the Otel collector as we interact with other agents in the shared space via SLIM.
|
|
228
|
-
|
|
229
160
|
## Contributing
|
|
230
161
|
|
|
231
162
|
Contributions are welcome! Please follow these steps to contribute:
|
|
@@ -34,16 +34,16 @@ opentelemetry-exporter-otlp-proto-grpc==1.33.1
|
|
|
34
34
|
opentelemetry-exporter-otlp-proto-http==1.33.1
|
|
35
35
|
opentelemetry-instrumentation
|
|
36
36
|
opentelemetry-instrumentation-logging==0.54b1
|
|
37
|
-
opentelemetry-instrumentation-openai==0.40.
|
|
38
|
-
opentelemetry-instrumentation-llamaindex==0.40.
|
|
39
|
-
opentelemetry-instrumentation-ollama==0.40.
|
|
40
|
-
opentelemetry-instrumentation-langchain==0.40.
|
|
37
|
+
opentelemetry-instrumentation-openai==0.40.8
|
|
38
|
+
opentelemetry-instrumentation-llamaindex==0.40.8
|
|
39
|
+
opentelemetry-instrumentation-ollama==0.40.8
|
|
40
|
+
opentelemetry-instrumentation-langchain==0.40.8
|
|
41
41
|
opentelemetry-instrumentation-threading==00.54b1
|
|
42
42
|
opentelemetry-instrumentation-urllib3==0.54b1
|
|
43
43
|
opentelemetry-proto==1.33.1
|
|
44
44
|
opentelemetry-sdk==1.33.1
|
|
45
45
|
opentelemetry-semantic-conventions==0.54b1
|
|
46
|
-
opentelemetry-semantic-conventions-ai==0.4.
|
|
46
|
+
opentelemetry-semantic-conventions-ai==0.4.9
|
|
47
47
|
opentelemetry-util-http==0.54b1
|
|
48
48
|
packaging==24.2
|
|
49
49
|
propcache==0.3.0
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "ioa-observe-sdk"
|
|
8
|
-
version = "1.0.
|
|
8
|
+
version = "1.0.3"
|
|
9
9
|
description = "IOA Observability SDK"
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -46,16 +46,16 @@ dependencies = [
|
|
|
46
46
|
"opentelemetry-exporter-otlp-proto-http==1.33.1",
|
|
47
47
|
"opentelemetry-instrumentation",
|
|
48
48
|
"opentelemetry-instrumentation-logging==0.54b1",
|
|
49
|
-
"opentelemetry-instrumentation-openai==0.40.
|
|
50
|
-
"opentelemetry-instrumentation-llamaindex==0.40.
|
|
51
|
-
"opentelemetry-instrumentation-ollama==0.40.
|
|
52
|
-
"opentelemetry-instrumentation-langchain==0.40.
|
|
49
|
+
"opentelemetry-instrumentation-openai==0.40.8",
|
|
50
|
+
"opentelemetry-instrumentation-llamaindex==0.40.8",
|
|
51
|
+
"opentelemetry-instrumentation-ollama==0.40.8",
|
|
52
|
+
"opentelemetry-instrumentation-langchain==0.40.8",
|
|
53
53
|
"opentelemetry-instrumentation-threading==00.54b1",
|
|
54
54
|
"opentelemetry-instrumentation-urllib3==0.54b1",
|
|
55
55
|
"opentelemetry-proto==1.33.1",
|
|
56
56
|
"opentelemetry-sdk==1.33.1",
|
|
57
57
|
"opentelemetry-semantic-conventions==0.54b1",
|
|
58
|
-
"opentelemetry-semantic-conventions-ai==0.4.
|
|
58
|
+
"opentelemetry-semantic-conventions-ai==0.4.9",
|
|
59
59
|
"opentelemetry-util-http==0.54b1",
|
|
60
60
|
"packaging==24.2",
|
|
61
61
|
"propcache==0.3.0",
|
ioa_observe_sdk-1.0.2/README.md
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# Observe-SDK
|
|
2
|
-
|
|
3
|
-
IOA observability SDK for your multi-agentic application.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Features](#features)
|
|
10
|
-
- [Contributing](#contributing)
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
To install the package via PyPI, simply run:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pip install ioa_observe_sdk
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Alternatively, to download the SDK from git, you could also use the following command. Ensure you have `uv` installed in your environment.
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
uv add "git+https://github.com/agntcy/observe"
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Dev
|
|
27
|
-
|
|
28
|
-
To get started with development, start a Clickhouse DB and an OTel collector container locally using docker-compose like so:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
cd deploy/
|
|
32
|
-
docker compose up -d
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Ensure the contents of `otel-collector.yaml` is correct.
|
|
36
|
-
|
|
37
|
-
Check the logs of the collector to ensure it is running correctly:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
docker logs -f otel-collector
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Create a `.env` file with the following content:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
OTLP_HTTP_ENDPOINT=http://localhost:4318
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Install the dependencies and activate the virtual environment:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
set -a
|
|
53
|
-
source .env
|
|
54
|
-
set +a
|
|
55
|
-
|
|
56
|
-
python3 -m venv .venv
|
|
57
|
-
source .venv/bin/activate
|
|
58
|
-
uv sync
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Testing
|
|
62
|
-
|
|
63
|
-
To run the unit tests, ensure you have the `OPENAI_API_KEY` set in your environment. You can run the tests using the following command:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
OPENAI_API_KEY=<KEY> make test
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Getting Started
|
|
70
|
-
|
|
71
|
-
For getting started with the SDK, please refer to the [Getting Started](https://github.com/agntcy/observe/blob/main/GETTING-STARTED.md)
|
|
72
|
-
file. It contains detailed instructions on how to set up and use the SDK effectively.
|
|
73
|
-
|
|
74
|
-
## SLIM-Based Multi-Agentic Systems
|
|
75
|
-
|
|
76
|
-
For distributed agent systems using SLIM protocol, additional instrumentation is available:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
### Initializing the SLIM Connector with your agent
|
|
80
|
-
|
|
81
|
-
```python
|
|
82
|
-
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
|
|
83
|
-
from ioa_observe.sdk.instrumentations.slim import SLIMInstrumentor
|
|
84
|
-
|
|
85
|
-
# Initialize SLIM connector
|
|
86
|
-
slim_connector = SLIMConnector(
|
|
87
|
-
remote_org="cisco",
|
|
88
|
-
remote_namespace="default",
|
|
89
|
-
shared_space="chat",
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
# Register agents with the connector
|
|
93
|
-
slim_connector.register("remote_client_agent")
|
|
94
|
-
|
|
95
|
-
# Instrument SLIM communications
|
|
96
|
-
SLIMInstrumentor().instrument()
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Receiving Messages with a Callback
|
|
100
|
-
|
|
101
|
-
Add the decorator `process_slim_msg` to the callback function to process incoming messages. This function will be called whenever a message is received in the shared space.
|
|
102
|
-
|
|
103
|
-
```python
|
|
104
|
-
|
|
105
|
-
# Define a callback to process incoming messages
|
|
106
|
-
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
|
|
107
|
-
import json
|
|
108
|
-
from typing import Dict, Any
|
|
109
|
-
|
|
110
|
-
@process_slim_msg("remote_client_agent")
|
|
111
|
-
async def send_and_recv(msg) -> Dict[str, Any]:
|
|
112
|
-
"""Send message to remote endpoint and wait for reply."""
|
|
113
|
-
gateway = GatewayHolder.gateway
|
|
114
|
-
session_info = GatewayHolder.session_info
|
|
115
|
-
|
|
116
|
-
if gateway is not None:
|
|
117
|
-
await gateway.publish(session_info, msg.encode(), "cisco", "default", "server")
|
|
118
|
-
async with gateway:
|
|
119
|
-
_, recv = await gateway.receive(session=session_info.id)
|
|
120
|
-
else:
|
|
121
|
-
raise RuntimeError("Gateway is not initialized yet!")
|
|
122
|
-
|
|
123
|
-
response_data = json.loads(recv.decode("utf8"))
|
|
124
|
-
return {"messages": response_data.get("messages", [])}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Starting the Message Receiver
|
|
128
|
-
|
|
129
|
-
```python
|
|
130
|
-
# Start receiving messages from the SLIM shared space
|
|
131
|
-
await slim.receive(callback=on_message_received)
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Publishing Messages
|
|
135
|
-
|
|
136
|
-
```python
|
|
137
|
-
# Publish a message to the SLIM shared space
|
|
138
|
-
message = {"type": "ChatMessage", "author": "moderator", "message": "Hello, world!"}
|
|
139
|
-
await slim.publish(msg=json.dumps(message).encode("utf-8"))
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
We will observe various events and metrics being sent to the Otel collector as we interact with other agents in the shared space via SLIM.
|
|
143
|
-
|
|
144
|
-
## Contributing
|
|
145
|
-
|
|
146
|
-
Contributions are welcome! Please follow these steps to contribute:
|
|
147
|
-
|
|
148
|
-
1. Fork the repository.
|
|
149
|
-
2. Create a new branch (`git checkout -b feature-branch`).
|
|
150
|
-
3. Commit your changes (`git commit -am 'Add new feature'`).
|
|
151
|
-
4. Push to the branch (`git push origin feature-branch`).
|
|
152
|
-
5. Create a new Pull Request.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/instrumentations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/agent_connections.py
RENAMED
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/availability.py
RENAMED
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/heuristics.py
RENAMED
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/recovery_tracker.py
RENAMED
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/metrics/agents/tool_call_tracker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/tracing/content_allow_list.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe/sdk/utils/in_memory_span_exporter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ioa_observe_sdk-1.0.2 → ioa_observe_sdk-1.0.3}/ioa_observe_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|