zwarm 3.2.0__py3-none-any.whl → 3.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,396 @@
1
+ Metadata-Version: 2.4
2
+ Name: zwarm
3
+ Version: 3.3.0
4
+ Summary: Multi-Agent CLI Orchestration Research Platform
5
+ Requires-Python: <3.14,>=3.13
6
+ Requires-Dist: prompt-toolkit>=3.0.52
7
+ Requires-Dist: python-dotenv>=1.0.0
8
+ Requires-Dist: pyyaml>=6.0
9
+ Requires-Dist: rich>=13.0.0
10
+ Requires-Dist: typer>=0.9.0
11
+ Requires-Dist: wbal>=0.5.8
12
+ Description-Content-Type: text/markdown
13
+
14
+ # zwarm
15
+
16
+ Multi-agent CLI for orchestrating coding agents. Spawn, manage, and converse with multiple Codex sessions in parallel.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # From the workspace
22
+ cd /path/to/labs
23
+ uv sync
24
+
25
+ # Or install directly
26
+ uv pip install -e ./zwarm
27
+ ```
28
+
29
+ **Requirements:**
30
+ - Python 3.13+
31
+ - `codex` CLI installed and authenticated
32
+
33
+ **Environment:**
34
+ ```bash
35
+ export OPENAI_API_KEY="sk-..." # Required for Codex
36
+ export WEAVE_PROJECT="entity/zwarm" # Optional: Weave tracing
37
+ ```
38
+
39
+ ## Three Interfaces
40
+
41
+ zwarm has three ways to work with coding agents:
42
+
43
+ | Interface | Who drives | Use case |
44
+ |-----------|------------|----------|
45
+ | `zwarm interactive` | **You** | Direct session control, experimentation |
46
+ | `zwarm pilot` | **You + LLM** | Conversational guidance with checkpoints |
47
+ | `zwarm orchestrate` | **LLM** | Fully autonomous task execution |
48
+
49
+ All three use the **same session manager** - they're different interfaces to the same underlying system.
50
+
51
+ ```
52
+ .zwarm/sessions/ (GROUND TRUTH)
53
+
54
+ ┌───────────────┼───────────────┐
55
+ │ │ │
56
+ ▼ ▼ ▼
57
+ Orchestrate Pilot Interactive
58
+ (LLM) (LLM+REPL) (REPL)
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Quick Start
64
+
65
+ ```bash
66
+ # Initialize zwarm in your project
67
+ zwarm init
68
+
69
+ # Start the pilot (recommended for most users)
70
+ zwarm pilot --task "Build a REST API with authentication"
71
+
72
+ # Or go fully autonomous
73
+ zwarm orchestrate --task "Build a REST API with authentication"
74
+
75
+ # Or manual control
76
+ zwarm interactive
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Pilot Mode
82
+
83
+ **You chat with an LLM that delegates to coding agents.** Best of both worlds - LLM intelligence with human oversight.
84
+
85
+ ```bash
86
+ zwarm pilot
87
+ zwarm pilot --task "Add user authentication"
88
+ ```
89
+
90
+ ### Features
91
+
92
+ - **Conversational**: Chat naturally, the LLM handles delegation
93
+ - **Checkpoints**: Every turn is saved, time-travel with `:goto`
94
+ - **Multiline input**: Use `"""` for pasting large prompts
95
+ - **Status bar**: See token usage, cost estimates, context window
96
+
97
+ ### Commands
98
+
99
+ | Command | Description |
100
+ |---------|-------------|
101
+ | `:help` | Show all commands |
102
+ | `:status` | Token usage, cost, context window |
103
+ | `:history` | Show turn checkpoints |
104
+ | `:goto T3` | Jump back to turn 3 |
105
+ | `:sessions` | List executor sessions |
106
+ | `:quit` | Exit |
107
+
108
+ ### Example
109
+
110
+ ```
111
+ $ zwarm pilot
112
+
113
+ > Add a login endpoint to the API
114
+
115
+ Chooooching...
116
+
117
+ I'll delegate this to a coding agent.
118
+
119
+ [delegate] task: "Add login endpoint with JWT..."
120
+ → Session abc123 started
121
+
122
+ The agent is working on it. I'll check back shortly.
123
+
124
+ [sleep] 10s
125
+ [check_session] abc123
126
+ → completed (45s, 12k tokens)
127
+
128
+ Done! The agent added a /login endpoint with JWT support...
129
+
130
+ > Now add rate limiting
131
+
132
+ I'll have the same agent continue with rate limiting.
133
+
134
+ [converse] abc123: "Add rate limiting to the login endpoint..."
135
+ ```
136
+
137
+ ### Multiline Input
138
+
139
+ Start with `"""` and end with `"""`:
140
+
141
+ ```
142
+ > """
143
+ Here's a complex task:
144
+ 1. Add authentication
145
+ 2. Add rate limiting
146
+ 3. Add tests
147
+ """
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Interactive Mode
153
+
154
+ **You are the orchestrator.** Direct control over sessions with autocomplete.
155
+
156
+ ```bash
157
+ zwarm interactive
158
+ ```
159
+
160
+ ### Commands
161
+
162
+ | Command | Description |
163
+ |---------|-------------|
164
+ | `spawn "task" [--search]` | Start a new session (--search enables web) |
165
+ | `ls` | Dashboard of all sessions (with costs) |
166
+ | `? ID` / `peek ID` | Quick status check |
167
+ | `show ID` | Full session details |
168
+ | `traj ID` | Show trajectory (steps taken) |
169
+ | `watch ID` | Live follow session output |
170
+ | `c ID "msg"` | Continue conversation |
171
+ | `kill ID \| all` | Stop session(s) |
172
+ | `rm ID \| all` | Delete session(s) |
173
+ | `help` | Show all commands |
174
+ | `quit` | Exit |
175
+
176
+ ### Example
177
+
178
+ ```
179
+ $ zwarm interactive
180
+
181
+ > spawn "Add tests for the auth module"
182
+ ✓ Started abc123 (running)
183
+ Use 'watch abc123' to follow
184
+
185
+ > spawn "Fix type errors in utils.py"
186
+ ✓ Started def456 (running)
187
+
188
+ > ls
189
+ ⟳ 2 running
190
+
191
+ ID │ │ Task │ Tokens │ Cost
192
+ abc123 │ ⟳ │ Add tests for the auth... │ 5,234 │ $0.052
193
+ def456 │ ⟳ │ Fix type errors in utils... │ 2,100 │ $0.021
194
+
195
+ > watch abc123
196
+ Watching abc123... (Ctrl+C to stop)
197
+ [step 3] shell: pytest tests/
198
+ [step 4] write: tests/test_auth.py
199
+ ...
200
+
201
+ > c abc123 "Also add edge case tests"
202
+ ✓ Injected message, session running
203
+
204
+ > kill all
205
+ ✓ Killed abc123
206
+ ✓ Killed def456
207
+ Killed 2 session(s)
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Orchestrate Mode
213
+
214
+ **An LLM runs autonomously.** Give it a task, it delegates to coding agents and manages them.
215
+
216
+ ```bash
217
+ zwarm orchestrate --task "Build a REST API with authentication"
218
+ zwarm orchestrate --task-file task.md
219
+ echo "Fix the bug" | zwarm orchestrate
220
+ ```
221
+
222
+ ### How It Works
223
+
224
+ The orchestrator LLM has access to:
225
+
226
+ | Tool | Description |
227
+ |------|-------------|
228
+ | `delegate(task, web_search=False)` | Start a new coding session |
229
+ | `converse(id, msg)` | Continue a session |
230
+ | `check_session(id)` | Get full session details |
231
+ | `peek_session(id)` | Quick status check |
232
+ | `list_sessions()` | List all sessions |
233
+ | `end_session(id)` | Kill/delete a session |
234
+ | `sleep(seconds)` | Wait before checking again |
235
+
236
+ **Async-first**: All sessions run in the background. The orchestrator uses `sleep()` to wait, then checks on progress.
237
+
238
+ **Web Search**: Pass `web_search=True` to `delegate()` for tasks needing current info (API docs, latest releases, etc.).
239
+
240
+ ### Watchers
241
+
242
+ Watchers monitor the orchestrator and intervene when needed:
243
+
244
+ | Watcher | Purpose |
245
+ |---------|---------|
246
+ | `progress` | Detects stuck/spinning behavior |
247
+ | `budget` | Enforces step/session limits |
248
+ | `delegation` | Tracks delegation patterns |
249
+ | `delegation_reminder` | Nudges to delegate when doing too much directly |
250
+
251
+ ---
252
+
253
+ ## Session Management
254
+
255
+ ### Quick Commands
256
+
257
+ ```bash
258
+ # List all sessions with costs
259
+ zwarm sessions
260
+
261
+ # Clean up old sessions
262
+ zwarm sessions --clean
263
+ zwarm sessions -c
264
+
265
+ # Kill all running sessions
266
+ zwarm sessions --kill-all
267
+ zwarm sessions -k
268
+
269
+ # Target specific session
270
+ zwarm sessions --rm abc123
271
+ zwarm sessions --kill abc123
272
+ ```
273
+
274
+ ### Session Lifecycle
275
+
276
+ ```
277
+ spawn → running → completed/failed/killed
278
+
279
+ converse → running → completed
280
+
281
+ converse → ...
282
+ ```
283
+
284
+ ### Storage
285
+
286
+ ```
287
+ .zwarm/sessions/<uuid>/
288
+ ├── meta.json # Status, task, model, tokens, cost
289
+ └── turns/
290
+ ├── turn_1.jsonl # Raw codex output for turn 1
291
+ ├── turn_2.jsonl # Output after continue
292
+ └── ...
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Configuration
298
+
299
+ ### Initialize
300
+
301
+ ```bash
302
+ zwarm init
303
+ ```
304
+
305
+ This creates:
306
+ - `.zwarm/config.toml` - Runtime settings (Weave, watchers)
307
+ - `.zwarm/codex.toml` - Codex CLI settings (model, reasoning)
308
+ - `zwarm.yaml` - Project context (optional, with `--with-project`)
309
+
310
+ ### Config Files
311
+
312
+ **`.zwarm/config.toml`** - Controls zwarm itself:
313
+ ```toml
314
+ [weave]
315
+ project = "your-entity/zwarm"
316
+
317
+ [orchestrator]
318
+ max_steps = 50
319
+
320
+ [executor]
321
+ adapter = "codex_mcp"
322
+ web_search = false # Enable web search for all delegated sessions
323
+
324
+ [watchers]
325
+ enabled = ["progress", "budget", "delegation", "delegation_reminder"]
326
+ ```
327
+
328
+ **`.zwarm/codex.toml`** - Controls the Codex CLI:
329
+ ```toml
330
+ model = "gpt-5.1-codex-mini"
331
+ model_reasoning_effort = "high" # low | medium | high
332
+ ```
333
+
334
+ **`zwarm.yaml`** - Project-specific context:
335
+ ```yaml
336
+ description: "My awesome project"
337
+
338
+ context: |
339
+ Tech stack: FastAPI, PostgreSQL, React
340
+ Key directories: src/api/, src/components/
341
+
342
+ constraints:
343
+ - "All new endpoints need tests"
344
+ - "Use existing patterns from src/api/"
345
+ ```
346
+
347
+ ---
348
+
349
+ ## CLI Reference
350
+
351
+ ```bash
352
+ # Setup
353
+ zwarm init # Initialize .zwarm/ with interactive prompts
354
+ zwarm init --yes # Quick setup with defaults
355
+
356
+ # Interfaces
357
+ zwarm pilot # Conversational LLM guidance (recommended)
358
+ zwarm interactive # Direct session control REPL
359
+ zwarm orchestrate # Fully autonomous LLM
360
+
361
+ # Session management
362
+ zwarm sessions # List all sessions
363
+ zwarm sessions -c # Clean old sessions
364
+ zwarm sessions -k # Kill all running
365
+
366
+ # Utilities
367
+ zwarm exec # Run single executor (testing)
368
+ zwarm clean # Kill orphaned processes
369
+ zwarm reset # Reset .zwarm/ state
370
+ ```
371
+
372
+ ---
373
+
374
+ ## Project Structure
375
+
376
+ ```
377
+ zwarm/
378
+ ├── src/zwarm/
379
+ │ ├── sessions/ # Session substrate
380
+ │ │ └── manager.py # CodexSessionManager (ground truth)
381
+ │ ├── cli/
382
+ │ │ ├── main.py # CLI commands
383
+ │ │ ├── pilot.py # Pilot REPL
384
+ │ │ └── interactive.py # Interactive REPL
385
+ │ ├── tools/
386
+ │ │ └── delegation.py # Orchestrator tools
387
+ │ ├── core/
388
+ │ │ ├── config.py # Configuration
389
+ │ │ ├── checkpoints.py # Time-travel primitives
390
+ │ │ ├── costs.py # Token cost estimation
391
+ │ │ └── state.py # State persistence
392
+ │ ├── watchers/ # Trajectory alignment
393
+ │ ├── prompts/ # System prompts
394
+ │ └── orchestrator.py # Orchestrator agent
395
+ └── STATE.md # Current project state
396
+ ```
@@ -1,35 +1,28 @@
1
1
  zwarm/__init__.py,sha256=3i3LMjHwIzE-LFIS2aUrwv3EZmpkvVMe-xj1h97rcSM,837
2
- zwarm/orchestrator.py,sha256=JGRGuJP05Nf5QibuWytjQAC_NuGGaGUR3G-tLq4SVxY,23624
2
+ zwarm/orchestrator.py,sha256=sUSYJ1_Zr1pDV-tMyS-jovBCnSmA_JVmgv9_PrIqzps,22277
3
3
  zwarm/test_orchestrator_watchers.py,sha256=QpoaehPU7ekT4XshbTOWnJ2H0wRveV3QOZjxbgyJJLY,807
4
- zwarm/adapters/__init__.py,sha256=O0b-SfZpb6txeNqFkXZ2aaf34yLFYreznyrAV25jF_Q,656
5
- zwarm/adapters/base.py,sha256=fZlQviTgVvOcwnxduTla6WuM6FzQJ_yoHMW5SxwVgQg,2527
6
- zwarm/adapters/claude_code.py,sha256=vAjsjD-_JjARmC4_FBSILQZmQCBrk_oNHo18a9ubuqk,11481
7
- zwarm/adapters/codex_mcp.py,sha256=EhdkM3gj5hc01AcM1ERhtfZbydK390yN4Pg3dawKIGU,48791
8
- zwarm/adapters/registry.py,sha256=EdyHECaNA5Kv1od64pYFBJyA_r_6I1r_eJTNP1XYLr4,1781
9
- zwarm/adapters/test_codex_mcp.py,sha256=0qhVzxn_KF-XUS30gXSJKwMdR3kWGsDY9iPk1Ihqn3w,10698
10
- zwarm/adapters/test_registry.py,sha256=otxcVDONwFCMisyANToF3iy7Y8dSbCL8bTmZNhxNuF4,2383
11
4
  zwarm/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- zwarm/cli/interactive.py,sha256=0-KFo8tCHdlycgzprW2QCJaN5IKAo2CS3t3n6Mhfd4Q,25893
13
- zwarm/cli/main.py,sha256=bekPGLv6YbWOs8npbcurneC-i6H0GhMsKso2R5Uf3vU,70220
14
- zwarm/cli/pilot.py,sha256=ev6UfniLJKDR_GMSEA8JjWdTbtfRK0MLGk3VBCXpwTg,38011
5
+ zwarm/cli/interactive.py,sha256=fCjX71tlN5fE2GvTgIbPRnRtmSiGmWiHsUYrQdVnwJE,25916
6
+ zwarm/cli/main.py,sha256=JfYS_PXNqSVU0RknKJZ3legfvr4lG-UZrK4X_TVnuOo,70559
7
+ zwarm/cli/pilot.py,sha256=SIjP5skBYTz0-VEJ94W0XjS07SAWdJ4zNnnHmuwBzio,38156
15
8
  zwarm/core/__init__.py,sha256=nEdpEHMFo0gEEKgX-eKHabyOdrOI6UXfWqLu3FfZDao,376
16
9
  zwarm/core/checkpoints.py,sha256=D6sXCMB7Sa1kchQ9_lQx_rabwc5-_7jbuynWgA1nkNY,6560
17
10
  zwarm/core/compact.py,sha256=Y8C7Gs-5-WOU43WRvQ863Qzd5xtuEqR6Aw3r2p8_-i8,10907
18
- zwarm/core/config.py,sha256=331i4io9uEnloFwUMjTPJ5_lQFKJR1nhTpA4SPfSpiI,11748
11
+ zwarm/core/config.py,sha256=QtxvbdVg_mU33x9ItfHu-Rov7ewUHfSi0K_4O1iBJJQ,12486
19
12
  zwarm/core/costs.py,sha256=pLyixKn9hbDvtzQofOqajeK3XxOpoHPpA8nw8QM7j3g,5403
20
13
  zwarm/core/environment.py,sha256=zrgh0N3Ng4HI2F1gCYkcQVGzjQPKiIFWuRe1OPRuRn0,6558
21
14
  zwarm/core/models.py,sha256=PrC3okRBVJxISUa1Fax4KkagqLT6Xub-kTxC9drN0sY,10083
22
15
  zwarm/core/state.py,sha256=MzrvODKEiJovI7YI1jajW4uukineZ3ezmW5oQinMgjg,11563
23
16
  zwarm/core/test_compact.py,sha256=WSdjCB5t4YMcknsrkmJIUsVOPY28s4y9GnDmu3Z4BFw,11878
24
- zwarm/core/test_config.py,sha256=26ozyiFOdjFF2c9Q-HDfFM6GOLfgw_5FZ55nTDMNYA8,4888
17
+ zwarm/core/test_config.py,sha256=bXXd3OHhK-ndC7wAxePWIdpu73s4O1eScxi3xDzrZwA,4828
25
18
  zwarm/core/test_models.py,sha256=sWTIhMZvuLP5AooGR6y8OR2EyWydqVfhmGrE7NPBBnk,8450
26
19
  zwarm/prompts/__init__.py,sha256=DI307o712F8qQyDt5vwnFgpVBrxpKwjhr0MaBHLzr9E,334
27
20
  zwarm/prompts/orchestrator.py,sha256=AkVbEpT91QbYFjUYOzm0d37wXrpm0esLBD1MG_W-3FI,15367
28
21
  zwarm/prompts/pilot.py,sha256=BcaV04-43FZyrtmoqCbA7DqnTlQ330TcDp9wNGhRojo,5586
29
22
  zwarm/sessions/__init__.py,sha256=jRibY8IfmNcnkgNmrgK2T81oa1w71wP_KQp9A1hPL7Q,568
30
- zwarm/sessions/manager.py,sha256=Aq7Wh-WW7ZMP8LgGa3g70wfGg6E2GYjJOBucy6HUfGc,27700
23
+ zwarm/sessions/manager.py,sha256=bLxwFA9D4EBW3wCC6OqolKcBiZtv8igz0Z7ZGA7EcVc,31559
31
24
  zwarm/tools/__init__.py,sha256=FpqxwXJA6-fQ7C-oLj30jjK_0qqcE7MbI0dQuaB56kU,290
32
- zwarm/tools/delegation.py,sha256=lw4jJk1zVpgPhuvkUVfjUWFFMJotpJXXVY1YfqiP_Iw,21468
25
+ zwarm/tools/delegation.py,sha256=wXKIb7eCL23c5NUwWi1G6JNg1PyXnwW-TNn7NrqchaE,21697
33
26
  zwarm/watchers/__init__.py,sha256=a96s7X6ruYkF2ItWWOZ3Q5QUOMOoeCW4Vz8XXcYLXPM,956
34
27
  zwarm/watchers/base.py,sha256=r1GoPlj06nOT2xp4fghfSjxbRyFFFQUB6HpZbEyO2OY,3834
35
28
  zwarm/watchers/builtin.py,sha256=IL5QwwKOIqWEfJ_uQWb321Px4i5OLtI_vnWQMudqKoA,19064
@@ -37,7 +30,7 @@ zwarm/watchers/llm_watcher.py,sha256=yJGpE3BGKNZX3qgPsiNtJ5d3UJpiTT1V-A-Rh4AiMYM
37
30
  zwarm/watchers/manager.py,sha256=XZjBVeHjgCUlkTUeHqdvBvHoBC862U1ik0fG6nlRGog,5587
38
31
  zwarm/watchers/registry.py,sha256=A9iBIVIFNtO7KPX0kLpUaP8dAK7ozqWLA44ocJGnOw4,1219
39
32
  zwarm/watchers/test_watchers.py,sha256=zOsxumBqKfR5ZVGxrNlxz6KcWjkcdp0QhW9WB0_20zM,7855
40
- zwarm-3.2.0.dist-info/METADATA,sha256=WDnj-d6wRTYslwj_41iYw3TjNHhRyh9HofeGx0pA0H4,7718
41
- zwarm-3.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
42
- zwarm-3.2.0.dist-info/entry_points.txt,sha256=u0OXq4q8d3yJ3EkUXwZfkS-Y8Lcy0F8cWrcQfoRxM6Q,46
43
- zwarm-3.2.0.dist-info/RECORD,,
33
+ zwarm-3.3.0.dist-info/METADATA,sha256=XuIf4S9hSl8xtmpqbTdHJiH15_jkLJagQ1Y8p5y5XHI,9670
34
+ zwarm-3.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
35
+ zwarm-3.3.0.dist-info/entry_points.txt,sha256=u0OXq4q8d3yJ3EkUXwZfkS-Y8Lcy0F8cWrcQfoRxM6Q,46
36
+ zwarm-3.3.0.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- """
2
- Adapters: Executor wrappers for CLI coding agents.
3
-
4
- Adapters provide a unified interface to different coding CLIs (Codex, Claude Code).
5
- Use the registry to discover and instantiate adapters by name.
6
- """
7
-
8
- from zwarm.adapters.base import ExecutorAdapter
9
- from zwarm.adapters.registry import register_adapter, get_adapter, list_adapters, adapter_exists
10
-
11
- # Import built-in adapters to register them
12
- from zwarm.adapters import codex_mcp as _codex_mcp # noqa: F401
13
- from zwarm.adapters import claude_code as _claude_code # noqa: F401
14
-
15
- __all__ = [
16
- "ExecutorAdapter",
17
- "register_adapter",
18
- "get_adapter",
19
- "list_adapters",
20
- "adapter_exists",
21
- ]
zwarm/adapters/base.py DELETED
@@ -1,109 +0,0 @@
1
- """
2
- Base adapter protocol for executor agents.
3
-
4
- All CLI coding agent adapters (codex, claude-code, gemini) implement this protocol.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- from abc import ABC, abstractmethod
10
- from pathlib import Path
11
- from typing import Literal
12
-
13
- from zwarm.core.models import ConversationSession, SessionMode
14
-
15
-
16
- class ExecutorAdapter(ABC):
17
- """
18
- Abstract base class for CLI coding agent adapters.
19
-
20
- Adapters handle the mechanics of:
21
- - Starting sessions (sync or async)
22
- - Sending messages in sync mode
23
- - Checking status in async mode
24
- - Stopping sessions
25
- """
26
-
27
- name: str = "base"
28
-
29
- @abstractmethod
30
- async def start_session(
31
- self,
32
- task: str,
33
- working_dir: Path,
34
- mode: Literal["sync", "async"] = "sync",
35
- model: str | None = None,
36
- **kwargs,
37
- ) -> ConversationSession:
38
- """
39
- Start a new session with the executor.
40
-
41
- Args:
42
- task: The task description/prompt
43
- working_dir: Directory to work in
44
- mode: "sync" for conversational, "async" for fire-and-forget
45
- model: Optional model override
46
- **kwargs: Adapter-specific options
47
-
48
- Returns:
49
- A ConversationSession with initial response (if sync)
50
- """
51
- ...
52
-
53
- @abstractmethod
54
- async def send_message(
55
- self,
56
- session: ConversationSession,
57
- message: str,
58
- ) -> str:
59
- """
60
- Send a message to a sync session and get response.
61
-
62
- Args:
63
- session: The active session
64
- message: Message to send
65
-
66
- Returns:
67
- The agent's response
68
-
69
- Raises:
70
- ValueError: If session is not in sync mode or not active
71
- """
72
- ...
73
-
74
- @abstractmethod
75
- async def check_status(
76
- self,
77
- session: ConversationSession,
78
- ) -> dict:
79
- """
80
- Check the status of an async session.
81
-
82
- Args:
83
- session: The session to check
84
-
85
- Returns:
86
- Status dict with at least {"status": "running"|"completed"|"failed"}
87
- """
88
- ...
89
-
90
- @abstractmethod
91
- async def stop(
92
- self,
93
- session: ConversationSession,
94
- ) -> None:
95
- """
96
- Stop/kill a session.
97
-
98
- Args:
99
- session: The session to stop
100
- """
101
- ...
102
-
103
- async def cleanup(self) -> None:
104
- """
105
- Clean up adapter resources (e.g., MCP server).
106
-
107
- Called when the orchestrator shuts down.
108
- """
109
- pass