CLI and configuration¶
The converge CLI runs one or more agent processes with configurable transport, pool, and discovery. Configuration is read from environment variables and, optionally, a file (YAML or TOML). The CLI entrypoint is installed when the package is installed; YAML support requires the cli extra.
Entrypoint¶
converge <command> [options]
Commands:
run: Start one or more agents with generated identities, optional transport (local or TCP), optional pool and discovery, and a long-running loop until interrupted.
Options for run:
-c/--config: Path to a config file (YAML or TOML). Default: value ofCONVERGE_CONFIGif set.-v/--verbose: Enable DEBUG-level logging.
Examples:
converge run
converge run -c config.yaml -v
Environment variables¶
Configuration keys can be set via environment variables. Names follow the pattern CONVERGE_<KEY> with <KEY> in uppercase:
Variable |
Purpose |
|---|---|
|
Transport type: |
|
Host for network transports (default |
|
Port for TCP transport (default |
|
Number of agents to run in this process (default |
|
If set, a pool with this id is created and all agents join it. |
|
If set to |
|
Optional explicit store backend: |
|
Backend-specific location/URL (file path, sqlite db path, or redis URL). |
|
Default config file path (same as |
File-based config is merged with env: file values override env when both specify the same key.
Config file format¶
Supported formats: YAML (.yaml, .yml) and TOML (.toml). YAML parsing requires pyyaml (install from source with pip install -e ".[cli]"). TOML uses the standard library tomllib (Python 3.11+).
The file must evaluate to a single mapping (dict). Keys: transport, host, port, agents, pool_id, discovery_store, store_backend, store_path.
Example YAML (multi-agent with pool and discovery):
transport: local
agents: 3
pool_id: my-pool
discovery_store: memory
store_backend: memory
Example YAML (TCP, single agent):
transport: tcp
host: 0.0.0.0
port: 9000
Example TOML:
transport = "tcp"
host = "127.0.0.1"
port = 8888
agents = 2
pool_id = "workers"
discovery_store = "memory"
store_backend = "sqlite"
store_path = "/tmp/converge.sqlite3"
Example TOML (Redis backend):
transport = "tcp"
host = "0.0.0.0"
port = 9000
agents = 1
store_backend = "redis"
store_path = "redis://localhost:6379/0"
Run behavior¶
With converge run, the process:
Loads config (env + optional file).
Sets logging level to DEBUG if
-vis used.Creates a store from config. Preferred mode is
store_backend+store_path; legacydiscovery_storeremains supported.If discovery is enabled (via
store_backendordiscovery_store), createsDiscoveryService(store=...); each agent registers on start and unregisters on stop.If
agents> 1 orpool_idis set, creates sharedPoolManagerandTaskManagerusing the same store instance for recovery consistency.For each of
agents(default 1): generates an identity, creates anAgentand transport (local or TCP with host/port), builds anAgentDescriptorwhen discovery is used, and constructs anAgentRuntimewith pool_manager, task_manager, discovery_service, and agent_descriptor as appropriate.Starts all runtimes with
asyncio.gather, then runs until KeyboardInterrupt.On interrupt, stops all runtimes cleanly.
To use WebSocket transport or custom persistence, use the Python API (see Quick start and API reference).
Migration from discovery_store¶
discovery_store remains supported for backward compatibility, but new configs should prefer:
store_backendstore_path
Migration mapping:
discovery_store: memory->store_backend: memorydiscovery_store: /path/to/dir->store_backend: file,store_path: /path/to/dir
When using multi-agent or multi-process coordination, prefer sqlite or redis store backends for better shared-state semantics.