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
**Augmented LLM** is an LLM enhanced with augmentations such as retrieval, tools, and memory. Our current models can actively use these capabilities—generating their own search queries, selecting appropriate tools, and determining what information to retain.
**Chaining** decomposes a task into a sequence of steps, where each agent processes the output of the previous one.
214
234
215
-
<palign="center">
216
-
<imgsrc="assets/patterns-chaining.png">
217
-
</p>
235
+
```mermaid
236
+
flowchart LR
237
+
In([In]) --> Agent1[Agent 1]
238
+
Agent1 --> |Out1| Agent2[Agent 2]
239
+
Agent2 --> |Out2| Agent3[Agent 3]
240
+
Agent3 --> Out([Out])
241
+
242
+
style In fill:#ffb3ba,stroke-width:0px
243
+
style Out fill:#ffb3ba,stroke-width:0px
244
+
style Agent1 fill:#baffc9,stroke-width:0px
245
+
style Agent2 fill:#baffc9,stroke-width:0px
246
+
style Agent3 fill:#baffc9,stroke-width:0px
247
+
```
218
248
219
249
**When to use this workflow:** This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks. The main goal is to trade off latency for higher accuracy, by making each agent an easier task.
220
250
@@ -295,9 +325,25 @@ chain = AgentSpec(
295
325
296
326
**Parallelization** distributes independent subtasks across multiple agents for concurrent processing.
297
327
298
-
<palign="center">
299
-
<imgsrc="assets/patterns-parallelization.png">
300
-
</p>
328
+
```mermaid
329
+
flowchart LR
330
+
In([In]) --> Agent1[Agent 1]
331
+
In --> Agent2[Agent 2]
332
+
In --> Agent3[Agent 3]
333
+
334
+
Agent1 --> Aggregator[Aggregator]
335
+
Agent2 --> Aggregator
336
+
Agent3 --> Aggregator
337
+
338
+
Aggregator --> Out([Out])
339
+
340
+
style In fill:#ffb3ba,stroke-width:0px
341
+
style Out fill:#ffb3ba,stroke-width:0px
342
+
style Agent1 fill:#baffc9,stroke-width:0px
343
+
style Agent2 fill:#baffc9,stroke-width:0px
344
+
style Agent3 fill:#baffc9,stroke-width:0px
345
+
style Aggregator fill:#ccccff,stroke-width:0px
346
+
```
301
347
302
348
**When to use this workflow:** Parallelization is effective when the divided subtasks can be parallelized for speed, or when multiple perspectives or attempts are needed for higher confidence results.
303
349
@@ -385,22 +431,36 @@ parallel = AgentSpec(
385
431
386
432
**Triaging** classifies an input and directs it to a specialized followup agent. This workflow allows for separation of concerns, and building more specialized agents.
387
433
388
-
<palign="center">
389
-
<imgsrc="assets/patterns-triaging.png">
390
-
</p>
434
+
```mermaid
435
+
flowchart LR
436
+
In([In]) --> Triage[Triage]
437
+
Triage --> Agent1[Agent 1]
438
+
Triage -.-> Agent2[Agent 2]
439
+
Triage -.-> Agent3[Agent 3]
440
+
Agent1 --> Out([Out])
441
+
Agent2 -.-> Out
442
+
Agent3 -.-> Out
443
+
444
+
style In fill:#ffb3ba,stroke-width:0px
445
+
style Out fill:#ffb3ba,stroke-width:0px
446
+
style Triage fill:#baffc9,stroke-width:0px
447
+
style Agent1 fill:#baffc9,stroke-width:0px
448
+
style Agent2 fill:#baffc9,stroke-width:0px
449
+
style Agent3 fill:#baffc9,stroke-width:0px
450
+
```
391
451
392
452
**When to use this workflow:** This workflow works well for complex tasks where there are distinct categories that are better handled separately, and where classification can be handled accurately, either by an LLM (using Prompting or Function-calling) or a more traditional classification model/algorithm.
393
453
394
454
**Example** (see [examples/patterns/triaging.py](examples/patterns/triaging.py) for a runnable example):
395
455
396
456
```python
397
-
from coagent.agents import ChatAgent, DynamicTriage, Model
457
+
from coagent.agents import ChatAgent, Triage, Model
398
458
from coagent.core import AgentSpec, new
399
459
400
460
model = Model(...)
401
461
402
462
billing = AgentSpec(
403
-
"team.billing",# Under the team namespace
463
+
"billing",
404
464
new(
405
465
ChatAgent,
406
466
system="""\
@@ -418,7 +478,7 @@ Keep responses professional but friendly.\
418
478
)
419
479
420
480
account = AgentSpec(
421
-
"team.account",# Under the team namespace
481
+
"account",
422
482
new(
423
483
ChatAgent,
424
484
system="""\
@@ -438,10 +498,10 @@ Maintain a serious, security-focused tone.\
438
498
triage = AgentSpec(
439
499
"triage",
440
500
new(
441
-
DynamicTriage,
501
+
Triage,
442
502
system="""You are a triage agent who will delegate to sub-agents based on the conversation content.""",
443
503
model=model,
444
-
namespace="team", # Collect all sub-agents under the team namespace
0 commit comments