Skip to content

Routing API Reference

routing/v1/routing_service.proto

LegacyListRequest

Field Type Label Description
peer Peer optional Target peer. If selected, it returns the skill details for this peer. It may use labels to only return selected labels.
labels string repeated Target labels. For example, labels={"skill=text", "skill=text/rag"}
ref core.v1.RecordRef optional Target record, if any. If set, it will return only the record with the given reference.
max_hops uint32 optional Max routing depth.

LegacyListResponse

Field Type Label Description
items LegacyListResponse.Item repeated Returned items that match a given request

LegacyListResponse.Item

Field Type Label Description
labels string repeated Labels associated with a given record
label_counts LegacyListResponse.Item.LabelCountsEntry repeated Optionally sends count details about individual skill. This is only set when querying labels or our own current peer. For record requests, only returns the data about that record.
peer Peer Peer that returned this record.
ref core.v1.RecordRef optional Found record if any. If empty, then only the labels are important.

LegacyListResponse.Item.LabelCountsEntry

Field Type Label Description
key string
value uint64

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.
legacy_list_request LegacyListRequest optional Legacy list request. TODO Remove when new announce and discovery design is implemented

ListResponse

Field Type Label Description
record_cid string The record that matches the list queries.
legacy_list_response LegacyListResponse optional Legacy list response. TODO Remove when new announce and discovery design is implemented

PublishRequest

Field Type Label Description
record_cid string Reference to the agent record to be published.

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_cid string 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_cid string Reference to the agent record 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. |

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.

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" }

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.

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)