You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 86bfa20
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+93Lines changed: 93 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -428,6 +428,96 @@ All output flows through `LeapConsole`, ensuring consistent theming. All input f
428
428
429
429
---
430
430
431
+
## External Platform Integration (Gateway)
432
+
433
+
LeapFlow can connect to external messaging platforms — **Feishu (Lark)**, **DingTalk**, **Telegram**, and more — turning any IM channel into a natural-language interface to the agent. Platforms are integrated through a declarative **manifest** system and configured via a conversational setup flow, with no source-code changes required.
434
+
435
+
### Design Highlights
436
+
437
+
| Aspect | Approach |
438
+
|--------|----------|
439
+
|**Config-as-Conversation**| Say *"connect to Feishu"* in the REPL. The agent walks you through credential setup in 1–2 turns — no config files to edit by hand. |
440
+
|**Declarative Manifests**| Each platform is defined by a YAML manifest (credentials, setup guide, adapter module). Add a new platform by dropping a `.yaml` file. |
441
+
|**Credential Security**| Secrets are encrypted at rest (Fernet AES-128-CBC), never appear in LLM context or logs, and can be overridden via environment variables (`LEAPFLOW_<PLATFORM>_<KEY>`). |
442
+
|**Lazy Loading**| Platform SDK dependencies are imported only when a platform is first connected, keeping CLI startup instant. |
443
+
|**Adapter Protocol**| Platform adapters implement a simple Python `Protocol` — `connect()`, `disconnect()`, `send()`, `on_message` callback — extensible via `PlatformAdapterMixin` for graceful degradation. |
444
+
445
+
### Quick Start
446
+
447
+
```
448
+
❯ connect to Telegram
449
+
# Agent shows setup steps, asks for Bot Token
450
+
❯ <paste your bot token>
451
+
# Agent validates, encrypts, connects — done.
452
+
```
453
+
454
+
Or use the `/gateway` slash command to check connection status:
455
+
456
+
```
457
+
❯ /gateway
458
+
┌── Gateway ─────────────────────┐
459
+
│ Connected │
460
+
│ ● Telegram (5m 32s) │
461
+
│ Available │
462
+
│ 飞书, DingTalk, Webhook │
463
+
│ │
464
+
│ Say "connect to <platform>" │
465
+
│ to set up a new integration. │
466
+
└────────────────────────────────┘
467
+
```
468
+
469
+
### Adding a Custom Platform
470
+
471
+
1. Create a YAML manifest in `~/.leapflow/profiles/<profile>/gateway/manifests/`:
472
+
473
+
```yaml
474
+
platform_id: my_platform
475
+
display_name: My Platform
476
+
category: im
477
+
478
+
credentials:
479
+
- key: api_key
480
+
label: API Key
481
+
required: true
482
+
secret: true
483
+
484
+
setup_guide:
485
+
summary_en: "Provide your API key to connect."
486
+
487
+
adapter:
488
+
module: my_package.adapter
489
+
class: MyAdapter
490
+
dependencies: [my-sdk]
491
+
```
492
+
493
+
2. Implement the adapter:
494
+
495
+
```python
496
+
from leapflow.gateway.protocol import PlatformAdapter
Environment variables take precedence over values stored in `gateway.yaml`.
518
+
519
+
---
520
+
431
521
## Workflow Copilot (Preview)
432
522
433
523
LeapFlow includes a **Workflow Copilot** that predicts your next action and offers proactive suggestions — like GitHub Copilot, but for any workflow on your computer.
@@ -641,6 +731,7 @@ uv run pytest -k "test_world_model" -q # By keyword
641
731
|`engine/`| Session orchestration and ReAct execution loop |
0 commit comments