crewdeck 0.1.0__py3-none-any.whl → 0.2.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.
crewdeck/client.py CHANGED
@@ -240,16 +240,19 @@ class EventsAPI:
240
240
  message: Optional[str] = None,
241
241
  task_id: Optional[str] = None,
242
242
  metadata: Optional[Dict[str, Any]] = None,
243
- ) -> None:
243
+ ) -> Dict[str, Any]:
244
244
  """
245
245
  Send an event to the live feed.
246
246
 
247
247
  Args:
248
- type: Event type (message, status, log)
248
+ type: Event type (message, status, log, spawn, complete)
249
249
  agent_name: Agent name (optional)
250
250
  message: Message content
251
251
  task_id: Related task ID
252
252
  metadata: Additional metadata
253
+
254
+ Returns:
255
+ Response data (may include taskId for spawn events)
253
256
  """
254
257
  event = Event(
255
258
  type=type,
@@ -258,7 +261,7 @@ class EventsAPI:
258
261
  task_id=task_id,
259
262
  metadata=metadata,
260
263
  )
261
- self._client._request("POST", "/api/v1/events", json=event.to_dict())
264
+ return self._client._request("POST", "/api/v1/events", json=event.to_dict())
262
265
 
263
266
  def message(self, content: str, agent_name: Optional[str] = None) -> None:
264
267
  """
@@ -285,6 +288,97 @@ class EventsAPI:
285
288
  metadata: Additional data to log
286
289
  """
287
290
  self.send(type="log", message=message, agent_name=agent_name, metadata=metadata)
291
+
292
+ def spawn(
293
+ self,
294
+ task: str,
295
+ agent_name: str,
296
+ spawned_by: Optional[str] = None,
297
+ description: Optional[str] = None,
298
+ priority: str = "medium",
299
+ tags: Optional[List[str]] = None,
300
+ label: Optional[str] = None,
301
+ ) -> str:
302
+ """
303
+ Spawn a task for an agent. Auto-creates the task and sets agent to working.
304
+
305
+ Args:
306
+ task: Task title/description
307
+ agent_name: Agent to assign the task to
308
+ spawned_by: Name of agent/user that spawned this task
309
+ description: Detailed task description
310
+ priority: Task priority (low, medium, high, critical)
311
+ tags: Task tags
312
+ label: Optional label for tracking
313
+
314
+ Returns:
315
+ Task ID of the created task
316
+
317
+ Example:
318
+ task_id = deck.events.spawn(
319
+ task="Build the landing page",
320
+ agent_name="HAPPY",
321
+ spawned_by="JARVIS"
322
+ )
323
+ """
324
+ metadata: Dict[str, Any] = {
325
+ "task": task,
326
+ "agentName": agent_name,
327
+ }
328
+ if spawned_by:
329
+ metadata["spawnedBy"] = spawned_by
330
+ if description:
331
+ metadata["description"] = description
332
+ if priority:
333
+ metadata["priority"] = priority
334
+ if tags:
335
+ metadata["tags"] = tags
336
+ if label:
337
+ metadata["label"] = label
338
+
339
+ response = self.send(
340
+ type="spawn",
341
+ agent_name=agent_name,
342
+ metadata=metadata,
343
+ )
344
+ return response.get("taskId", "")
345
+
346
+ def complete(
347
+ self,
348
+ agent_name: str,
349
+ task_id: Optional[str] = None,
350
+ output: Optional[str] = None,
351
+ message: Optional[str] = None,
352
+ ) -> None:
353
+ """
354
+ Mark work as complete. Moves task to REVIEW and sets agent to idle.
355
+
356
+ Args:
357
+ agent_name: Agent that completed the work
358
+ task_id: Task ID to complete (optional)
359
+ output: Task output/deliverables
360
+ message: Completion message for live feed
361
+
362
+ Example:
363
+ deck.events.complete(
364
+ agent_name="HAPPY",
365
+ task_id="abc123",
366
+ output="Deployed to vercel: https://..."
367
+ )
368
+ """
369
+ metadata: Dict[str, Any] = {}
370
+ if task_id:
371
+ metadata["taskId"] = task_id
372
+ if output:
373
+ metadata["output"] = output
374
+
375
+ self.send(
376
+ type="complete",
377
+ agent_name=agent_name,
378
+ message=message or output or "Work completed",
379
+ task_id=task_id,
380
+ metadata=metadata if metadata else None,
381
+ )
288
382
 
289
383
 
290
384
  class CrewDeck:
@@ -384,6 +478,58 @@ class CrewDeck:
384
478
  except httpx.RequestError as e:
385
479
  raise CrewDeckError(f"Request failed: {e}")
386
480
 
481
+ def spawn(
482
+ self,
483
+ task: str,
484
+ agent: str,
485
+ spawned_by: Optional[str] = None,
486
+ **kwargs,
487
+ ) -> str:
488
+ """
489
+ Spawn a task for an agent. Convenience wrapper for events.spawn().
490
+
491
+ Args:
492
+ task: Task title/description
493
+ agent: Agent to assign the task to
494
+ spawned_by: Name of agent/user that spawned this task
495
+ **kwargs: Additional args passed to events.spawn()
496
+
497
+ Returns:
498
+ Task ID of the created task
499
+
500
+ Example:
501
+ task_id = deck.spawn("Build landing page", "HAPPY", spawned_by="JARVIS")
502
+ """
503
+ return self.events.spawn(
504
+ task=task,
505
+ agent_name=agent,
506
+ spawned_by=spawned_by,
507
+ **kwargs,
508
+ )
509
+
510
+ def complete(
511
+ self,
512
+ agent: str,
513
+ task_id: Optional[str] = None,
514
+ output: Optional[str] = None,
515
+ ) -> None:
516
+ """
517
+ Mark work as complete. Convenience wrapper for events.complete().
518
+
519
+ Args:
520
+ agent: Agent that completed the work
521
+ task_id: Task ID to complete (optional)
522
+ output: Task output/deliverables
523
+
524
+ Example:
525
+ deck.complete("HAPPY", task_id, output="Deployed to https://...")
526
+ """
527
+ self.events.complete(
528
+ agent_name=agent,
529
+ task_id=task_id,
530
+ output=output,
531
+ )
532
+
387
533
  def close(self) -> None:
388
534
  """Close the HTTP client"""
389
535
  self._client.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crewdeck
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Python SDK for CrewDeck - AI agent management dashboard
5
5
  Project-URL: Homepage, https://crewdeck.dev
6
6
  Project-URL: Documentation, https://docs.crewdeck.dev
@@ -147,6 +147,49 @@ deck.events.send(
147
147
  )
148
148
  ```
149
149
 
150
+ ### Spawn & Complete (Recommended)
151
+
152
+ The easiest way to manage agent tasks — auto-creates tasks and updates status:
153
+
154
+ ```python
155
+ # Spawn a task for an agent
156
+ # Creates task, assigns to agent, sets status IN_PROGRESS, agent → working
157
+ task_id = deck.spawn(
158
+ task="Build the landing page",
159
+ agent="HAPPY",
160
+ spawned_by="JARVIS" # optional: who requested this
161
+ )
162
+
163
+ # ... agent does the work ...
164
+
165
+ # Mark complete
166
+ # Moves task to REVIEW, sets agent → idle
167
+ deck.complete(
168
+ agent="HAPPY",
169
+ task_id=task_id,
170
+ output="Deployed to https://crewdeck.dev"
171
+ )
172
+ ```
173
+
174
+ Or use the events API directly:
175
+
176
+ ```python
177
+ # Spawn via events
178
+ task_id = deck.events.spawn(
179
+ task="Analyze user feedback",
180
+ agent_name="FRIDAY",
181
+ priority="high",
182
+ tags=["research", "urgent"]
183
+ )
184
+
185
+ # Complete via events
186
+ deck.events.complete(
187
+ agent_name="FRIDAY",
188
+ task_id=task_id,
189
+ output="Analysis complete: 85% positive sentiment"
190
+ )
191
+ ```
192
+
150
193
  ## Integration Examples
151
194
 
152
195
  ### CrewAI
@@ -0,0 +1,8 @@
1
+ crewdeck/__init__.py,sha256=gacJzO7ee1B2wvd0oyX4VC8SFiDLnD2ophYHMgAE8Hg,905
2
+ crewdeck/client.py,sha256=d8r6bOcTUBlZgmU7x8NbIa4iNAOCeXdYjZdeceQM2tY,15661
3
+ crewdeck/exceptions.py,sha256=vOvYYdlP0wvkuuUhYE5Wj2pnuJXqmCiYcs5cobdijDM,763
4
+ crewdeck/models.py,sha256=-2cScY_4I-0wg33S5Pa3EfKBx7tSdrCOMU2RPTXjIpw,3182
5
+ crewdeck-0.2.0.dist-info/METADATA,sha256=Fgoyi3mNfMYM40huwy7p9GPwsaVSgoakVbVNAii_OFo,6809
6
+ crewdeck-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
7
+ crewdeck-0.2.0.dist-info/licenses/LICENSE,sha256=z0AZu5f134PY4UJ0L_nPuqlyZa14gMPIR-4u8M-5qjI,1065
8
+ crewdeck-0.2.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- crewdeck/__init__.py,sha256=gacJzO7ee1B2wvd0oyX4VC8SFiDLnD2ophYHMgAE8Hg,905
2
- crewdeck/client.py,sha256=ZcrLjDcCCscoQj2rFsGMJ-FTZOmu0YeAhQF1oX7EzP4,11266
3
- crewdeck/exceptions.py,sha256=vOvYYdlP0wvkuuUhYE5Wj2pnuJXqmCiYcs5cobdijDM,763
4
- crewdeck/models.py,sha256=-2cScY_4I-0wg33S5Pa3EfKBx7tSdrCOMU2RPTXjIpw,3182
5
- crewdeck-0.1.0.dist-info/METADATA,sha256=I5IPqTQoAuF7A3cRwUfo1wgOTtPAtoTzh8oMRv6XFjQ,5884
6
- crewdeck-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
7
- crewdeck-0.1.0.dist-info/licenses/LICENSE,sha256=z0AZu5f134PY4UJ0L_nPuqlyZa14gMPIR-4u8M-5qjI,1065
8
- crewdeck-0.1.0.dist-info/RECORD,,