|
| 1 | +# Getting started |
1 | 2 |
|
2 |
| -# Getting Started |
| 3 | +The Agent Directory (dir) allows publication, exchange and discovery of information about AI agents over a distributed peer-to-peer network. |
| 4 | +It leverages [OASF](https://github.com/agntcy/oasf) to describe agents and provides a set of APIs and tools to build, store, publish and discover agents across the network by their attributes and constraints. |
| 5 | +Directory also leverages [CSIT](https://github.com/agntcy/csit) for continuous system integration and testing across different versions, environments, and features. |
3 | 6 |
|
4 | 7 | ## Features
|
5 | 8 |
|
6 |
| -- _Standards_ - Defines standard schema for data representation and exchange. |
7 |
| -- _Dev Kit_ - Tooling to facilitate API interaction and generation of agent data models from different sources. |
8 |
| -- _Plugins_ - Supports model schema and build plugins to enrich agent data models for custom use-cases. |
9 |
| -- _Announce_ - Enables publication of records to the network. |
10 |
| -- _Discover_ - Listen and retreive records published on the network. |
11 |
| -- _Search_ - Supports searching of records across the network that satisfy given attributes and constraints. |
12 |
| -- _Security_ - Relies on well-known security principles to provide data provenance, integrity and ownership. |
| 9 | +- **Data Models** - Defines a standard schema for data representation and exchange. |
| 10 | +- **Dev Kit** - Provides CLI tooling to simplify development workflows and facilitate API interactions. |
| 11 | +- **Plugins** - Pluggable components to extend the build process of agent data models for custom use-cases. |
| 12 | +- **Announce** - Allows publication of agent data models to the network. |
| 13 | +- **Discover** - Listen, search, and retrieve agents across the network by their attributes and constraints. |
| 14 | +- **Security** - Relies on well-known security principles to provide data provenance, integrity and ownership. |
13 | 15 |
|
14 | 16 | ## Prerequisites
|
15 | 17 |
|
| 18 | +To build the project and work with the code, you will need the following installed in your system |
| 19 | + |
16 | 20 | - [Taskfile](https://taskfile.dev/)
|
17 | 21 | - [Docker](https://www.docker.com/)
|
18 |
| -- Golang |
| 22 | +- [Golang](https://go.dev/doc/devel/release#go1.24.0) |
19 | 23 |
|
20 |
| -## Artifacts distribution |
| 24 | +Make sure Docker is installed with Buildx. |
21 | 25 |
|
22 |
| -### Golang Packages |
| 26 | +## Development |
23 | 27 |
|
24 |
| -See [API package](https://pkg.go.dev/github.com/agntcy/dir/api), [Server package](https://pkg.go.dev/github.com/agntcy/dir/server) and [CLI package](https://pkg.go.dev/github.com/agntcy/dir/cli). |
| 28 | +Use `Taskfile` for all related development operations such as testing, validating, deploying, and working with the project. |
25 | 29 |
|
26 |
| -### Binaries |
| 30 | +### Clone the repository |
27 | 31 |
|
28 |
| -See https://github.com/agntcy/dir/releases |
| 32 | +```bash |
| 33 | +git clone https://github.com/agntcy/dir |
| 34 | +cd dir |
| 35 | +``` |
29 | 36 |
|
30 |
| -### Container images |
| 37 | +### Initialize the project |
| 38 | + |
| 39 | +This step will fetch all project dependencies and prepare the environment for development. |
31 | 40 |
|
32 | 41 | ```bash
|
33 |
| -docker pull ghcr.io/agntcy/dir-ctl:latest |
34 |
| -docker pull ghcr.io/agntcy/dir-apiserver:latest |
| 42 | +task deps |
35 | 43 | ```
|
36 | 44 |
|
37 |
| -### Helm charts |
| 45 | +### Make changes |
| 46 | + |
| 47 | +Make the changes to the source code and rebuild for later testing. |
38 | 48 |
|
39 | 49 | ```bash
|
40 |
| -helm pull ghcr.io/agntcy/dir/helm-charts/dir:latest |
| 50 | +task build |
41 | 51 | ```
|
42 | 52 |
|
43 |
| -## Development |
44 |
| - |
45 |
| -Use `Taskfile` for all related development operations such as testing, validating, deploying, and working with the project. |
| 53 | +### Test changes |
46 | 54 |
|
47 |
| -To execute the test suite locally, run: |
| 55 | +The local testing pipeline relies on Golang to perform unit tests, and |
| 56 | +Docker to perform E2E tests in an isolated Kubernetes environment using Kind. |
48 | 57 |
|
49 | 58 | ```bash
|
50 |
| -task gen |
51 |
| -task build |
| 59 | +task test:unit |
52 | 60 | task test:e2e
|
53 | 61 | ```
|
54 | 62 |
|
| 63 | +## Artifacts distribution |
| 64 | + |
| 65 | +All artifacts are tagged using the [Semantic Versioning](https://semver.org/) and follow the checked out source code tags. |
| 66 | +It is not advised to use artifacts with mismatching versions. |
| 67 | + |
| 68 | +### Container images |
| 69 | + |
| 70 | +All container images are distributed via [GitHub Packages](https://github.com/orgs/agntcy/packages?repo_name=dir). |
| 71 | + |
| 72 | +```bash |
| 73 | +docker pull ghcr.io/agntcy/dir-ctl:v0.2.0 |
| 74 | +docker pull ghcr.io/agntcy/dir-apiserver:v0.2.0 |
| 75 | +``` |
| 76 | + |
| 77 | +### Helm charts |
| 78 | + |
| 79 | +All helm charts are distributed as OCI artifacts via [GitHub Packages](https://github.com/agntcy/dir/pkgs/container/dir%2Fhelm-charts%2Fdir). |
| 80 | + |
| 81 | +```bash |
| 82 | +helm pull oci://ghcr.io/agntcy/dir/helm-charts/dir --version v0.2.0 |
| 83 | +``` |
| 84 | + |
| 85 | +### Binaries |
| 86 | + |
| 87 | +All release binaries are distributed via [GitHub Releases](https://github.com/agntcy/dir/releases). |
| 88 | + |
| 89 | +### SDKs |
| 90 | + |
| 91 | +- **Golang** - [github.com/agntcy/dir/api](https://pkg.go.dev/github.com/agntcy/dir/api), [github.com/agntcy/dir/cli](https://pkg.go.dev/github.com/agntcy/dir/cli), [github.com/agntcy/dir/server](https://pkg.go.dev/github.com/agntcy/dir/server) |
| 92 | + |
55 | 93 | ## Deployment
|
56 | 94 |
|
57 |
| -To deploy the Directory, you can use the provided `Taskfile` commands to start the necessary services and deploy the Directory server. Alternatively, you can deploy from a GitHub Helm chart release. |
| 95 | +Directory API services can be deployed either using the `Taskfile` or directly via released Helm chart. |
58 | 96 |
|
59 |
| -### Local Deployment |
| 97 | +### Using Taskfile |
60 | 98 |
|
61 |
| -To start a local OCI registry server for storage and the Directory server, use the following commands: |
| 99 | +This will start the necessary components such as storage and API services. |
62 | 100 |
|
63 | 101 | ```bash
|
64 |
| -task server:store:start |
65 | 102 | task server:start
|
66 | 103 | ```
|
67 | 104 |
|
68 |
| -These commands will set up a local environment for development and testing purposes. |
| 105 | +### Using Helm chart |
| 106 | + |
| 107 | +This will deploy Directory services into an existing Kubernetes cluster. |
| 108 | + |
| 109 | +```bash |
| 110 | +helm pull oci://ghcr.io/agntcy/dir/helm-charts/dir --version v0.2.0 |
| 111 | +helm upgrade --install dir oci://ghcr.io/agntcy/dir/helm-charts/dir --version v0.2.0 |
| 112 | +``` |
| 113 | + |
| 114 | +## Usage |
| 115 | + |
| 116 | +This document defines a basic overview of main Directory features, components, and usage scenarios. |
| 117 | + |
| 118 | +> Although the following example is shown for CLI-based usage scenario, |
| 119 | +there is an effort on exposing the same functionality via SDKs. |
| 120 | + |
| 121 | +### Requirements |
| 122 | + |
| 123 | +- Directory CLI client, distributed via [GitHub Releases](https://github.com/agntcy/dir/releases) |
| 124 | +- Directory API server, outlined in the [Deployment](#deployment) section. |
69 | 125 |
|
70 |
| -### Remote Deployment |
| 126 | +### Build |
71 | 127 |
|
72 |
| -To deploy the Directory into an existing Kubernetes cluster, use a released Helm chart from GitHub with the following commands: |
| 128 | +This example demonstrates the examples of a data model and how to build such models using provided tooling to prepare for publication. |
| 129 | + |
| 130 | +Generate an example agent that matches the data model schema defined in [Agent Data Model](api/core/v1alpha1/agent.proto) specification. |
73 | 131 |
|
74 | 132 | ```bash
|
75 |
| -helm pull oci://ghcr.io/agntcy/dir/helm-charts/dir --version v0.1.3 |
76 |
| -helm upgrade --install dir oci://ghcr.io/agntcy/dir/helm-charts/dir --version v0.1.3 |
| 133 | +cat << EOF > model.json |
| 134 | +{ |
| 135 | + "name": "my-agent", |
| 136 | + "skills": [ |
| 137 | + {"category_name": "Text Generation"}, |
| 138 | + {"category_name": "Fact Extraction"} |
| 139 | + ] |
| 140 | +} |
| 141 | +EOF |
77 | 142 | ```
|
78 | 143 |
|
79 |
| -These commands will pull the latest version of the Directory Helm chart from the GitHub Container Registry and install or upgrade the Directory in your Kubernetes cluster. Ensure that your Kubernetes cluster is properly configured and accessible before running these commands. The `helm upgrade --install` command will either upgrade an existing release or install a new release if it does not exist. |
| 144 | +Alternatively, build the same agent data model using the CLI client. |
| 145 | +The build process allows additional operations to be performed, |
| 146 | +which is useful for agent model enrichment and other custom use-cases. |
80 | 147 |
|
81 |
| -## Usage |
| 148 | +```bash |
| 149 | +# Define the build config |
| 150 | +cat << EOF > build.config.yml |
| 151 | +builder: |
| 152 | + # Base agent model path |
| 153 | + base-model: "model.json" |
| 154 | +
|
| 155 | + # Disable the LLMAnalyzer plugin |
| 156 | + llmanalyzer: false |
82 | 157 |
|
83 |
| -The Directory CLI provides `build`, `push`, and `pull` commands to interact with the Directory server. Below are the details on how to run each command. |
| 158 | + # Disable the runtime plugin |
| 159 | + runtime: false |
| 160 | +EOF |
84 | 161 |
|
85 |
| -To run these commands, you can either: |
86 |
| -* Download a released CLI binary with `curl -L -o dirctl https://github.com/agntcy/dir/releases/download/<release tag>/dirctl-$(uname | tr '[:upper:]' '[:lower:]')-$(uname -m)` |
87 |
| -* Use a binary compiled from source with `task cli:compile` |
88 |
| -* Use CLI module from source by navigating to the `cli` directory and running `go run cli.go <command> <args>` |
| 162 | +# Build the agent |
| 163 | +dirctl build . > built.model.json |
89 | 164 |
|
90 |
| -### Build Command |
| 165 | +# Override above example |
| 166 | +mv built.model.json model.json |
| 167 | +``` |
| 168 | + |
| 169 | +### Store |
91 | 170 |
|
92 |
| -The `build` command is used to compile and build the agent data model. |
| 171 | +This example demonstrates the interaction with the local storage layer. |
| 172 | +It is used as an content-addressable object store for Directory-specific models and serves both the local and network-based operations (if enabled). |
93 | 173 |
|
94 |
| -Usage: |
95 | 174 | ```bash
|
96 |
| -dirctl build [options] |
| 175 | +# push and store content digest |
| 176 | +dirctl push model.json > model.digest |
| 177 | +DIGEST=$(cat model.digest) |
| 178 | + |
| 179 | +# pull |
| 180 | +dirctl pull $DIGEST |
| 181 | + |
| 182 | +# lookup |
| 183 | +dirctl info $DIGEST |
97 | 184 | ```
|
98 | 185 |
|
99 |
| -Options: |
100 |
| -- `--config-file` : Path to the agent build configuration file. Please note that other flags will override the build configuration from the file. Supported formats: YAML. Example template: cli/build.config.yaml. |
| 186 | +### Announce |
101 | 187 |
|
102 |
| -### Push Command |
| 188 | +This examples demonstrates how to publish the data to allow content discovery. |
| 189 | +To avoid stale data, it is recommended to republish the data periodically |
| 190 | +as the data across the network has TTL. |
103 | 191 |
|
104 |
| -The `push` command is used to publish the built agent data model to the store. The input data model should be JSON formatted. |
| 192 | +Note that this operation only works for the objects already pushed to local storage layer, ie. |
| 193 | +you must first push the data before being able to perform publication. |
105 | 194 |
|
106 |
| -Usage: |
107 | 195 | ```bash
|
108 |
| -dirctl push [options] |
| 196 | +# Publish the data to your local data store. |
| 197 | +dirctl publish $DIGEST |
| 198 | + |
| 199 | +# Publish the data across the network. |
| 200 | +dirctl publish $DIGEST --network |
109 | 201 | ```
|
110 | 202 |
|
111 |
| -Options: |
112 |
| -- `--from-file` : Read compiled data from JSON file, reads from STDIN if empty. |
113 |
| -- `--server-addr`: Directory Server API address (default "0.0.0.0:8888") |
| 203 | +If the data is not published to the network, it cannot be discovered by other peers. |
| 204 | +For published data, peers may try to reach out over network |
| 205 | +and request specific objects for verification and replication. |
| 206 | +Network publication may fail if you are not connected to any peers. |
| 207 | + |
| 208 | +### Discover |
114 | 209 |
|
115 |
| -Example usage with read from STDIN: `dirctl build <args> | dirctl push`. |
| 210 | +This examples demonstrates how to discover published data locally or across the network. |
| 211 | +This API supports both unicast- mode for routing to specific objects, |
| 212 | +and multicast mode for attribute-based matching and routing. |
116 | 213 |
|
117 |
| -### Pull Command |
| 214 | +There are two modes of operation, a) local mode where the data is queried from the local data store, and b) network mode where the data is queried across the network. |
118 | 215 |
|
119 |
| -The `pull` command is used to retrieve agent data model from the store. The output data model will be JSON formatted. |
| 216 | +Discovery is performed using full-set label matching, ie. the results always fully match the requested query. |
| 217 | +Note that it is not guaranteed that the data is available, valid, or up to date as results. |
120 | 218 |
|
121 |
| -Usage: |
122 | 219 | ```bash
|
123 |
| -dirctl pull [options] |
| 220 | +# Get a list of peers holding a specific agent data model |
| 221 | +dirctl list --digest $DIGEST |
| 222 | + |
| 223 | +# Discover the agent data models in your local data store that can fully satisfy your search query. |
| 224 | +dirctl list "/skills/Text Generation" |
| 225 | +dirctl list "/skills/Text Generation" "/skills/Fact Extraction" |
| 226 | + |
| 227 | +# Discover the agent data models across the network that can fully satisfy your search query. |
| 228 | +dirctl list "/skills/Text Generation" --network |
| 229 | +dirctl list "/skills/Text Generation" "/skills/Fact Extraction" --network |
124 | 230 | ```
|
125 | 231 |
|
126 |
| -Options: |
127 |
| -- `--digest` : Digest of the agent to pull. |
128 |
| -- `--server-addr`: Directory Server API address (default "0.0.0.0:8888") |
| 232 | +It is also possible to get an aggregated summary about the data held in your local data store or across the network. |
| 233 | +This is used for routing decisions when traversing the network. |
| 234 | +Note that for network search, you will not query your own data, but only the data of other peers. |
129 | 235 |
|
130 |
| -Example usage in combination with other commands: `dirctl pull --digest $(dirctl build | dirctl push)`. |
| 236 | +```bash |
| 237 | +# Get a list of labels and basic summary details about the data you currently have in your local data store. |
| 238 | +dirctl list info |
| 239 | + |
| 240 | +# Get a list of labels and basic summary details about the data you across the reachable network. |
| 241 | +dirctl list info --network |
| 242 | +``` |
0 commit comments