1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481# OpenFang Configuration Reference
Complete reference for `config.toml`, covering every configurable field in the OpenFang Agent OS.
---
## Table of Contents
- [Overview](#overview)
- [Minimal Configuration](#minimal-configuration)
- [Full Example](#full-example)
- [Section Reference](#section-reference)
- [Top-Level Fields](#top-level-fields)
- [\[default\_model\]](#default_model)
- [\[memory\]](#memory)
- [\[network\]](#network)
- [\[web\]](#web)
- [\[channels\]](#channels)
- [\[\[mcp\_servers\]\]](#mcp_servers)
- [\[a2a\]](#a2a)
- [\[\[fallback\_providers\]\]](#fallback_providers)
- [\[\[users\]\]](#users)
- [Channel Overrides](#channel-overrides)
- [Environment Variables](#environment-variables)
- [Validation](#validation)
---
## Overview
OpenFang reads its configuration from a single TOML file:
```
~/.openfang/config.toml
```
On Windows, `~` resolves to `C:\Users\<username>`. If the home directory cannot be determined, the system temp directory is used as a fallback.
**Key behaviors:**
- Every struct in the configuration uses `#[serde(default)]`, which means **all fields are optional**. Omitted fields receive their documented default values.
- Channel sections (`[channels.telegram]`, `[channels.discord]`, etc.) are `Option<T>` -- when absent, the channel adapter is **disabled**. Including the section header (even empty) enables the adapter with defaults.
- Secrets are **never stored in config.toml** directly. Instead, fields like `api_key_env` and `bot_token_env` hold the **name** of an environment variable that contains the actual secret. This prevents accidental exposure in version control.
- Sensitive fields (`api_key`, `shared_secret`) are automatically redacted in debug output and logs.
---
## Minimal Configuration
The simplest working configuration only needs an LLM provider API key set as an environment variable. With no config file at all, OpenFang boots with Anthropic as the default provider:
```toml
# ~/.openfang/config.toml
# Minimal: just override the model if you want something other than defaults.
# Set ANTHROPIC_API_KEY in your environment.
[default_model]
provider = "anthropic"
model = "claude-sonnet-4-20250514"
api_key_env = "ANTHROPIC_API_KEY"
```
Or to use a local Ollama instance with no API key:
```toml
[default_model]
provider = "ollama"
model = "llama3.2:latest"
base_url = "http://localhost:11434"
api_key_env = ""
```
---
## Full Example
```toml
# ============================================================
# OpenFang Agent OS -- Complete Configuration Reference
# ============================================================
# --- Top-level fields ---
home_dir = "~/.openfang" # OpenFang home directory
data_dir = "~/.openfang/data" # SQLite databases and data files
log_level = "info" # trace | debug | info | warn | error
api_listen = "127.0.0.1:50051" # HTTP/WS API bind address
network_enabled = false # Enable OFP peer-to-peer network
api_key = "" # API Bearer token (empty = unauthenticated)
mode = "default" # stable | default | dev
language = "en" # Locale for CLI/messages
usage_footer = "full" # off | tokens | cost | full
# --- Default LLM Provider ---
[default_model]
provider = "anthropic"
model = "claude-sonnet-4-20250514"
api_key_env = "ANTHROPIC_API_KEY"
# base_url = "https://api.anthropic.com" # Optional override
# --- Fallback Providers ---
[[fallback_providers]]
provider = "ollama"
model = "llama3.2:latest"
api_key_env = ""
# base_url = "http://localhost:11434" # Uses catalog default if omitted
[[fallback_providers]]
provider = "groq"
model = "llama-3.3-70b-versatile"
api_key_env = "GROQ_API_KEY"
# --- Memory ---
[memory]
# sqlite_path = "~/.openfang/data/openfang.db" # Auto-resolved if omitted
embedding_model = "all-MiniLM-L6-v2"
consolidation_threshold = 10000
decay_rate = 0.1
# --- Network (OFP Wire Protocol) ---
[network]
listen_addresses = ["/ip4/0.0.0.0/tcp/0"]
bootstrap_peers = []
mdns_enabled = true
max_peers = 50
shared_secret = "" # Required when network_enabled = true
# --- Web Tools ---
[web]
search_provider = "auto" # auto | brave | tavily | perplexity | duckduckgo
cache_ttl_minutes = 15
[web.brave]
api_key_env = "BRAVE_API_KEY"
max_results = 5
country = ""
search_lang = ""
freshness = ""
[web.tavily]
api_key_env = "TAVILY_API_KEY"
search_depth = "basic" # basic | advanced
max_results = 5
include_answer = true
[web.perplexity]
api_key_env = "PERPLEXITY_API_KEY"
model = "sonar"
[web.fetch]
max_chars = 50000
max_response_bytes = 10485760 # 10 MB
timeout_secs = 30
readability = true
# --- MCP Servers ---
[[mcp_servers]]
name = "filesystem"
timeout_secs = 30
env = []
[mcp_servers.transport]
type = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
[[mcp_servers]]
name = "remote-tools"
timeout_secs = 60
env = ["REMOTE_API_KEY"]
[mcp_servers.transport]
type = "sse"
url = "https://mcp.example.com/events"
# --- A2A Protocol ---
[a2a]
enabled = false
listen_path = "/a2a"
[[a2a.external_agents]]
name = "research-agent"
url = "https://agent.example.com/.well-known/agent.json"
# --- RBAC Users ---
[[users]]
name = "Alice"
role = "owner" # owner | admin | user | viewer
api_key_hash = ""
[users.channel_bindings]
telegram = "123456"
discord = "987654321"
[[users]]
name = "Bob"
role = "user"
[users.channel_bindings]
slack = "U0123ABCDEF"
# --- Channel Adapters ---
# (See "Channels" section below for all 40 adapters)
[channels.telegram]
bot_token_env = "TELEGRAM_BOT_TOKEN"
allowed_users = []
# default_agent = "assistant"
poll_interval_secs = 1
[channels.discord]
bot_token_env = "DISCORD_BOT_TOKEN"
allowed_guilds = []
intents = 33280
[channels.slack]
app_token_env = "SLACK_APP_TOKEN"
bot_token_env = "SLACK_BOT_TOKEN"
allowed_channels = []
```
---
## Section Reference
### Top-Level Fields
These fields sit at the root of `config.toml` (not inside any `[section]`).
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `home_dir` | path | `~/.openfang` | OpenFang home directory. Stores config, agents, skills. |
| `data_dir` | path | `~/.openfang/data` | Directory for SQLite databases and persistent data. |
| `log_level` | string | `"info"` | Log verbosity. One of: `trace`, `debug`, `info`, `warn`, `error`. |
| `api_listen` | string | `"127.0.0.1:50051"` | Bind address for the HTTP/WebSocket/SSE API server. |
| `network_enabled` | bool | `false` | Enable the OFP peer-to-peer network layer. |
| `api_key` | string | `""` (empty) | API authentication key. When set, all endpoints except `/api/health` require `Authorization: Bearer <key>`. Empty means unauthenticated (local development only). |
| `mode` | string | `"default"` | Kernel operating mode. See below. |
| `language` | string | `"en"` | Language/locale code for CLI output and system messages. |
| `usage_footer` | string | `"full"` | Controls usage info appended to responses. See below. |
**`mode` values:**
| Value | Behavior |
|-------|----------|
| `stable` | Conservative: no auto-updates, pinned models, frozen skill registry. Uses `FallbackDriver`. |
| `default` | Balanced: standard operation. |
| `dev` | Developer: experimental features enabled. |
**`usage_footer` values:**
| Value | Behavior |
|-------|----------|
| `off` | No usage information shown. |
| `tokens` | Show token counts only. |
| `cost` | Show estimated cost only. |
| `full` | Show both token counts and estimated cost (default). |
---
### `[default_model]`
Configures the primary LLM provider used when agents do not specify their own model.
```toml
[default_model]
provider = "anthropic"
model = "claude-sonnet-4-20250514"
api_key_env = "ANTHROPIC_API_KEY"
# base_url = "https://api.anthropic.com"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `provider` | string | `"anthropic"` | Provider name. Supported: `anthropic`, `gemini`, `openai`, `groq`, `openrouter`, `deepseek`, `together`, `mistral`, `fireworks`, `ollama`, `vllm`, `lmstudio`, `perplexity`, `cohere`, `ai21`, `cerebras`, `sambanova`, `huggingface`, `xai`, `replicate`. |
| `model` | string | `"claude-sonnet-4-20250514"` | Model identifier. Aliases like `sonnet`, `haiku`, `gpt-4o`, `gemini-flash` are resolved by the model catalog. |
| `api_key_env` | string | `"ANTHROPIC_API_KEY"` | Name of the environment variable holding the API key. The actual key is read from this env var at runtime, never stored in config. |
| `base_url` | string or null | `null` | Override the API base URL. Useful for proxies or self-hosted endpoints. When `null`, the provider's default URL from the model catalog is used. |
---
### `[memory]`
Configures the SQLite-backed memory substrate, including vector embeddings and memory decay.
```toml
[memory]
# sqlite_path = "/custom/path/openfang.db"
embedding_model = "all-MiniLM-L6-v2"
consolidation_threshold = 10000
decay_rate = 0.1
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `sqlite_path` | path or null | `null` | Explicit path to the SQLite database file. When `null`, defaults to `{data_dir}/openfang.db`. |
| `embedding_model` | string | `"all-MiniLM-L6-v2"` | Model name used for generating vector embeddings for semantic memory search. |
| `consolidation_threshold` | u64 | `10000` | Number of stored memories before automatic consolidation is triggered to merge and prune old entries. |
| `decay_rate` | f32 | `0.1` | Memory confidence decay rate. `0.0` = no decay (memories never fade), `1.0` = aggressive decay. Values between 0.0 and 1.0. |
---
### `[network]`
Configures the OFP (OpenFang Protocol) peer-to-peer networking layer with HMAC-SHA256 mutual authentication.
```toml
[network]
listen_addresses = ["/ip4/0.0.0.0/tcp/0"]
bootstrap_peers = []
mdns_enabled = true
max_peers = 50
shared_secret = "my-cluster-secret"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `listen_addresses` | list of strings | `["/ip4/0.0.0.0/tcp/0"]` | libp2p multiaddresses to listen on. Port `0` means auto-assign. |
| `bootstrap_peers` | list of strings | `[]` | Multiaddresses of bootstrap peers for DHT discovery. |
| `mdns_enabled` | bool | `true` | Enable mDNS for automatic local network peer discovery. |
| `max_peers` | u32 | `50` | Maximum number of simultaneously connected peers. |
| `shared_secret` | string | `""` (empty) | Pre-shared secret for OFP HMAC-SHA256 mutual authentication. **Required** when `network_enabled = true`. Both sides must use the same secret. Redacted in logs. |
---
### `[web]`
Configures web search and web fetch capabilities used by agent tools.
```toml
[web]
search_provider = "auto"
cache_ttl_minutes = 15
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `search_provider` | string | `"auto"` | Which search engine to use. See values below. |
| `cache_ttl_minutes` | u64 | `15` | Cache duration for search/fetch results in minutes. `0` = caching disabled. |
**`search_provider` values:**
| Value | Description |
|-------|-------------|
| `auto` | Cascading fallback: tries Tavily, then Brave, then Perplexity, then DuckDuckGo, based on which API keys are available. |
| `brave` | Brave Search API. Requires `BRAVE_API_KEY`. |
| `tavily` | Tavily AI-native search. Requires `TAVILY_API_KEY`. |
| `perplexity` | Perplexity AI search. Requires `PERPLEXITY_API_KEY`. |
| `duckduckgo` | DuckDuckGo HTML scraping. No API key needed. |
#### `[web.brave]`
```toml
[web.brave]
api_key_env = "BRAVE_API_KEY"
max_results = 5
country = ""
search_lang = ""
freshness = ""
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `api_key_env` | string | `"BRAVE_API_KEY"` | Environment variable name holding the Brave Search API key. |
| `max_results` | usize | `5` | Maximum number of search results to return. |
| `country` | string | `""` | Country code for localized results (e.g., `"US"`, `"GB"`). Empty = no filter. |
| `search_lang` | string | `""` | Language code (e.g., `"en"`, `"fr"`). Empty = no filter. |
| `freshness` | string | `""` | Freshness filter. `"pd"` = past day, `"pw"` = past week, `"pm"` = past month. Empty = no filter. |
#### `[web.tavily]`
```toml
[web.tavily]
api_key_env = "TAVILY_API_KEY"
search_depth = "basic"
max_results = 5
include_answer = true
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `api_key_env` | string | `"TAVILY_API_KEY"` | Environment variable name holding the Tavily API key. |
| `search_depth` | string | `"basic"` | Search depth: `"basic"` for fast results, `"advanced"` for deeper analysis. |
| `max_results` | usize | `5` | Maximum number of search results to return. |
| `include_answer` | bool | `true` | Whether to include Tavily's AI-generated answer summary in results. |
#### `[web.perplexity]`
```toml
[web.perplexity]
api_key_env = "PERPLEXITY_API_KEY"
model = "sonar"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `api_key_env` | string | `"PERPLEXITY_API_KEY"` | Environment variable name holding the Perplexity API key. |
| `model` | string | `"sonar"` | Perplexity model to use for search queries. |
#### `[web.fetch]`
```toml
[web.fetch]
max_chars = 50000
max_response_bytes = 10485760
timeout_secs = 30
readability = true
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `max_chars` | usize | `50000` | Maximum characters returned in fetched content. Content exceeding this is truncated. |
| `max_response_bytes` | usize | `10485760` (10 MB) | Maximum HTTP response body size in bytes. |
| `timeout_secs` | u64 | `30` | HTTP request timeout in seconds. |
| `readability` | bool | `true` | Enable HTML-to-Markdown readability extraction. When true, fetched HTML is converted to clean Markdown. |
---
### `[channels]`
All 40 channel adapters are configured under `[channels.<name>]`. Each channel is `Option<T>` -- omitting the section disables the adapter entirely. Including the section header (even empty) enables it with default values.
Every channel config includes a `default_agent` field (optional agent name to route messages to) and an `overrides` sub-table (see [Channel Overrides](#channel-overrides)).
#### `[channels.telegram]`
```toml
[channels.telegram]
bot_token_env = "TELEGRAM_BOT_TOKEN"
allowed_users = []
# default_agent = "assistant"
poll_interval_secs = 1
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"TELEGRAM_BOT_TOKEN"` | Env var holding the Telegram Bot API token. |
| `allowed_users` | list of i64 | `[]` | Telegram user IDs allowed to interact. Empty = allow all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
| `poll_interval_secs` | u64 | `1` | Long-polling interval in seconds. |
#### `[channels.discord]`
```toml
[channels.discord]
bot_token_env = "DISCORD_BOT_TOKEN"
allowed_guilds = []
# default_agent = "assistant"
intents = 33280
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"DISCORD_BOT_TOKEN"` | Env var holding the Discord bot token. |
| `allowed_guilds` | list of u64 | `[]` | Guild (server) IDs allowed. Empty = allow all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
| `intents` | u64 | `33280` | Gateway intents bitmask. Default = `GUILD_MESSAGES \| MESSAGE_CONTENT`. |
#### `[channels.slack]`
```toml
[channels.slack]
app_token_env = "SLACK_APP_TOKEN"
bot_token_env = "SLACK_BOT_TOKEN"
allowed_channels = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `app_token_env` | string | `"SLACK_APP_TOKEN"` | Env var holding the Slack app-level token (`xapp-`) for Socket Mode. |
| `bot_token_env` | string | `"SLACK_BOT_TOKEN"` | Env var holding the Slack bot token (`xoxb-`) for REST API. |
| `allowed_channels` | list of strings | `[]` | Channel IDs allowed. Empty = allow all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.whatsapp]`
```toml
[channels.whatsapp]
access_token_env = "WHATSAPP_ACCESS_TOKEN"
verify_token_env = "WHATSAPP_VERIFY_TOKEN"
phone_number_id = ""
webhook_port = 8443
allowed_users = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `access_token_env` | string | `"WHATSAPP_ACCESS_TOKEN"` | Env var holding the WhatsApp Cloud API access token. |
| `verify_token_env` | string | `"WHATSAPP_VERIFY_TOKEN"` | Env var holding the webhook verification token. |
| `phone_number_id` | string | `""` | WhatsApp Business phone number ID. |
| `webhook_port` | u16 | `8443` | Port to listen for incoming webhook callbacks. |
| `allowed_users` | list of strings | `[]` | Phone numbers allowed. Empty = allow all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.signal]`
```toml
[channels.signal]
api_url = "http://localhost:8080"
phone_number = ""
allowed_users = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `api_url` | string | `"http://localhost:8080"` | URL of the signal-cli REST API. |
| `phone_number` | string | `""` | Registered phone number for the bot. |
| `allowed_users` | list of strings | `[]` | Allowed phone numbers. Empty = allow all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.matrix]`
```toml
[channels.matrix]
homeserver_url = "https://matrix.org"
user_id = "@openfang:matrix.org"
access_token_env = "MATRIX_ACCESS_TOKEN"
allowed_rooms = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `homeserver_url` | string | `"https://matrix.org"` | Matrix homeserver URL. |
| `user_id` | string | `""` | Bot user ID (e.g., `"@openfang:matrix.org"`). |
| `access_token_env` | string | `"MATRIX_ACCESS_TOKEN"` | Env var holding the Matrix access token. |
| `allowed_rooms` | list of strings | `[]` | Room IDs to listen in. Empty = all joined rooms. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.email]`
```toml
[channels.email]
imap_host = "imap.gmail.com"
imap_port = 993
smtp_host = "smtp.gmail.com"
smtp_port = 587
username = "bot@example.com"
password_env = "EMAIL_PASSWORD"
poll_interval_secs = 30
folders = ["INBOX"]
allowed_senders = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `imap_host` | string | `""` | IMAP server hostname. |
| `imap_port` | u16 | `993` | IMAP server port (993 for TLS). |
| `smtp_host` | string | `""` | SMTP server hostname. |
| `smtp_port` | u16 | `587` | SMTP server port (587 for STARTTLS). |
| `username` | string | `""` | Email address for both IMAP and SMTP. |
| `password_env` | string | `"EMAIL_PASSWORD"` | Env var holding the email password or app password. |
| `poll_interval_secs` | u64 | `30` | IMAP polling interval in seconds. |
| `folders` | list of strings | `["INBOX"]` | IMAP folders to monitor. |
| `allowed_senders` | list of strings | `[]` | Only process emails from these senders. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.teams]`
```toml
[channels.teams]
app_id = ""
app_password_env = "TEAMS_APP_PASSWORD"
webhook_port = 3978
allowed_tenants = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `app_id` | string | `""` | Azure Bot App ID. |
| `app_password_env` | string | `"TEAMS_APP_PASSWORD"` | Env var holding the Azure Bot Framework app password. |
| `webhook_port` | u16 | `3978` | Port for the Bot Framework incoming webhook. |
| `allowed_tenants` | list of strings | `[]` | Azure AD tenant IDs allowed. Empty = allow all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.mattermost]`
```toml
[channels.mattermost]
server_url = "https://mattermost.example.com"
token_env = "MATTERMOST_TOKEN"
allowed_channels = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server_url` | string | `""` | Mattermost server URL. |
| `token_env` | string | `"MATTERMOST_TOKEN"` | Env var holding the Mattermost bot token. |
| `allowed_channels` | list of strings | `[]` | Channel IDs to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.irc]`
```toml
[channels.irc]
server = "irc.libera.chat"
port = 6667
nick = "openfang"
# password_env = "IRC_PASSWORD"
channels = ["#openfang"]
use_tls = false
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server` | string | `"irc.libera.chat"` | IRC server hostname. |
| `port` | u16 | `6667` | IRC server port. |
| `nick` | string | `"openfang"` | Bot nickname. |
| `password_env` | string or null | `null` | Env var holding the server password (optional). |
| `channels` | list of strings | `[]` | IRC channels to join (e.g., `["#openfang", "#general"]`). |
| `use_tls` | bool | `false` | Use TLS for the connection. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.google_chat]`
```toml
[channels.google_chat]
service_account_env = "GOOGLE_CHAT_SERVICE_ACCOUNT"
space_ids = []
webhook_port = 8444
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `service_account_env` | string | `"GOOGLE_CHAT_SERVICE_ACCOUNT"` | Env var holding the service account JSON key. |
| `space_ids` | list of strings | `[]` | Google Chat space IDs to listen in. |
| `webhook_port` | u16 | `8444` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.twitch]`
```toml
[channels.twitch]
oauth_token_env = "TWITCH_OAUTH_TOKEN"
channels = ["mychannel"]
nick = "openfang"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `oauth_token_env` | string | `"TWITCH_OAUTH_TOKEN"` | Env var holding the Twitch OAuth token. |
| `channels` | list of strings | `[]` | Twitch channels to join (without `#` prefix). |
| `nick` | string | `"openfang"` | Bot nickname in Twitch chat. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.rocketchat]`
```toml
[channels.rocketchat]
server_url = "https://rocketchat.example.com"
token_env = "ROCKETCHAT_TOKEN"
user_id = ""
allowed_channels = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server_url` | string | `""` | Rocket.Chat server URL. |
| `token_env` | string | `"ROCKETCHAT_TOKEN"` | Env var holding the Rocket.Chat auth token. |
| `user_id` | string | `""` | Bot user ID. |
| `allowed_channels` | list of strings | `[]` | Channel IDs to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.zulip]`
```toml
[channels.zulip]
server_url = "https://zulip.example.com"
bot_email = "bot@zulip.example.com"
api_key_env = "ZULIP_API_KEY"
streams = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server_url` | string | `""` | Zulip server URL. |
| `bot_email` | string | `""` | Bot email address registered in Zulip. |
| `api_key_env` | string | `"ZULIP_API_KEY"` | Env var holding the Zulip API key. |
| `streams` | list of strings | `[]` | Stream names to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.xmpp]`
```toml
[channels.xmpp]
jid = "bot@jabber.org"
password_env = "XMPP_PASSWORD"
server = ""
port = 5222
rooms = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `jid` | string | `""` | XMPP JID (e.g., `"bot@jabber.org"`). |
| `password_env` | string | `"XMPP_PASSWORD"` | Env var holding the XMPP password. |
| `server` | string | `""` | XMPP server hostname. Defaults to the JID domain if empty. |
| `port` | u16 | `5222` | XMPP server port. |
| `rooms` | list of strings | `[]` | MUC (multi-user chat) rooms to join. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.line]`
```toml
[channels.line]
channel_secret_env = "LINE_CHANNEL_SECRET"
access_token_env = "LINE_CHANNEL_ACCESS_TOKEN"
webhook_port = 8450
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `channel_secret_env` | string | `"LINE_CHANNEL_SECRET"` | Env var holding the LINE channel secret. |
| `access_token_env` | string | `"LINE_CHANNEL_ACCESS_TOKEN"` | Env var holding the LINE channel access token. |
| `webhook_port` | u16 | `8450` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.viber]`
```toml
[channels.viber]
auth_token_env = "VIBER_AUTH_TOKEN"
webhook_url = ""
webhook_port = 8451
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `auth_token_env` | string | `"VIBER_AUTH_TOKEN"` | Env var holding the Viber Bot auth token. |
| `webhook_url` | string | `""` | Public URL for the Viber webhook endpoint. |
| `webhook_port` | u16 | `8451` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.messenger]`
```toml
[channels.messenger]
page_token_env = "MESSENGER_PAGE_TOKEN"
verify_token_env = "MESSENGER_VERIFY_TOKEN"
webhook_port = 8452
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `page_token_env` | string | `"MESSENGER_PAGE_TOKEN"` | Env var holding the Facebook page access token. |
| `verify_token_env` | string | `"MESSENGER_VERIFY_TOKEN"` | Env var holding the webhook verify token. |
| `webhook_port` | u16 | `8452` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.reddit]`
```toml
[channels.reddit]
client_id = ""
client_secret_env = "REDDIT_CLIENT_SECRET"
username = ""
password_env = "REDDIT_PASSWORD"
subreddits = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `client_id` | string | `""` | Reddit app client ID. |
| `client_secret_env` | string | `"REDDIT_CLIENT_SECRET"` | Env var holding the Reddit client secret. |
| `username` | string | `""` | Reddit bot username. |
| `password_env` | string | `"REDDIT_PASSWORD"` | Env var holding the Reddit bot password. |
| `subreddits` | list of strings | `[]` | Subreddit names to monitor. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.mastodon]`
```toml
[channels.mastodon]
instance_url = "https://mastodon.social"
access_token_env = "MASTODON_ACCESS_TOKEN"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `instance_url` | string | `""` | Mastodon instance URL (e.g., `"https://mastodon.social"`). |
| `access_token_env` | string | `"MASTODON_ACCESS_TOKEN"` | Env var holding the Mastodon access token. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.bluesky]`
```toml
[channels.bluesky]
identifier = "mybot.bsky.social"
app_password_env = "BLUESKY_APP_PASSWORD"
service_url = "https://bsky.social"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `identifier` | string | `""` | Bluesky handle or DID. |
| `app_password_env` | string | `"BLUESKY_APP_PASSWORD"` | Env var holding the Bluesky app password. |
| `service_url` | string | `"https://bsky.social"` | PDS (Personal Data Server) URL. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.feishu]`
```toml
[channels.feishu]
app_id = ""
app_secret_env = "FEISHU_APP_SECRET"
webhook_port = 8453
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `app_id` | string | `""` | Feishu/Lark app ID. |
| `app_secret_env` | string | `"FEISHU_APP_SECRET"` | Env var holding the Feishu app secret. |
| `webhook_port` | u16 | `8453` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.revolt]`
```toml
[channels.revolt]
bot_token_env = "REVOLT_BOT_TOKEN"
api_url = "https://api.revolt.chat"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"REVOLT_BOT_TOKEN"` | Env var holding the Revolt bot token. |
| `api_url` | string | `"https://api.revolt.chat"` | Revolt API base URL. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.nextcloud]`
```toml
[channels.nextcloud]
server_url = "https://nextcloud.example.com"
token_env = "NEXTCLOUD_TOKEN"
allowed_rooms = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server_url` | string | `""` | Nextcloud server URL. |
| `token_env` | string | `"NEXTCLOUD_TOKEN"` | Env var holding the Nextcloud Talk auth token. |
| `allowed_rooms` | list of strings | `[]` | Room tokens to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.guilded]`
```toml
[channels.guilded]
bot_token_env = "GUILDED_BOT_TOKEN"
server_ids = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"GUILDED_BOT_TOKEN"` | Env var holding the Guilded bot token. |
| `server_ids` | list of strings | `[]` | Server IDs to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.keybase]`
```toml
[channels.keybase]
username = ""
paperkey_env = "KEYBASE_PAPERKEY"
allowed_teams = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `username` | string | `""` | Keybase username. |
| `paperkey_env` | string | `"KEYBASE_PAPERKEY"` | Env var holding the Keybase paper key. |
| `allowed_teams` | list of strings | `[]` | Team names to listen in. Empty = all DMs. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.threema]`
```toml
[channels.threema]
threema_id = ""
secret_env = "THREEMA_SECRET"
webhook_port = 8454
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `threema_id` | string | `""` | Threema Gateway ID. |
| `secret_env` | string | `"THREEMA_SECRET"` | Env var holding the Threema API secret. |
| `webhook_port` | u16 | `8454` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.nostr]`
```toml
[channels.nostr]
private_key_env = "NOSTR_PRIVATE_KEY"
relays = ["wss://relay.damus.io"]
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `private_key_env` | string | `"NOSTR_PRIVATE_KEY"` | Env var holding the Nostr private key (nsec or hex format). |
| `relays` | list of strings | `["wss://relay.damus.io"]` | Nostr relay WebSocket URLs to connect to. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.webex]`
```toml
[channels.webex]
bot_token_env = "WEBEX_BOT_TOKEN"
allowed_rooms = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"WEBEX_BOT_TOKEN"` | Env var holding the Webex bot token. |
| `allowed_rooms` | list of strings | `[]` | Room IDs to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.pumble]`
```toml
[channels.pumble]
bot_token_env = "PUMBLE_BOT_TOKEN"
webhook_port = 8455
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"PUMBLE_BOT_TOKEN"` | Env var holding the Pumble bot token. |
| `webhook_port` | u16 | `8455` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.flock]`
```toml
[channels.flock]
bot_token_env = "FLOCK_BOT_TOKEN"
webhook_port = 8456
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `bot_token_env` | string | `"FLOCK_BOT_TOKEN"` | Env var holding the Flock bot token. |
| `webhook_port` | u16 | `8456` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.twist]`
```toml
[channels.twist]
token_env = "TWIST_TOKEN"
workspace_id = ""
allowed_channels = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `token_env` | string | `"TWIST_TOKEN"` | Env var holding the Twist API token. |
| `workspace_id` | string | `""` | Twist workspace ID. |
| `allowed_channels` | list of strings | `[]` | Channel IDs to listen in. Empty = all. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.mumble]`
```toml
[channels.mumble]
host = "mumble.example.com"
port = 64738
username = "openfang"
password_env = "MUMBLE_PASSWORD"
channel = ""
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `host` | string | `""` | Mumble server hostname. |
| `port` | u16 | `64738` | Mumble server port. |
| `username` | string | `"openfang"` | Bot username in Mumble. |
| `password_env` | string | `"MUMBLE_PASSWORD"` | Env var holding the Mumble server password. |
| `channel` | string | `""` | Mumble channel to join. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.dingtalk]`
```toml
[channels.dingtalk]
access_token_env = "DINGTALK_ACCESS_TOKEN"
secret_env = "DINGTALK_SECRET"
webhook_port = 8457
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `access_token_env` | string | `"DINGTALK_ACCESS_TOKEN"` | Env var holding the DingTalk webhook access token. |
| `secret_env` | string | `"DINGTALK_SECRET"` | Env var holding the DingTalk signing secret. |
| `webhook_port` | u16 | `8457` | Port for the incoming webhook. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.discourse]`
```toml
[channels.discourse]
base_url = "https://forum.example.com"
api_key_env = "DISCOURSE_API_KEY"
api_username = "system"
categories = []
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `base_url` | string | `""` | Discourse forum base URL. |
| `api_key_env` | string | `"DISCOURSE_API_KEY"` | Env var holding the Discourse API key. |
| `api_username` | string | `"system"` | Discourse API username. |
| `categories` | list of strings | `[]` | Category slugs to monitor. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.gitter]`
```toml
[channels.gitter]
token_env = "GITTER_TOKEN"
room_id = ""
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `token_env` | string | `"GITTER_TOKEN"` | Env var holding the Gitter auth token. |
| `room_id` | string | `""` | Gitter room ID to listen in. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.ntfy]`
```toml
[channels.ntfy]
server_url = "https://ntfy.sh"
topic = "my-agent-topic"
token_env = "NTFY_TOKEN"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server_url` | string | `"https://ntfy.sh"` | ntfy server URL. Can be self-hosted. |
| `topic` | string | `""` | Topic to subscribe/publish to. |
| `token_env` | string | `"NTFY_TOKEN"` | Env var holding the auth token. Optional for public topics. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.gotify]`
```toml
[channels.gotify]
server_url = "https://gotify.example.com"
app_token_env = "GOTIFY_APP_TOKEN"
client_token_env = "GOTIFY_CLIENT_TOKEN"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `server_url` | string | `""` | Gotify server URL. |
| `app_token_env` | string | `"GOTIFY_APP_TOKEN"` | Env var holding the Gotify app token (for sending messages). |
| `client_token_env` | string | `"GOTIFY_CLIENT_TOKEN"` | Env var holding the Gotify client token (for receiving messages via WebSocket). |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.webhook]`
```toml
[channels.webhook]
secret_env = "WEBHOOK_SECRET"
listen_port = 8460
# callback_url = "https://example.com/webhook"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `secret_env` | string | `"WEBHOOK_SECRET"` | Env var holding the HMAC signing secret for verifying incoming webhooks. |
| `listen_port` | u16 | `8460` | Port to listen for incoming webhook requests. |
| `callback_url` | string or null | `null` | URL to POST outgoing messages to. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
#### `[channels.linkedin]`
```toml
[channels.linkedin]
access_token_env = "LINKEDIN_ACCESS_TOKEN"
organization_id = ""
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `access_token_env` | string | `"LINKEDIN_ACCESS_TOKEN"` | Env var holding the LinkedIn OAuth2 access token. |
| `organization_id` | string | `""` | LinkedIn organization ID for messaging. |
| `default_agent` | string or null | `null` | Agent name to route messages to. |
---
### `[[mcp_servers]]`
MCP (Model Context Protocol) server connections provide external tool integration. Each entry is a separate `[[mcp_servers]]` array element.
```toml
[[mcp_servers]]
name = "filesystem"
timeout_secs = 30
env = []
[mcp_servers.transport]
type = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/docs"]
```
```toml
[[mcp_servers]]
name = "remote-api"
timeout_secs = 60
env = ["GITHUB_PERSONAL_ACCESS_TOKEN"]
[mcp_servers.transport]
type = "sse"
url = "https://mcp.example.com/sse"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `name` | string | *required* | Display name for this MCP server. Tools are namespaced as `mcp_{name}_{tool}`. |
| `timeout_secs` | u64 | `30` | Request timeout in seconds. |
| `env` | list of strings | `[]` | Environment variable names to pass through to the subprocess (stdio transport only). |
**Transport variants** (tagged union on `type`):
| `type` | Fields | Description |
|--------|--------|-------------|
| `stdio` | `command` (string), `args` (list of strings, default `[]`) | Spawn a subprocess, communicate via JSON-RPC over stdin/stdout. |
| `sse` | `url` (string) | Connect to an HTTP Server-Sent Events endpoint. |
---
### `[a2a]`
Agent-to-Agent protocol configuration, enabling inter-agent communication across OpenFang instances.
```toml
[a2a]
enabled = true
listen_path = "/a2a"
[[a2a.external_agents]]
name = "research-agent"
url = "https://agent.example.com/.well-known/agent.json"
[[a2a.external_agents]]
name = "code-reviewer"
url = "https://reviewer.example.com/.well-known/agent.json"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `enabled` | bool | `false` | Whether A2A protocol is enabled. |
| `listen_path` | string | `"/a2a"` | URL path prefix for A2A endpoints. |
| `external_agents` | list of objects | `[]` | External A2A agents to discover and interact with. |
**`external_agents` entries:**
| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Display name for the external agent. |
| `url` | string | Agent card endpoint URL (typically `/.well-known/agent.json`). |
---
### `[[fallback_providers]]`
Fallback provider chain. When the primary LLM provider (`[default_model]`) fails, these are tried in order.
```toml
[[fallback_providers]]
provider = "ollama"
model = "llama3.2:latest"
api_key_env = ""
# base_url = "http://localhost:11434"
[[fallback_providers]]
provider = "groq"
model = "llama-3.3-70b-versatile"
api_key_env = "GROQ_API_KEY"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `provider` | string | `""` | Provider name (e.g., `"ollama"`, `"groq"`, `"openai"`). |
| `model` | string | `""` | Model identifier for this provider. |
| `api_key_env` | string | `""` | Env var name for the API key. Empty for local providers (ollama, vllm, lmstudio). |
| `base_url` | string or null | `null` | Base URL override. Uses catalog default if null. |
---
### `[[users]]`
RBAC multi-user configuration. Users can be assigned roles and bound to channel platform identities.
```toml
[[users]]
name = "Alice"
role = "owner"
api_key_hash = "sha256_hash_of_api_key"
[users.channel_bindings]
telegram = "123456"
discord = "987654321"
slack = "U0ABCDEFG"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `name` | string | *required* | User display name. |
| `role` | string | `"user"` | User role in the RBAC hierarchy. |
| `channel_bindings` | map of string to string | `{}` | Maps channel platform names to platform-specific user IDs, binding this user identity across channels. |
| `api_key_hash` | string or null | `null` | SHA256 hash of the user's personal API key for authenticated API access. |
**Role hierarchy** (highest to lowest privilege):
| Role | Description |
|------|-------------|
| `owner` | Full administrative access. Can manage all agents, users, and configuration. |
| `admin` | Can manage agents and most settings. Cannot modify owner accounts. |
| `user` | Can interact with agents. Limited management capabilities. |
| `viewer` | Read-only access. Can view agent responses but cannot send messages. |
---
### Channel Overrides
Every channel adapter supports an `[channels.<name>.overrides]` sub-table that customizes agent behavior per-channel.
```toml
[channels.telegram.overrides]
model = "claude-haiku-4-5-20251001"
system_prompt = "You are a concise Telegram assistant."
dm_policy = "respond"
group_policy = "mention_only"
rate_limit_per_user = 10
threading = true
output_format = "telegram_html"
usage_footer = "tokens"
```
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `model` | string or null | `null` | Model override for this channel. Uses the agent's default model when null. |
| `system_prompt` | string or null | `null` | System prompt override for this channel. |
| `dm_policy` | string | `"respond"` | How the bot handles direct messages. See below. |
| `group_policy` | string | `"mention_only"` | How the bot handles group messages. See below. |
| `rate_limit_per_user` | u32 | `0` | Maximum messages per user per minute. `0` = unlimited. |
| `threading` | bool | `false` | Enable thread replies (where supported by the platform). |
| `output_format` | string or null | `null` | Override output formatting. See below. |
| `usage_footer` | string or null | `null` | Override usage footer mode for this channel. Values: `off`, `tokens`, `cost`, `full`. |
**`dm_policy` values:**
| Value | Description |
|-------|-------------|
| `respond` | Respond to all direct messages (default). |
| `allowed_only` | Only respond to DMs from users in the allowed list. |
| `ignore` | Ignore all direct messages. |
**`group_policy` values:**
| Value | Description |
|-------|-------------|
| `all` | Respond to all messages in group chats. |
| `mention_only` | Only respond when the bot is @mentioned (default). |
| `commands_only` | Only respond to slash commands. |
| `ignore` | Ignore all group messages. |
**`output_format` values:**
| Value | Description |
|-------|-------------|
| `markdown` | Standard Markdown (default). |
| `telegram_html` | Telegram HTML subset (`<b>`, `<i>`, `<code>`, etc.). |
| `slack_mrkdwn` | Slack mrkdwn format (`*bold*`, `_italic_`, `` `code` ``). |
| `plain_text` | No formatting markup. |
---
## Environment Variables
Complete table of all environment variables referenced by the configuration. None of these are read by the config file itself -- they are read at runtime by the kernel and channel adapters.
### LLM Provider Keys
| Variable | Used By | Description |
|----------|---------|-------------|
| `ANTHROPIC_API_KEY` | `[default_model]` | Anthropic API key (Claude models). |
| `GEMINI_API_KEY` | Gemini driver | Google Gemini API key. Alias: `GOOGLE_API_KEY`. |
| `OPENAI_API_KEY` | OpenAI-compat driver | OpenAI API key. |
| `GROQ_API_KEY` | Groq provider | Groq API key (fast Llama inference). |
| `DEEPSEEK_API_KEY` | DeepSeek provider | DeepSeek API key. |
| `PERPLEXITY_API_KEY` | Perplexity provider / web search | Perplexity API key. |
| `OPENROUTER_API_KEY` | OpenRouter provider | OpenRouter API key. |
| `TOGETHER_API_KEY` | Together AI provider | Together AI API key. |
| `MISTRAL_API_KEY` | Mistral provider | Mistral AI API key. |
| `FIREWORKS_API_KEY` | Fireworks provider | Fireworks AI API key. |
| `COHERE_API_KEY` | Cohere provider | Cohere API key. |
| `AI21_API_KEY` | AI21 provider | AI21 Labs API key. |
| `CEREBRAS_API_KEY` | Cerebras provider | Cerebras API key. |
| `SAMBANOVA_API_KEY` | SambaNova provider | SambaNova API key. |
| `HUGGINGFACE_API_KEY` | Hugging Face provider | Hugging Face Inference API key. |
| `XAI_API_KEY` | xAI provider | xAI (Grok) API key. |
| `REPLICATE_API_KEY` | Replicate provider | Replicate API key. |
### Web Search Keys
| Variable | Used By | Description |
|----------|---------|-------------|
| `BRAVE_API_KEY` | `[web.brave]` | Brave Search API key. |
| `TAVILY_API_KEY` | `[web.tavily]` | Tavily Search API key. |
| `PERPLEXITY_API_KEY` | `[web.perplexity]` | Perplexity Search API key (shared with LLM provider). |
### Channel Tokens
| Variable | Channel | Description |
|----------|---------|-------------|
| `TELEGRAM_BOT_TOKEN` | Telegram | Bot API token from @BotFather. |
| `DISCORD_BOT_TOKEN` | Discord | Discord bot token. |
| `SLACK_APP_TOKEN` | Slack | Slack app-level token (`xapp-`) for Socket Mode. |
| `SLACK_BOT_TOKEN` | Slack | Slack bot token (`xoxb-`) for REST API. |
| `WHATSAPP_ACCESS_TOKEN` | WhatsApp | WhatsApp Cloud API access token. |
| `WHATSAPP_VERIFY_TOKEN` | WhatsApp | Webhook verification token. |
| `MATRIX_ACCESS_TOKEN` | Matrix | Matrix homeserver access token. |
| `EMAIL_PASSWORD` | Email | Email account password or app password. |
| `TEAMS_APP_PASSWORD` | Teams | Azure Bot Framework app password. |
| `MATTERMOST_TOKEN` | Mattermost | Mattermost bot token. |
| `TWITCH_OAUTH_TOKEN` | Twitch | Twitch OAuth token. |
| `ROCKETCHAT_TOKEN` | Rocket.Chat | Rocket.Chat auth token. |
| `ZULIP_API_KEY` | Zulip | Zulip bot API key. |
| `XMPP_PASSWORD` | XMPP | XMPP account password. |
| `GOOGLE_CHAT_SERVICE_ACCOUNT` | Google Chat | Service account JSON key. |
| `LINE_CHANNEL_SECRET` | LINE | LINE channel secret. |
| `LINE_CHANNEL_ACCESS_TOKEN` | LINE | LINE channel access token. |
| `VIBER_AUTH_TOKEN` | Viber | Viber Bot auth token. |
| `MESSENGER_PAGE_TOKEN` | Messenger | Facebook page access token. |
| `MESSENGER_VERIFY_TOKEN` | Messenger | Webhook verification token. |
| `REDDIT_CLIENT_SECRET` | Reddit | Reddit app client secret. |
| `REDDIT_PASSWORD` | Reddit | Reddit bot account password. |
| `MASTODON_ACCESS_TOKEN` | Mastodon | Mastodon access token. |
| `BLUESKY_APP_PASSWORD` | Bluesky | Bluesky app password. |
| `FEISHU_APP_SECRET` | Feishu | Feishu/Lark app secret. |
| `REVOLT_BOT_TOKEN` | Revolt | Revolt bot token. |
| `NEXTCLOUD_TOKEN` | Nextcloud | Nextcloud Talk auth token. |
| `GUILDED_BOT_TOKEN` | Guilded | Guilded bot token. |
| `KEYBASE_PAPERKEY` | Keybase | Keybase paper key. |
| `THREEMA_SECRET` | Threema | Threema Gateway API secret. |
| `NOSTR_PRIVATE_KEY` | Nostr | Nostr private key (nsec or hex). |
| `WEBEX_BOT_TOKEN` | Webex | Webex bot token. |
| `PUMBLE_BOT_TOKEN` | Pumble | Pumble bot token. |
| `FLOCK_BOT_TOKEN` | Flock | Flock bot token. |
| `TWIST_TOKEN` | Twist | Twist API token. |
| `MUMBLE_PASSWORD` | Mumble | Mumble server password. |
| `DINGTALK_ACCESS_TOKEN` | DingTalk | DingTalk webhook access token. |
| `DINGTALK_SECRET` | DingTalk | DingTalk signing secret. |
| `DISCOURSE_API_KEY` | Discourse | Discourse API key. |
| `GITTER_TOKEN` | Gitter | Gitter auth token. |
| `NTFY_TOKEN` | ntfy | ntfy auth token (optional for public topics). |
| `GOTIFY_APP_TOKEN` | Gotify | Gotify app token (sending). |
| `GOTIFY_CLIENT_TOKEN` | Gotify | Gotify client token (receiving). |
| `WEBHOOK_SECRET` | Webhook | HMAC signing secret for webhook verification. |
| `LINKEDIN_ACCESS_TOKEN` | LinkedIn | LinkedIn OAuth2 access token. |
---
## Validation
`KernelConfig::validate()` runs at boot time and returns a list of **warnings** (non-fatal). The kernel still starts, but logs each warning.
### What is validated
For every **enabled channel** (i.e., its config section is present in the TOML), the validator checks that the corresponding environment variable(s) are set and non-empty:
| Channel | Env vars checked |
|---------|-----------------|
| Telegram | `bot_token_env` |
| Discord | `bot_token_env` |
| Slack | `app_token_env`, `bot_token_env` (both checked) |
| WhatsApp | `access_token_env` |
| Matrix | `access_token_env` |
| Email | `password_env` |
| Teams | `app_password_env` |
| Mattermost | `token_env` |
| Zulip | `api_key_env` |
| Twitch | `oauth_token_env` |
| Rocket.Chat | `token_env` |
| Google Chat | `service_account_env` |
| XMPP | `password_env` |
| LINE | `access_token_env` |
| Viber | `auth_token_env` |
| Messenger | `page_token_env` |
| Reddit | `client_secret_env` |
| Mastodon | `access_token_env` |
| Bluesky | `app_password_env` |
| Feishu | `app_secret_env` |
| Revolt | `bot_token_env` |
| Nextcloud | `token_env` |
| Guilded | `bot_token_env` |
| Keybase | `paperkey_env` |
| Threema | `secret_env` |
| Nostr | `private_key_env` |
| Webex | `bot_token_env` |
| Pumble | `bot_token_env` |
| Flock | `bot_token_env` |
| Twist | `token_env` |
| Mumble | `password_env` |
| DingTalk | `access_token_env` |
| Discourse | `api_key_env` |
| Gitter | `token_env` |
| ntfy | `token_env` (only if `token_env` is non-empty; public topics are OK without auth) |
| Gotify | `app_token_env` |
| Webhook | `secret_env` |
| LinkedIn | `access_token_env` |
For **web search providers**, the validator checks:
| Provider | Env var checked |
|----------|----------------|
| `brave` | `web.brave.api_key_env` |
| `tavily` | `web.tavily.api_key_env` |
| `perplexity` | `web.perplexity.api_key_env` |
| `duckduckgo` | (no check -- no API key needed) |
| `auto` | (no check -- cascading fallback handles missing keys) |
### What is NOT validated
- The `api_key_env` in `[default_model]` is not checked by `validate()`. Missing LLM keys cause errors at runtime when the driver is first used.
- The `shared_secret` in `[network]` is not validated against `network_enabled`. If networking is enabled with an empty secret, authentication will fail at connection time.
- MCP server configurations are not validated at config load time. Connection errors surface during the background MCP connect phase.
- Agent manifests have their own separate validation.
---
## Related Configuration
Some subsystems have their own configuration that is not part of `config.toml` but is worth noting:
### Session Compaction (runtime)
Configured internally via `CompactionConfig` (not currently exposed in `config.toml`):
| Field | Default | Description |
|-------|---------|-------------|
| `threshold` | `80` | Compact when session message count exceeds this. |
| `keep_recent` | `20` | Number of recent messages preserved verbatim after compaction. |
| `max_summary_tokens` | `1024` | Maximum tokens for the LLM summary of compacted messages. |
### WASM Sandbox (runtime)
Configured internally via `SandboxConfig` (not currently exposed in `config.toml`):
| Field | Default | Description |
|-------|---------|-------------|
| `fuel_limit` | `1000000` | Maximum CPU instruction budget. `0` = unlimited. |
| `max_memory_bytes` | `16777216` (16 MB) | Maximum WASM linear memory. |
| `timeout_secs` | `null` (30s fallback) | Wall-clock timeout for epoch-based interruption. |
### Model Routing (per-agent manifest)
Configured in agent manifests via `ModelRoutingConfig`:
| Field | Default | Description |
|-------|---------|-------------|
| `simple_model` | `"claude-haiku-4-5-20251001"` | Model for simple queries. |
| `medium_model` | `"claude-sonnet-4-20250514"` | Model for medium-complexity queries. |
| `complex_model` | `"claude-sonnet-4-20250514"` | Model for complex queries. |
| `simple_threshold` | `100` | Token count below which a query is classified as simple. |
| `complex_threshold` | `500` | Token count above which a query is classified as complex. |
### Autonomous Guardrails (per-agent manifest)
Configured in agent manifests via `AutonomousConfig`:
| Field | Default | Description |
|-------|---------|-------------|
| `quiet_hours` | `null` | Cron expression for quiet hours (agent pauses during this window). |
| `max_iterations` | `50` | Maximum tool-use iterations per invocation. |
| `max_restarts` | `10` | Maximum automatic restarts before permanent stop. |
| `heartbeat_interval_secs` | `30` | Seconds between heartbeat health checks. |
| `heartbeat_channel` | `null` | Channel to send heartbeat status to (e.g., `"telegram"`). |