Overview
Theagent-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:
- Generates a JSON agent configuration file for that organization
- Generates a per-organization
docker-composefile - Runs the agent container using the Credo image specified by
AFJ_VERSION - Writes the agent’s admin endpoint to an endpoint file so
agent-servicecan connect to it
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
- Allocates the next available admin port (starting from
8001, tracked inagent-provisioning/AFJ/port-file/last-admin-port.txt) and inbound port (starting from9001, tracked inagent-provisioning/AFJ/port-file/last-inbound-port.txt) - Writes a JSON agent config file to
agent-provisioning/AFJ/agent-config/<orgId>_<containerName>.json - Generates a Docker Compose file at
agent-provisioning/AFJ/docker-compose_<orgId>_<containerName>.yaml - Runs
docker compose up -dto start the agent container - Polls
http://<externalIp>:<adminPort>/agentup to 6 times (10-second intervals) until it returns HTTP 200 - Writes the agent endpoint to
agent-provisioning/AFJ/endpoints/<orgId>_<containerName>.json
Required configuration
| Variable | Example | Description |
|---|---|---|
AGENT_HOST | [email protected] | SSH connection string for the VM running the agents |
AFJ_VERSION | afj-0.4.1:latest | Docker image tag for Credo agent containers |
AFJ_AGENT_SPIN_UP | /apps/agent-provisioning/AFJ/scripts/start_agent.sh | Path to the agent spin-up script inside the container |
AFJ_AGENT_ENDPOINT_PATH | /apps/agent-provisioning/AFJ/endpoints/ | Directory where agent endpoint JSON files are written |
AGENT_PROTOCOL | http | Transport protocol used by agents (http or https) |
AGENT_API_KEY | supersecret-that-too-16chars | API key injected into every agent container |
WALLET_STORAGE_HOST | localhost | PostgreSQL host for agent wallets (use host IP, not localhost) |
WALLET_STORAGE_PORT | 5432 | PostgreSQL port for agent wallets |
WALLET_STORAGE_USER | postgres | PostgreSQL user for agent wallets |
WALLET_STORAGE_PASSWORD | xxxxxx | PostgreSQL password for agent wallets |
SCHEMA_FILE_SERVER_URL | — | URL of the schema file server, passed to each agent |
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
Theagent-provisioning service requires the following mounts:
docker-compose.yml
| Mount | Purpose |
|---|---|
agent-config/ | JSON config files read by each agent container at startup |
/var/run/docker.sock | Allows the service to launch agent containers on the host |
token/ | Persists agent API tokens across container restarts |
agent.env | Environment file injected into every spawned agent container |
agent-service inherits the same volumes through volumes_from:
docker-compose.yml
agent-service read access to the agent-config and endpoints directories without duplicating the mount configuration.
AFJ directory structure
Inside theagent-provisioning container, the AFJ working directory is structured as follows:
Agent configuration file
Each organization’s agent config is written toagent-config/<orgId>_<containerName>.json. The structure matches the Credo REST API configuration format:
agent.env
Theagent.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:
agent.env
Port allocation
Admin and inbound ports are allocated sequentially and tracked in plain-text files:| File | Starting value | Purpose |
|---|---|---|
port-file/last-admin-port.txt | 8001 | HTTP admin API port for each agent |
port-file/last-inbound-port.txt | 9001 | DIDComm inbound transport port for each agent |
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:Check the agent admin endpoint
200 with agent metadata. This is the same check the provisioning script performs internally.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.