Skip to content

Commit 581a7d0

Browse files
irvinebroqueOxyjun
authored andcommitted
Patterns (#19559)
* Patterns section + links * One page and use <GitHubCode/> component * Add remaining images * fix typo * fix typo * Images * fixes * Remove unneeded images * links * PCX Review --------- Co-authored-by: Jun Lee <[email protected]>
1 parent 50103ba commit 581a7d0

File tree

6 files changed

+88
-0
lines changed

6 files changed

+88
-0
lines changed
318 KB
Loading
374 KB
Loading
310 KB
Loading
355 KB
Loading
324 KB
Loading
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
pcx_content_type: concept
3+
title: Patterns
4+
sidebar:
5+
order: 3
6+
head: []
7+
---
8+
9+
import { GitHubCode } from "~/components";
10+
11+
This page lists and defines common patterns for implementing AI agents, based on [Anthropic's patterns for building effective agents](https://www.anthropic.com/research/building-effective-agents).
12+
13+
Code samples use the [AI SDK](https://sdk.vercel.ai/docs/foundations/agents), running in [Durable Objects](/durable-objects).
14+
15+
## Prompt Chaining
16+
17+
Decomposes tasks into a sequence of steps, where each LLM call processes the output of the previous one.
18+
19+
![Figure 1: Prompt Chaining](~/assets/images/agents/01-prompt-chaining.jpg)
20+
21+
[**Interactive Demo**](https://ai.cloudflare.com/anthropic-agent-patterns)
22+
23+
<GitHubCode
24+
repo="cloudflare/agents"
25+
file="guides/anthropic-patterns/src/flows/01 sequential.txt"
26+
commit="56fb801dc8f980f080b36fcdbd94005099829495"
27+
lang="ts"
28+
/>
29+
30+
## Routing
31+
32+
Classifies input and directs it to specialized followup tasks, allowing for separation of concerns.
33+
34+
![Figure 2: Routing](~/assets/images/agents/2_Routing.jpg)
35+
36+
[**Interactive Demo**](https://ai.cloudflare.com/anthropic-agent-patterns)
37+
38+
<GitHubCode
39+
repo="cloudflare/agents"
40+
file="guides/anthropic-patterns/src/flows/02 routing.txt"
41+
commit="56fb801dc8f980f080b36fcdbd94005099829495"
42+
lang="ts"
43+
/>
44+
45+
## Parallelization
46+
47+
Enables simultaneous task processing through sectioning or voting mechanisms.
48+
49+
![Figure 3: Parallelization](~/assets/images/agents/3_Parallelization.jpg)
50+
51+
[**Interactive Demo**](https://ai.cloudflare.com/anthropic-agent-patterns)
52+
53+
<GitHubCode
54+
repo="cloudflare/agents"
55+
file="guides/anthropic-patterns/src/flows/03 parallel.txt"
56+
commit="56fb801dc8f980f080b36fcdbd94005099829495"
57+
lang="ts"
58+
/>
59+
60+
## Orchestrator-Workers
61+
62+
A central LLM dynamically breaks down tasks, delegates to Worker LLMs, and synthesizes results.
63+
64+
![Figure 4: Orchestrator Workers](~/assets/images/agents/4_Orchestrator-Workers.jpg)
65+
66+
[**Interactive Demo**](https://ai.cloudflare.com/anthropic-agent-patterns)
67+
68+
<GitHubCode
69+
repo="cloudflare/agents"
70+
file="guides/anthropic-patterns/src/flows/04 orchestrator.txt"
71+
commit="56fb801dc8f980f080b36fcdbd94005099829495"
72+
lang="ts"
73+
/>
74+
75+
## Evaluator-Optimizer
76+
77+
One LLM generates responses while another provides evaluation and feedback in a loop.
78+
79+
![Figure 5: Evaluator-Optimizer](~/assets/images/agents/5_Evaluator-Optimizer.jpg)
80+
81+
[**Interactive Demo**](https://ai.cloudflare.com/anthropic-agent-patterns)
82+
83+
<GitHubCode
84+
repo="cloudflare/agents"
85+
file="guides/anthropic-patterns/src/flows/05 evaluator.txt"
86+
commit="56fb801dc8f980f080b36fcdbd94005099829495"
87+
lang="ts"
88+
/>

0 commit comments

Comments
 (0)