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
//! Distributed agent execution across multiple processes.
//!
//! Provides a [`TaskBroker`] trait for distributing agent tasks, a
//! [`TaskWorker`] for consuming and executing tasks, and multiple broker
//! implementations:
//!
//! - [`InProcessBroker`] — tokio channels, for testing or single-process parallelism
//! - [`RedisBroker`] — Redis Lists + Hashes, for multi-process execution (`feature = "redis"`)
//! - [`NatsBroker`] — NATS JetStream, durable at-least-once delivery (`feature = "nats"`)
//! - [`AmqpBroker`] — RabbitMQ via AMQP 0-9-1 (`feature = "amqp"`)
//! - [`GrpcBrokerServer`] / [`GrpcBrokerClient`] — gRPC transport (`feature = "grpc"`)
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────┐ submit ┌────────────┐ receive ┌────────────┐
//! │ Producer │ ───────► │ TaskBroker │ ───────► │ TaskWorker │
//! └─────────┘ └────────────┘ └────────────┘
//! ▲ │
//! │ complete │
//! └────────────────────────┘
//! ```
//!
//! To use a different message broker (RabbitMQ, NATS, etc.), implement
//! [`TaskBroker`] for your transport and pass it to [`TaskWorker::new`].
//!
//! ```ignore
//! use daimon::distributed::{InProcessBroker, TaskWorker, AgentTask};
//!
//! let broker = InProcessBroker::new(64);
//! let worker = TaskWorker::new(broker.clone(), || {
//! Agent::builder().model(my_model).build().unwrap()
//! });
//!
//! // Submit work
//! broker.submit(AgentTask::new("Summarize this article")).await?;
//!
//! // Worker loop (run in a background task)
//! worker.run_once().await?;
//! ```
pub use ;
pub use ;
pub use ;
pub use TaskWorker;
pub use RedisBroker;
pub use NatsBroker;
pub use AmqpBroker;
pub use ;