Skip to main content

Directory client SDK

Project description

directory API python SDK

Overview

The directory API python SDK provides a simple and efficient way to interact with the directory API. It allows developers to integrate directory functionality into their Python applications with ease.

Features

  • Store API: The SDK includes a store API that allows developers to push the record data model to the store and retrieve it from the store.
  • Routing API: The SDK provides a routing API that allows developers to publish and retrieve record to and from the network.

Installation

Install the SDK using uv

init the project:

uv init

add the SDK to your project:

uv add agntcy-dir-sdk --index https://buf.build/gen/Python

Usage

Starting the Directory Server

To start the Directory server, you can deploy your instance or use Taskfile as below.

task server:start

Initializing the Client

# Initialize the client
client = Client(Config())

Creating and Pushing an Agent Object

# Create a record object
example_record = record_pb2.Record(
    name="example-record",
    version="v3",
    skills=[
        skill_pb2.Skill(
            name="Natural Language Processing",
            id=1,
        ),
    ],
    extensions=[
        extension_pb2.Extension(
            name="schema.oasf.agntcy.org/domains/domain-1",
            version="v1",
        )
    ],
    signature=signature_pb2.Signature(),
)

r = core_record_pb2.Record(v3=example_record)

# Push the object to the store
record_reference = client.push(record=r)

Pulling the Object

# Pull the object from the store
record = client.pull(record_reference)

Looking Up the Object

# Lookup the object
metadata = client.lookup(record_reference)

Publishing the Object

# Publish the object
client.publish(record_reference)

Listing Objects in the Store

# List objects in the store
query = record_query_type.RecordQuery(
    type=record_query_type.RECORD_QUERY_TYPE_SKILL,
    value="/skills/Natural Language Processing/Text Completion",
)

list_request = routingv1.ListRequest(queries=[query])
objects = list(client.list(list_request))

Unpublishing the Object

# Unpublish the object
client.unpublish(record_reference)

Deleting the Object

# Delete the object
client.delete(record_reference)

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

agntcy_dir_sdk-0.1.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

agntcy_dir_sdk-0.1.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file agntcy_dir_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: agntcy_dir_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for agntcy_dir_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 08598a544336d636f03ff34b3685d90d1c1cd398097b7155395f351a7bc47c3d
MD5 0b23a21c4baed1c8d26f48fdc04923a0
BLAKE2b-256 1837a8a5513d140d09edc59e1b7613efa43af3b1d1aa328340e7d74f66a2fd74

See more details on using hashes here.

File details

Details for the file agntcy_dir_sdk-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for agntcy_dir_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 39d9e0c2e0c4c4480a4784676840a96be7d480ce9f96767d2d3ca07b5de1c80a
MD5 8656c48d5113f256c8038adb1a802407
BLAKE2b-256 7b1ebba71fc78eac1b8e8ab175fb032dd93b1cd19d2b5162af2fe97ad50af85e

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