Skip to content

Protocol Documentation

Table of Contents

Top

agntcy/dir/routing/v1/peer.proto

Peer

Field Type Label Description
id string ID of a given peer, typically described by a protocol. For example: - SPIFFE: "spiffe://example.org/service/foo" - JWT: "jwt:sub=alice,iss=https://issuer.example.com" - Tor: "onion:abcdefghijklmno.onion" - DID: "did:example:123456789abcdefghi" - IPFS: "ipfs:QmYwAPJzv5CZsnAzt8auVZRn2E6sD1c4x8pN5o6d5cW4D5"
addrs string repeated Multiaddrs for a given peer. For example: - "/ip4/127.0.0.1/tcp/4001" - "/ip6/::1/tcp/4001" - "/dns4/example.com/tcp/443/https"
annotations Peer.AnnotationsEntry repeated Additional metadata about the peer.
connection PeerConnectionType Used to signal the sender's connection capabilities to the peer.

Peer.AnnotationsEntry

Field Type Label Description
key string
value string

PeerConnectionType

Name Number Description
PEER_CONNECTION_TYPE_NOT_CONNECTED 0 Sender does not have a connection to peer, and no extra information (default)
PEER_CONNECTION_TYPE_CONNECTED 1 Sender has a live connection to peer.
PEER_CONNECTION_TYPE_CAN_CONNECT 2 Sender recently connected to peer.
PEER_CONNECTION_TYPE_CANNOT_CONNECT 3 Sender made strong effort to connect to peer repeatedly but failed.

Top

agntcy/dir/routing/v1/publication_service.proto

CreatePublicationResponse

CreatePublicationResponse returns the result of creating a publication request. This includes the publication ID and any relevant metadata.

Field Type Label Description
publication_id string Unique identifier of the publication operation.

GetPublicationRequest

GetPublicationRequest specifies which publication to retrieve by its identifier.

Field Type Label Description
publication_id string Unique identifier of the publication operation to query.

GetPublicationResponse

GetPublicationResponse contains the full details of a specific publication request. Includes status, progress information, and any error details if applicable.

Field Type Label Description
publication_id string Unique identifier of the publication operation.
status PublicationStatus Current status of the publication operation.
created_time string Timestamp when the publication operation was created in the RFC3339 format. Specs: https://www.rfc-editor.org/rfc/rfc3339.html
last_update_time string Timestamp of the most recent status update for this publication in the RFC3339 format.

ListPublicationsItem

ListPublicationsItem represents a single publication request in the list response. Contains publication details including ID, status, and creation timestamp.

Field Type Label Description
publication_id string Unique identifier of the publication operation.
status PublicationStatus Current status of the publication operation.
created_time string Timestamp when the publication operation was created in the RFC3339 format. Specs: https://www.rfc-editor.org/rfc/rfc3339.html
last_update_time string Timestamp of the most recent status update for this publication in the RFC3339 format.

ListPublicationsRequest

ListPublicationsRequest contains optional filters for listing publication requests.

Field Type Label Description
limit uint32 optional Optional limit on the number of results to return.
offset uint32 optional Optional offset for pagination of results.

PublicationStatus

PublicationStatus represents the current state of a publication request. Publications progress from pending to processing to completed or failed states.

Name Number Description
PUBLICATION_STATUS_UNSPECIFIED 0 Default/unset status - should not be used in practice
PUBLICATION_STATUS_PENDING 1 Sync operation has been created but not yet started
PUBLICATION_STATUS_IN_PROGRESS 2 Sync operation is actively discovering and transferring objects
PUBLICATION_STATUS_COMPLETED 3 Sync operation has been successfully completed
PUBLICATION_STATUS_FAILED 4 Sync operation encountered an error and stopped

PublicationService

PublicationService manages publication requests for announcing records to the DHT.

Publications are stored in the database and processed by a worker that runs every hour. The publication workflow: 1. Publications are created via routing's Publish RPC by specifying either a query, a list of CIDs, or all records 2. Publication requests are added to the database 3. PublicationWorker queries the data using the publication request from the database to get the list of CIDs to be published 4. PublicationWorker announces the records with these CIDs to the DHT

Method Name Request Type Response Type Description
CreatePublication PublishRequest CreatePublicationResponse CreatePublication creates a new publication request that will be processed by the PublicationWorker. The publication request can specify either a query, a list of specific CIDs, or all records to be announced to the DHT.
ListPublications ListPublicationsRequest ListPublicationsItem stream ListPublications returns a stream of all publication requests in the system. This allows monitoring of pending, processing, and completed publication requests.
GetPublication GetPublicationRequest GetPublicationResponse GetPublication retrieves details of a specific publication request by its identifier. This includes the current status and any associated metadata.

Top

agntcy/dir/routing/v1/record_query.proto

RecordQuery

A query to match the record against during discovery. For example: { type: RECORD_QUERY_TYPE_SKILL, value: "Natural Language Processing" } { type: RECORD_QUERY_TYPE_LOCATOR, value: "helm-chart" } { type: RECORD_QUERY_TYPE_DOMAIN, value: "research" } { type: RECORD_QUERY_TYPE_FEATURE, value: "runtime/language" }

Field Type Label Description
type RecordQueryType The type of the query to match against.
value string The query value to match against.

RecordQueryType

Defines a list of supported record query types.

Name Number Description
RECORD_QUERY_TYPE_UNSPECIFIED 0 Unspecified query type.
RECORD_QUERY_TYPE_SKILL 1 Query for a skill name.
RECORD_QUERY_TYPE_LOCATOR 2 Query for a locator type.
RECORD_QUERY_TYPE_DOMAIN 3 Query for a domain name.
RECORD_QUERY_TYPE_MODULE 4 Query for a module name.

Top

agntcy/dir/routing/v1/routing_service.proto

ListRequest

Field Type Label Description
queries RecordQuery repeated List of queries to match against the records. If set, all queries must match for the record to be returned.
limit uint32 optional Limit the number of results returned. If not set, it will return all records that this peer is providing.

ListResponse

Field Type Label Description
record_ref agntcy.dir.core.v1.RecordRef The record that matches the list queries.
labels string repeated Labels associated with this record (skills, domains, features) Derived from the record content for CLI display purposes

PublishRequest

Field Type Label Description
record_refs RecordRefs References to the records to be published.
queries RecordQueries Queries to match against the records to be published.

RecordQueries

Field Type Label Description
queries agntcy.dir.search.v1.RecordQuery repeated

RecordRefs

Field Type Label Description
refs agntcy.dir.core.v1.RecordRef repeated

SearchRequest

Field Type Label Description
queries RecordQuery repeated List of queries to match against the records.
min_match_score uint32 optional Minimal target query match score. For example, if min_match_score=2, it will return records that match at least two of the queries. If not set, it will return records that match at least one query.
limit uint32 optional Limit the number of results returned. If not set, it will return all discovered records. Note that this is a soft limit, as the search may return more results than the limit if there are multiple peers providing the same record.

SearchResponse

Field Type Label Description
record_ref agntcy.dir.core.v1.RecordRef The record that matches the search query.
peer Peer The peer that provided the record.
match_queries RecordQuery repeated The queries that were matched.
match_score uint32 The score of the search match.

UnpublishRequest

Field Type Label Description
record_refs RecordRefs References to the records to be unpublished.
queries RecordQueries Queries to match against the records to be unpublished.

RoutingService

Defines an interface for announcement and discovery of records across interconnected network.

Middleware should be used to control who can perform these RPCs. Policies for the middleware can be handled via separate service.

Method Name Request Type Response Type Description
Publish PublishRequest .google.protobuf.Empty Announce to the network that this peer is providing a given record. This enables other peers to discover this record and retrieve it from this peer. Listeners can use this event to perform custom operations, for example by cloning the record.

Items need to be periodically republished (eg. 24h) to the network to avoid stale data. Republication should be done in the background. | | Unpublish | UnpublishRequest | .google.protobuf.Empty | Stop serving this record to the network. If other peers try to retrieve this record, the peer will refuse the request. | | Search | SearchRequest | SearchResponse stream | Search records based on the request across the network. This will search the network for the record with the given parameters.

It is possible that the records are stale or that they do not exist. Some records may be provided by multiple peers.

Results from the search can be used as an input to Pull operation to retrieve the records. | | List | ListRequest | ListResponse stream | List all records that this peer is currently providing that match the given parameters. This operation does not interact with the network. |

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)