Skip to main content

Overview

The agent-provisioning microservice is responsible for creating a dedicated Credo (formerly Aries Framework JavaScript) agent for each organization that onboards to the platform. When an organization registers and provisions a wallet, the service:
  1. Generates a JSON agent configuration file for that organization
  2. Generates a per-organization docker-compose file
  3. Runs the agent container using the Credo image specified by AFJ_VERSION
  4. Writes the agent’s admin endpoint to an endpoint file so agent-service can connect to it
The agent-service microservice communicates with the running agent containers on behalf of the platform. It shares the agent configuration and endpoint data through a shared volume (volumes_from: agent-provisioning).
Agent provisioning requires access to the Docker daemon on the host. The Docker socket (/var/run/docker.sock) must be mounted into the agent-provisioning container. Agent containers are launched on the same Docker host as the platform.

How agents are spun up

When an organization requests wallet provisioning, AgentProvisioningService.walletProvision() constructs a shell command that invokes one of the provisioning scripts:
  • docker_start_agent.sh — used when running inside Docker (the standard path)
  • start_agent.sh — used when running directly on the host
The script performs the following steps:
  1. Allocates the next available admin port (starting from 8001, tracked in agent-provisioning/AFJ/port-file/last-admin-port.txt) and inbound port (starting from 9001, tracked in agent-provisioning/AFJ/port-file/last-inbound-port.txt)
  2. Writes a JSON agent config file to agent-provisioning/AFJ/agent-config/<orgId>_<containerName>.json
  3. Generates a Docker Compose file at agent-provisioning/AFJ/docker-compose_<orgId>_<containerName>.yaml
  4. Runs docker compose up -d to start the agent container
  5. Polls http://<externalIp>:<adminPort>/agent up to 6 times (10-second intervals) until it returns HTTP 200
  6. Writes the agent endpoint to agent-provisioning/AFJ/endpoints/<orgId>_<containerName>.json

Required configuration

The following environment variables must be set in .env before agent provisioning will work. Missing values will cause wallet provisioning requests to fail.
In Docker Compose, ROOT_PATH is also set as an environment variable on the container and passed to the spin-up script:
docker-compose.yml (agent-provisioning excerpt)

Volume mounts

The agent-provisioning service requires the following mounts:
docker-compose.yml
The agent-service inherits the same volumes through volumes_from:
docker-compose.yml
This gives agent-service read access to the agent-config and endpoints directories without duplicating the mount configuration.

AFJ directory structure

Inside the agent-provisioning container, the AFJ working directory is structured as follows:

Agent configuration file

Each organization’s agent config is written to agent-config/<orgId>_<containerName>.json. The structure matches the Credo REST API configuration format:

agent.env

The agent.env file is mounted into every spawned agent container at /app/agent.env. Create this file in the root of the repository before starting the platform:
Populate it with wallet storage credentials and any other values the Credo image requires:
agent.env
Do not use localhost or 127.0.0.1 for WALLET_STORAGE_HOST in agent.env. Agent containers run on the Docker network and must use the host machine’s LAN IP or a resolvable hostname to reach PostgreSQL.

Port allocation

Admin and inbound ports are allocated sequentially and tracked in plain-text files: Each time a new agent is provisioned, the script increments the value in these files by 1 and exposes both ports on the host. The first agent receives admin port 8002 and inbound port 9002. Both ports are published on the host and on the agent container:
generated docker-compose (per agent)

Verifying an agent is running

After provisioning succeeds, confirm the agent container is up and responding:
1

List running agent containers

2

Check the agent admin endpoint

A successful response returns HTTP 200 with agent metadata. This is the same check the provisioning script performs internally.
3

Inspect the endpoint file

The provisioning script writes the agent’s controller endpoint to:
Its contents look like:
agent-service reads this file to discover where to send requests for each organization.
4

View agent logs