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 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.2.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.2-py3-none-any.whl (55.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ioa_observe_sdk-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 b6f3049d1095a7f8b83f59fcbbb50fa5f9123cd7ec49faee4fa0801350cebb66
MD5 e49007411cd400dd2322f9410da247bf
BLAKE2b-256 b71c98685461815b2555c2c391b383f709ca3501fc9f422eab06431ea642c495

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ioa_observe_sdk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 201d8df9d5bcc9fabbfb92006e3158df1569b13f10d8b6fb0df51e4ce0a48eea
MD5 5de4d79b9ea42c3bd6b7ece816d4d807
BLAKE2b-256 8143d76cb8dc0cd6fc1fa0ba3b1e8b21c6c1486fe8cf0049e5f290a93077b9a9

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