IOA Observe Observability SDK
Project description
Observe-SDK
IOA observability SDK for your multi-agentic application.
Table of Contents
Installation
To install the package via PyPI, simply run:
pip install ioa_observe_sdk
Alternatively, to download the SDK from git, you could also use the following command. Ensure you have uv installed in your environment.
uv add "git+https://github.com/agntcy/observe"
Dev
To get started with development, start a Clickhouse DB and an OTel collector container locally using docker-compose like so:
cd deploy/
docker compose up -d
Ensure the contents of otel-collector.yaml is correct.
Check the logs of the collector to ensure it is running correctly:
docker logs -f otel-collector
Create a .env file with the following content:
OTLP_HTTP_ENDPOINT=http://localhost:4318
Install the dependencies and activate the virtual environment:
set -a
source .env
set +a
python3 -m venv .venv
source .venv/bin/activate
uv sync
Testing
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:
OPENAI_API_KEY=<KEY> make test
Getting Started
For getting started with the SDK, please refer to the GETTING-STARTED.md file. It contains detailed instructions on how to set up and use the SDK effectively.
SLIM-Based Multi-Agentic Systems
For distributed agent systems using SLIM protocol, additional instrumentation is available:
Initializing the SLIM Connector with your agent
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
from ioa_observe.sdk.instrumentations.slim import SLIMInstrumentor
# Initialize SLIM connector
slim_connector = SLIMConnector(
remote_org="cisco",
remote_namespace="default",
shared_space="chat",
)
# Register agents with the connector
slim_connector.register("remote_client_agent")
# Instrument SLIM communications
SLIMInstrumentor().instrument()
Receiving Messages with a Callback
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.
# Define a callback to process incoming messages
from ioa_observe.sdk.connectors.slim import SLIMConnector, process_slim_msg
import json
from typing import Dict, Any
@process_slim_msg("remote_client_agent")
async def send_and_recv(msg) -> Dict[str, Any]:
"""Send message to remote endpoint and wait for reply."""
gateway = GatewayHolder.gateway
session_info = GatewayHolder.session_info
if gateway is not None:
await gateway.publish(session_info, msg.encode(), "cisco", "default", "server")
async with gateway:
_, recv = await gateway.receive(session=session_info.id)
else:
raise RuntimeError("Gateway is not initialized yet!")
response_data = json.loads(recv.decode("utf8"))
return {"messages": response_data.get("messages", [])}
Starting the Message Receiver
# Start receiving messages from the SLIM shared space
await slim.receive(callback=on_message_received)
Publishing Messages
# Publish a message to the SLIM shared space
message = {"type": "ChatMessage", "author": "moderator", "message": "Hello, world!"}
await slim.publish(msg=json.dumps(message).encode("utf-8"))
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.
Contributing
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Create a new Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ioa_observe_sdk-0.0.1.tar.gz.
File metadata
- Download URL: ioa_observe_sdk-0.0.1.tar.gz
- Upload date:
- Size: 47.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a89c712e9019cabca358a982cdbd0eb28152b45a85ed47ee03615d2fb104bf
|
|
| MD5 |
a24ceebb7caf9c757a2373d1a3fb9ef5
|
|
| BLAKE2b-256 |
19bd2b11b9f33001aaf25ce81c9b2ce75acc339e1ba1f77be0f1366d9b2bd629
|
File details
Details for the file ioa_observe_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ioa_observe_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 55.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39de30ef9e8783ae19d1d7e8e9eb9fa6feaa9e5474de613945c6773a42ea504c
|
|
| MD5 |
6724df6d0aafd375015fb14b1048effd
|
|
| BLAKE2b-256 |
ee23992eff8f060bf2721c3a76a9b05592769ad1317f40a3915a283697f4f983
|