Skip to main content

IOA 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:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ioa_observe_sdk-1.0.1.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ioa_observe_sdk-1.0.1-py3-none-any.whl (55.2 kB view details)

Uploaded Python 3

File details

Details for the file ioa_observe_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: ioa_observe_sdk-1.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

Hashes for ioa_observe_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0ddf61bfe79eedefd424a93f15cdce5f0842266668a4c600f9cb29dc72d70d33
MD5 75724272d13284deda54c84153ef2272
BLAKE2b-256 7731d2be16c14d1ab5102b0f9a15dc550ccc0584433ba0d072c52cf182f0f72d

See more details on using hashes here.

File details

Details for the file ioa_observe_sdk-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ioa_observe_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4975348b09b62d69fad2e92eddc8ef2c50644d6c58306134198ea2fabc2f0e4c
MD5 d2a10ca664298ecab4574d46b835e6dc
BLAKE2b-256 a3991df2738ca9b392474a72f6aa491ff4d0aab5a13a5eebc2e23ed61e871851

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page